Equalizer  1.2.1
Public Member Functions | Protected Member Functions | Protected Types
co::Serializable Class Reference

Base class for distributed, inheritable objects. More...

#include <serializable.h>

+ Inheritance diagram for co::Serializable:
+ Collaboration diagram for co::Serializable:

List of all members.

Public Member Functions

uint64_t getDirty () const
virtual bool isDirty () const
virtual bool isDirty (const uint64_t dirtyBits) const
virtual uint128_t commit (const uint32_t incarnation=CO_COMMIT_NEXT)
 Commit a new version of this object.

Protected Member Functions

 Serializable ()
 Construct a new Serializable.
 Serializable (const Serializable &)
 Construct an unmapped, unregistered copy of an serializable.
virtual ~Serializable ()
 Destruct the serializable.
virtual void serialize (co::DataOStream &, const uint64_t)
 Worker for pack() and getInstanceData().
virtual void deserialize (co::DataIStream &, const uint64_t)
 Worker for unpack() and applyInstanceData().
virtual ChangeType getChangeType () const
virtual void setDirty (const uint64_t bits)
 Add dirty flags to mark data for distribution.
virtual void unsetDirty (const uint64_t bits)
 Remove dirty flags to clear data from distribution.
virtual void notifyAttached ()
 Notify that this object has been registered or mapped.

Protected Types

enum  DirtyBits { DIRTY_NONE = 0, DIRTY_CUSTOM = 1, DIRTY_ALL = 0xFFFFFFFFFFFFFFFFull }
 The changed parts of the serializable since the last pack(). More...

Detailed Description

Base class for distributed, inheritable objects.

This class implements one usage pattern of co::Object, which allows subclassing and serialization of distributed Objects. The implementation hierarchy co::Serializable -> eq::fabric::Object -> eq::fabric::Frustum illustrates the usage of this class.

Definition at line 35 of file serializable.h.


Member Enumeration Documentation

enum co::Serializable::DirtyBits [protected]

Constructor & Destructor Documentation

co::Serializable::Serializable ( ) [inline, protected]

Construct a new Serializable.

Version:
1.0

Definition at line 57 of file serializable.h.

co::Serializable::Serializable ( const Serializable ) [inline, protected]

Construct an unmapped, unregistered copy of an serializable.

Version:
1.0

Definition at line 63 of file serializable.h.

virtual co::Serializable::~Serializable ( ) [inline, protected, virtual]

Destruct the serializable.

Version:
1.0

Definition at line 67 of file serializable.h.


Member Function Documentation

virtual uint128_t co::Serializable::commit ( const uint32_t  incarnation = CO_COMMIT_NEXT) [inline, virtual]

Commit a new version of this object.

Objects using the change type STATIC can not be committed.

Master instances will increment new versions continously, starting at VERSION_FIRST. If the object has not changed, no new version will be generated, that is, the current version is returned. The high value of the returned version will always be 0.

Slave objects can be commited, but have certain caveats for serialization. Please refer to the Programming Guide for more details. Slave object commits will return a random version on a successful commit, or VERSION_NONE if the object has not changed since the last commit. The high value of a successful commit will never be 0.

The incarnation count is meaningful for buffered master objects. The commit implementation will keep all instance data committed with an incarnation count newer than current_incarnation - getAutoObsolete(). By default, each call to commit creates a new incarnation, retaining the data from last getAutoObsolete() commit calls. When the application wishes to auto obsolete by another metric than commit calls, it has to consistently provide an incarnation counter. Buffers with a higher incarnation count than the current are discarded. A typical use case is to tie the auto obsoletion to an application-specific frame loop. Decreasing the incarnation counter will lead to undefined results.

Parameters:
incarnationthe commit incarnation for auto obsoletion.
Returns:
the new head version.

Reimplemented from co::Object.

Reimplemented in eq::fabric::Config< S, C, O, L, CV, N, V >, eq::fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor >, eq::fabric::Window< P, W, C >, eq::fabric::Window< Pipe, Window, Channel >, eq::fabric::Segment< C, S, CH >, eq::fabric::Segment< Canvas, Segment, Channel >, eq::fabric::Pipe< N, P, W, V >, eq::fabric::Pipe< Node, Pipe, eq::Window, PipeVisitor >, eq::fabric::Node< C, N, P, V >, eq::fabric::Node< Config, Node, Pipe, NodeVisitor >, eq::fabric::Object, and co::ObjectMap.

