Equalizer  1.4.1
Public Member Functions | Protected Member Functions | Protected Types | Friends
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

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

Protected Member Functions

CO_API Serializable ()
 Construct a new Serializable.
CO_API Serializable (const Serializable &)
 Construct an unmapped, unregistered copy of an serializable.
virtual CO_API ~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 CO_API void setDirty (const uint64_t bits)
 Add dirty flags to mark data for distribution.
virtual CO_API void unsetDirty (const uint64_t bits)
 Remove dirty flags to clear data from distribution.
virtual CO_API 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...

Friends

class detail::Serializable

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_API co::Serializable::Serializable ( ) [protected]

Construct a new Serializable.

Version:
1.0
CO_API co::Serializable::Serializable ( const Serializable ) [protected]

Construct an unmapped, unregistered copy of an serializable.

Version:
1.0
virtual CO_API co::Serializable::~Serializable ( ) [protected, virtual]

Destruct the serializable.

Version:
1.0

Member Function Documentation

virtual CO_API uint128_t co::Serializable::commit ( const uint32_t  incarnation = CO_COMMIT_NEXT) [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.

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]
CO_API uint64_t co::Serializable::getDirty ( ) const
Returns:
the current dirty bit mask.
Version:
1.0
virtual CO_API bool co::Serializable::isDirty ( ) const [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.

virtual CO_API bool co::Serializable::isDirty ( const uint64_t  dirtyBits) const [virtual]
Returns:
true if the given dirty bit is set.
Version:
1.0
virtual CO_API void co::Serializable::notifyAttached ( ) [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.

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 >, seq::ViewData, eq::fabric::Layout< C, L, V >, eq::fabric::Layout< Config, Layout, View >, eqNbody::FrameData, osgScaleViewer::FrameData, eVolve::FrameData, co::ObjectMap, and eqNbody::SharedDataProxy.

Definition at line 75 of file serializable.h.

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

+ Here is the caller graph for this function:

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

Remove dirty flags to clear data from distribution.

Version:
1.0

The documentation for this class was generated from the following file:
Generated on Mon Nov 26 2012 14:41:50 for Equalizer 1.4.1 by  doxygen 1.7.6.1