Collage  0.6.1
Public Member Functions | Protected Member Functions
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.

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

Protected Member Functions

virtual void attach (const 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.

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 ( const uint32_t  timeout = LB_TIMEOUT_INDEFINITE)

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

The implementation currently assumes that the master node instance also enters the barrier. If a timeout happens a timeout exception is thrown.

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

Reimplemented from co::Object.

Definition at line 85 of file barrier.h.

References co::Object::DELTA.

CO_API uint32_t co::Barrier::getHeight ( ) const
Returns:
the number of participants.
virtual void co::Barrier::getInstanceData ( DataOStream os) [protected, virtual]

Serialize all instance information of this distributed object.

Parameters:
osThe output stream.

Implements co::Object.

CO_API void co::Barrier::increase ( )

Add one participant to the barrier.

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.

CO_API void co::Barrier::setHeight ( const uint32_t  height)

Set the number of participants in the barrier.

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 Mon Nov 26 2012 14:41:44 for Collage 0.6.1 by  doxygen 1.7.6.1