Definition at line 48 of file serializable.h.

Referenced by eVolve::Config::startFrame(), osgScaleViewer::Config::startFrame(), and eqPly::Config::startFrame().

+ Here is the caller graph for this function:

virtual void co::Serializable::deserialize ( co::DataIStream ,
const uint64_t   
) [inline, protected, virtual]
virtual ChangeType co::Serializable::getChangeType ( ) const [inline, protected, virtual]
uint64_t co::Serializable::getDirty ( ) const [inline]
Returns:
the current dirty bit mask.
Version:
1.0

Definition at line 39 of file serializable.h.

virtual bool co::Serializable::isDirty ( ) const [inline, virtual]
Returns:
true if the serializable has to be committed.
Version:
1.0

Reimplemented from co::Object.

Reimplemented in eq::fabric::Object, and co::ObjectMap.

Definition at line 42 of file serializable.h.

virtual bool co::Serializable::isDirty ( const uint64_t  dirtyBits) const [inline, virtual]
Returns:
true if the given dirty bit is set.
Version:
1.0

Definition at line 45 of file serializable.h.

virtual void co::Serializable::notifyAttached ( ) [inline, protected, virtual]

Notify that this object has been registered or mapped.

The method is called from the thread initiating the registration or mapping, after the operation has been completed successfully.

See also:
isMaster()

Reimplemented from co::Object.

Reimplemented in eq::Config, and co::ObjectMap.

Definition at line 116 of file serializable.h.

References co::Object::isMaster().

+ Here is the call graph for this function:

virtual void co::Serializable::serialize ( co::DataOStream ,
const uint64_t   
) [inline, protected, virtual]

Worker for pack() and getInstanceData().

Override this and deserialize() if you want to distribute subclassed data.

This method is called with DIRTY_ALL from getInstanceData() and with the actual dirty bits from pack(), which also resets the dirty state afterwards. The dirty bits are transmitted beforehand, and do not need to be transmitted by the overriding method.

Version:
1.0

Reimplemented in eq::fabric::Channel< W, C >, eq::fabric::Channel< Window, Channel >, eq::fabric::View< L, V, O >, eq::fabric::View< Layout, View, Observer >, eq::fabric::Config< S, C, O, L, CV, N, V >, eq::fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor >, eq::fabric::Window< P, W, C >, eq::fabric::Window< Pipe, Window, Channel >, eq::fabric::Pipe< N, P, W, V >, eq::fabric::Pipe< Node, Pipe, eq::Window, PipeVisitor >, eq::fabric::Segment< C, S, CH >, eq::fabric::Segment< Canvas, Segment, Channel >, eq::fabric::Object, eq::fabric::Canvas< CFG, C, S, L >, eq::fabric::Canvas< Config, Canvas, Segment, Layout >, eq::fabric::Node< C, N, P, V >, eq::fabric::Node< Config, Node, Pipe, NodeVisitor >, eqPly::FrameData, eqPly::FrameData, eq::fabric::Observer< C, O >, eq::fabric::Observer< Config, Observer >, eq::fabric::Layout< C, L, V >, eq::fabric::Layout< Config, Layout, View >, eqNbody::FrameData, osgScaleViewer::FrameData, eVolve::FrameData, seq::ViewData, co::ObjectMap, and eqNbody::SharedDataProxy.

Definition at line 81 of file serializable.h.

Referenced by eqNbody::FrameData::serialize().

+ Here is the caller graph for this function:

virtual void co::Serializable::setDirty ( const uint64_t  bits) [inline, protected, virtual]
virtual void co::Serializable::unsetDirty ( const uint64_t  bits) [inline, protected, virtual]

Remove dirty flags to clear data from distribution.

Version:
1.0

Definition at line 114 of file serializable.h.


The documentation for this class was generated from the following file:
Generated on Fri Jun 8 2012 15:44:34 for Equalizer 1.2.1 by  doxygen 1.8.0