graph_analysis
Public Types | Public Member Functions | Static Public Member Functions | List of all members
graph_analysis::TransactionObserver Class Reference

A transaction observer. More...

#include <TransactionObserver.hpp>

Inheritance diagram for graph_analysis::TransactionObserver:
Inheritance graph
[legend]
Collaboration diagram for graph_analysis::TransactionObserver:
Collaboration graph
[legend]

Public Types

typedef shared_ptr< TransactionObserver > Ptr
 
- Public Types inherited from graph_analysis::BaseGraphObserver
typedef shared_ptr< BaseGraphObserver > Ptr
 

Public Member Functions

 TransactionObserver (BaseGraphObserver::Ptr &observer)
 
virtual ~TransactionObserver ()
 
virtual void notify (const Vertex::Ptr &vertex, const EventType &event, const GraphId &origin)
 
virtual void notify (const Edge::Ptr &edge, const EventType &event, const GraphId &origin)
 
virtual void notify (const TransactionType &event, const GraphId &origin)
 
bool inTransaction ()
 return true if a transaction is currently running More...
 
- Public Member Functions inherited from graph_analysis::BaseGraphObserver
virtual ~BaseGraphObserver ()
 

Static Public Member Functions

static TransactionObserver::Ptr getInstance (BaseGraphObserver::Ptr &observer)
 

Detailed Description

A transaction observer.

Store all events until a transaction has been ended. Once the transaction is ended, all events are forwared to the registered observer at once.

If no transaction has been started, the events are passed through directly.

The transaction events TRANSACTION_START and TRANSACTION_STOP can be nested. Events are then held until the outermost transaction has been finished.

* Usage:
* 
* BaseGraphObserver::Ptr obs( new BaseGraphObserver() );
*
* TransactionObserver::Ptr tobs = TransactionObserver::getInstance( obs );
* graph->addObserver( tobs );
* graph->transactionsEvent( TRANSACTION_START );
* // modify graph vertices and edges
* graph->transactionsEvent( TRANSACTION_START );
* graph->transactionEvent( TRANSACTION_STOP );
* graph->transactionEvent( TRANSACTION_STOP );
*
* // events are emited to obs now
*
* 

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ TransactionObserver()

TransactionObserver::TransactionObserver ( BaseGraphObserver::Ptr &  observer)
explicit
Parameters
observer- the observer to which the events are forwarded.

◆ ~TransactionObserver()

TransactionObserver::~TransactionObserver ( )
virtual

Member Function Documentation

◆ getInstance()

TransactionObserver::Ptr TransactionObserver::getInstance ( BaseGraphObserver::Ptr &  observer)
static

◆ inTransaction()

bool TransactionObserver::inTransaction ( )

return true if a transaction is currently running

◆ notify() [1/3]

void TransactionObserver::notify ( const Vertex::Ptr &  vertex,
const EventType &  event,
const GraphId &  origin 
)
virtual

Reimplemented from graph_analysis::BaseGraphObserver.

◆ notify() [2/3]

void TransactionObserver::notify ( const Edge::Ptr &  edge,
const EventType &  event,
const GraphId &  origin 
)
virtual

Reimplemented from graph_analysis::BaseGraphObserver.

◆ notify() [3/3]

void TransactionObserver::notify ( const TransactionType &  event,
const GraphId &  origin 
)
virtual

Reimplemented from graph_analysis::BaseGraphObserver.


The documentation for this class was generated from the following files: