Equalizer
1.4.1
|
Base class for distributed, inheritable objects. More...
#include <serializable.h>
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 |
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::View< L, V, O >, eq::fabric::View< Layout, View, Observer >, 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::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 97 of file serializable.h.
CO_API co::Serializable::Serializable | ( | ) | [protected] |
Construct a new Serializable.
CO_API co::Serializable::Serializable | ( | const Serializable & | ) | [protected] |
Construct an unmapped, unregistered copy of an serializable.
virtual CO_API co::Serializable::~Serializable | ( | ) | [protected, virtual] |
Destruct the serializable.
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.
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.
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 >, seq::ViewData, eq::fabric::Layout< C, L, V >, eq::fabric::Layout< Config, Layout, View >, osgScaleViewer::FrameData, eqNbody::FrameData, eVolve::FrameData, eq::View, co::ObjectMap, and eqNbody::SharedDataProxy.
Definition at line 87 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 89 of file serializable.h.
References co::Object::DELTA.
CO_API uint64_t co::Serializable::getDirty | ( | ) | const |
virtual CO_API bool co::Serializable::isDirty | ( | ) | const [virtual] |
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] |
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.
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.
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().
virtual CO_API void co::Serializable::setDirty | ( | const uint64_t | bits | ) | [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 >.
Referenced by osgScaleViewer::FrameData::setCameraLookAtPoint(), osgScaleViewer::FrameData::setCameraPosition(), osgScaleViewer::FrameData::setCameraUpVector(), and osgScaleViewer::FrameData::toggleStatistics().
virtual CO_API void co::Serializable::unsetDirty | ( | const uint64_t | bits | ) | [protected, virtual] |
Remove dirty flags to clear data from distribution.