Equalizer
1.2.1
|
Base class for distributed, inheritable objects. More...
#include <serializable.h>
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... |
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.
enum co::Serializable::DirtyBits [protected] |
The changed parts of the serializable since the last pack().
Subclasses should define their own bits, starting at DIRTY_CUSTOM.
Reimplemented in eq::fabric::Channel< W, C >, eq::fabric::Channel< Window, Channel >, eq::fabric::Window< P, W, C >, eq::fabric::Window< Pipe, Window, Channel >, eq::fabric::View< L, V, O >, eq::fabric::View< Layout, View, Observer >, 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::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::Object, eq::fabric::Layout< C, L, V >, eq::fabric::Layout< Config, Layout, View >, eVolve::FrameData, osgScaleViewer::FrameData, eqNbody::FrameData, co::ObjectMap, and eqNbody::SharedDataProxy.
Definition at line 103 of file serializable.h.
co::Serializable::Serializable | ( | ) | [inline, protected] |
co::Serializable::Serializable | ( | const Serializable & | ) | [inline, protected] |
Construct an unmapped, unregistered copy of an serializable.
Definition at line 63 of file serializable.h.
virtual co::Serializable::~Serializable | ( | ) | [inline, protected, virtual] |
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.
incarnation | the commit incarnation for auto obsoletion. |
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().
virtual void co::Serializable::deserialize | ( | co::DataIStream & | , |
const uint64_t | |||
) | [inline, protected, virtual] |
Worker for unpack() and applyInstanceData().
This function is called with the dirty bits send by the master instance. The dirty bits are received beforehand, and do not need to be deserialized by the overriding method.
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 >, osgScaleViewer::FrameData, eqNbody::FrameData, eVolve::FrameData, eq::View, seq::ViewData, co::ObjectMap, and eqNbody::SharedDataProxy.
Definition at line 93 of file serializable.h.
Referenced by eqNbody::FrameData::deserialize().
virtual ChangeType co::Serializable::getChangeType | ( | ) | const [inline, protected, virtual] |
Reimplemented from co::Object.
Reimplemented in eq::fabric::Channel< W, C >, eq::fabric::Channel< Window, Channel >, 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::Node< C, N, P, V >, eq::fabric::Node< Config, Node, Pipe, NodeVisitor >, eqPly::FrameData, eqPly::FrameData, osgScaleViewer::FrameData, eVolve::FrameData, co::ObjectMap, and eqNbody::SharedDataProxy.
Definition at line 95 of file serializable.h.
References co::Object::DELTA.
uint64_t co::Serializable::getDirty | ( | ) | const [inline] |
virtual bool co::Serializable::isDirty | ( | ) | const [inline, virtual] |
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] |
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.
Reimplemented from co::Object.
Reimplemented in eq::Config, and co::ObjectMap.
Definition at line 116 of file serializable.h.
References co::Object::isMaster().
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.
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().
virtual void co::Serializable::setDirty | ( | const uint64_t | bits | ) | [inline, protected, virtual] |
Add dirty flags to mark data for distribution.
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::Pipe, 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::Canvas< CFG, C, S, L >, eq::fabric::Canvas< Config, Canvas, Segment, Layout >, eq::Node, eq::fabric::Node< C, N, P, V >, eq::fabric::Node< Config, Node, Pipe, NodeVisitor >, eq::fabric::Observer< C, O >, eq::fabric::Observer< Config, Observer >, eq::fabric::Layout< C, L, V >, and eq::fabric::Layout< Config, Layout, View >.
Definition at line 111 of file serializable.h.
Referenced by osgScaleViewer::FrameData::setCameraLookAtPoint(), osgScaleViewer::FrameData::setCameraPosition(), osgScaleViewer::FrameData::setCameraUpVector(), and osgScaleViewer::FrameData::toggleStatistics().
virtual void co::Serializable::unsetDirty | ( | const uint64_t | bits | ) | [inline, protected, virtual] |
Remove dirty flags to clear data from distribution.
Definition at line 114 of file serializable.h.