Equalizer 1.0

co::Barrier Class Reference

A networked, versioned barrier. More...

#include <barrier.h>

Inheritance diagram for co::Barrier:
Collaboration diagram for co::Barrier:

List of all members.

Public Member Functions

CO_API Barrier (NodePtr master, const uint32_t height=0)
 Construct a new barrier.
CO_API Barrier ()
 Construct a new barrier, to be mapped to the master version.
virtual CO_API ~Barrier ()
 Destruct the barrier.
Data Access

After a change, the barrier should be committed and synced to the same version on all nodes entering the barrier.

void setHeight (const uint32_t height)
 Set the number of participants in the barrier.
void increase ()
 Add one participant to the barrier.
uint32_t getHeight () const
Operations
CO_API void enter ()
 Enter the barrier, blocks until the barrier has been reached.

Protected Member Functions

virtual void attach (const base::UUID &id, const uint32_t instanceID)
virtual ChangeType getChangeType () const
virtual void getInstanceData (DataOStream &os)
 Serialize all instance information of this distributed object.
virtual void applyInstanceData (DataIStream &is)
 Deserialize the instance data.
virtual void pack (DataOStream &os)
 Serialize the modifications since the last call to commit().
virtual void unpack (DataIStream &is)
 Deserialize a change.

Detailed Description

A networked, versioned barrier.

Definition at line 30 of file barrier.h.


Constructor & Destructor Documentation

CO_API co::Barrier::Barrier ( NodePtr  master,
const uint32_t  height = 0 
)

Construct a new barrier.

The master node will maintain the barrier state. It has to be reachable from all other nodes participating in the barrier.

The instance created using this constructor should be registered as the master version of the barrier with the LocalNode. Note the node of the object master, i.e., this instance, and the barrier's master node might be different.

CO_API co::Barrier::Barrier ( )

Construct a new barrier, to be mapped to the master version.

virtual CO_API co::Barrier::~Barrier ( ) [virtual]

Destruct the barrier.


Member Function Documentation

virtual void co::Barrier::applyInstanceData ( DataIStream is) [protected, virtual]

Deserialize the instance data.

This method is called during object mapping to populate slave instances with the master object's data.

Parameters:
isthe input stream.

Implements co::Object.

CO_API void co::Barrier::enter ( )

Enter the barrier, blocks until the barrier has been reached.

The implementation currently assumes that the master node instance also enters the barrier.

virtual ChangeType co::Barrier::getChangeType ( ) const [inline, protected, virtual]
Returns:
how the changes are to be handled.

Reimplemented from co::Object.

Definition at line 84 of file barrier.h.

References co::Object::DELTA.

uint32_t co::Barrier::getHeight ( ) const [inline]
Returns:
the number of participants.

Definition at line 66 of file barrier.h.

virtual void co::Barrier::getInstanceData ( DataOStream os) [protected, virtual]

Serialize all instance information of this distributed object.

Parameters:
osThe output stream.

Implements co::Object.

void co::Barrier::increase ( ) [inline]

Add one participant to the barrier.

Definition at line 63 of file barrier.h.

virtual void co::Barrier::pack ( DataOStream os) [protected, virtual]

Serialize the modifications since the last call to commit().

No new version will be created if no data is written to the output stream.

Parameters:
osthe output stream.

Reimplemented from co::Object.

void co::Barrier::setHeight ( const uint32_t  height) [inline]

Set the number of participants in the barrier.

Definition at line 60 of file barrier.h.

virtual void co::Barrier::unpack ( DataIStream is) [protected, virtual]

Deserialize a change.

Parameters:
isthe input data stream.

Reimplemented from co::Object.


The documentation for this class was generated from the following file:
Generated on Sun May 8 2011 19:11:08 for Equalizer 1.0 by  doxygen 1.7.3