#include <object.h>


Public Types | |
| enum | ObsoleteFlags { AUTO_OBSOLETE_COUNT_VERSIONS = 0, AUTO_OBSOLETE_COUNT_COMMITS = 1 } |
| Flags for auto obsoletion. | |
| enum | Version { VERSION_NONE = 0, VERSION_INVALID = 0xfffffffeu, VERSION_OLDEST = VERSION_INVALID, VERSION_HEAD = 0xffffffffu } |
| Special version enums. | |
| enum | ChangeType { STATIC, INSTANCE, DELTA, UNBUFFERED } |
| Object change handling characteristics. More... | |
Public Member Functions | |
| Object () | |
| Construct a new distributed object. | |
| virtual | ~Object () |
| Destruct the distributed object. | |
| virtual void | attachToSession (const uint32_t id, const uint32_t instanceID, Session *session) |
| Called when object is attached to session. | |
| virtual void | detachFromSession () |
| Called when object is detached from session. | |
| virtual void | makeThreadSafe () |
| Make this object thread safe. | |
| bool | isThreadSafe () const |
| NodePtr | getLocalNode () |
| const Session * | getSession () const |
| Session * | getSession () |
| uint32_t | getID () const |
| uint32_t | getInstanceID () const |
| bool | isMaster () const |
Versioning | |
| virtual ChangeType | getChangeType () const |
| void | becomeMaster () |
| Switches a slave object to become the master instance. | |
| virtual bool | isDirty () const |
| Return if this object needs a commit. | |
| virtual uint32_t | commit () |
| Commit a new version of this object. | |
| uint32_t | commitNB () |
| Start committing a new version of this object. | |
| uint32_t | commitSync (const uint32_t commitID) |
| Finalizes a commit transaction. | |
| void | obsolete (const uint32_t version) |
| Explicitly obsoletes all versions including version. | |
| void | setAutoObsolete (const uint32_t count, const uint32_t flags=AUTO_OBSOLETE_COUNT_VERSIONS) |
| Automatically obsolete old versions. | |
| uint32_t | getAutoObsoleteCount () const |
| uint32_t | sync (const uint32_t version=VERSION_HEAD) |
| Sync to a given version. | |
| uint32_t | getHeadVersion () const |
| uint32_t | getVersion () const |
| uint32_t | getOldestVersion () const |
| virtual void | notifyNewHeadVersion (const uint32_t version) |
| Notification that a new head version was received by a slave object. | |
Methods used by session during mapping. | |
| void | setupChangeManager (const Object::ChangeType type, const bool master, const uint32_t masterInstanceID=EQ_ID_INVALID) |
| Setup the change manager. | |
Protected Member Functions | |
| Object (const Object &) | |
| Copy constructor. | |
| const Object & | operator= (const Object &) |
| NOP assignment operator. | |
| uint32_t | getMasterInstanceID () const |
| void | addSlave (NodePtr node, const uint32_t instanceID, const uint32_t version) |
| Add a slave subscriber. | |
| void | removeSlave (NodePtr node) |
| Remove a subscribed slave. | |
Automatic Instantiation and Versioning | |
| virtual void | getInstanceData (DataOStream &os)=0 |
| Serialize the instance information about this managed object. | |
| virtual void | applyInstanceData (DataIStream &is)=0 |
| 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. | |
Packet Transmission | |
| bool | send (NodePtr node, ObjectPacket &packet) |
| Send a packet to peer object instance(s) on another node. | |
| bool | send (NodePtr node, ObjectPacket &packet, const std::string &string) |
| Send a packet to peer object instance(s) on another node. | |
| bool | send (NodePtr node, ObjectPacket &packet, const void *data, const uint64_t size) |
| Send a packet to peer object instance(s) on another node. | |
Friends | |
| class | Session |
| class | DeltaMasterCM |
| class | DeltaSlaveCM |
| class | FullMasterCM |
| class | FullSlaveCM |
| class | StaticMasterCM |
| class | StaticSlaveCM |
| class | UnbufferedMasterCM |
Please refer to the Programming Guide and examples on how to develop and use distributed objects.
Definition at line 43 of file net/object.h.
Object change handling characteristics.
| STATIC | non-versioned, static object. |
| INSTANCE | use only instance data |
| DELTA | use pack/unpack delta |
| UNBUFFERED | versioned, but don't retain versions |
Definition at line 65 of file net/object.h.
| eq::net::Object::Object | ( | ) |
Construct a new distributed object.
Reimplemented in eq::Object.
Definition at line 45 of file net/object.cpp.
| eq::net::Object::~Object | ( | ) | [virtual] |
Destruct the distributed object.
Reimplemented in eq::Object.
Definition at line 65 of file net/object.cpp.
References EQERROR, eq::net::Session::getID(), and eq::net::ObjectCM::ZERO.

| eq::net::Object::Object | ( | const Object & | object | ) | [protected] |
| void eq::net::Object::attachToSession | ( | const uint32_t | id, | |
| const uint32_t | instanceID, | |||
| Session * | session | |||
| ) | [virtual] |
Called when object is attached to session.
For internal use only.
Reimplemented in eq::Channel, eq::FrameData, eq::Node, eq::Object, eq::Pipe, eq::Window, eq::net::Barrier, eq::server::Channel, eq::server::Node, eq::server::Pipe, and eq::server::Window.
Definition at line 76 of file net/object.cpp.
References EQINFO, eq::net::Session::getCommandThreadQueue(), isMaster(), and eq::net::Dispatcher::registerCommand().

| void eq::net::Object::detachFromSession | ( | ) | [virtual] |
Called when object is detached from session.
For internal use only.
Definition at line 108 of file net/object.cpp.
References isMaster(), and eq::net::ObjectCM::ZERO.

| void eq::net::Object::makeThreadSafe | ( | ) | [virtual] |
Make this object thread safe.
The caller has to ensure that no other thread is using this object when this function is called. If you don't call this function, certain operations, e.g., sync(), are not-threadsafe.
Definition at line 138 of file net/object.cpp.
References eq::net::ObjectCM::makeThreadSafe().
Referenced by eq::Node::getBarrier(), and eq::Node::getFrameData().


| bool eq::net::Object::isThreadSafe | ( | ) | const [inline] |
Definition at line 100 of file net/object.h.
| NodePtr eq::net::Object::getLocalNode | ( | ) |
Definition at line 148 of file net/object.cpp.
References eq::net::Session::getLocalNode().
Referenced by eq::net::UnbufferedMasterCM::commitNB(), eq::net::FullMasterCM::commitNB(), eq::net::DeltaMasterCM::commitNB(), eq::net::FullSlaveCM::sync(), eq::FrameData::transmit(), and eq::FrameData::update().


| const Session* eq::net::Object::getSession | ( | ) | const [inline] |
Definition at line 112 of file net/object.h.
Referenced by eqPly::VertexBufferDist::applyInstanceData(), eq::server::Frame::cycleData(), eq::net::Barrier::enter(), eq::server::Frame::flush(), eq::Pipe::flushFrames(), eq::Node::getBarrier(), eq::Pipe::getFrame(), eq::Node::getFrameData(), eq::Pipe::getView(), eq::net::ObjectInstanceDataOStream::sendBuffer(), eq::net::ObjectDeltaDataOStream::sendBuffer(), eq::net::ObjectInstanceDataOStream::sendFooter(), eq::net::ObjectDeltaDataOStream::sendFooter(), eq::FrameData::transmit(), eq::server::Observer::unmap(), eq::server::Layout::unmap(), and eq::server::Canvas::unmap().

| Session* eq::net::Object::getSession | ( | ) | [inline] |
Definition at line 118 of file net/object.h.
| uint32_t eq::net::Object::getID | ( | ) | const [inline] |
Definition at line 121 of file net/object.h.
Referenced by eq::net::FullSlaveCM::_unpackOneVersion(), eq::net::StaticSlaveCM::applyMapData(), eq::net::FullSlaveCM::applyMapData(), eq::server::Frame::commit(), eq::Layout::deregister(), eq::Canvas::deregister(), eq::net::Barrier::enter(), eqPly::Channel::frameClear(), eq::server::Config::getDistributorID(), eqPly::VertexBufferDist::getInstanceData(), eqPly::Config::getModel(), eq::net::Session::mapObjectNB(), eq::net::Session::registerObject(), eq::net::ObjectInstanceDataOStream::sendBuffer(), eq::net::ObjectDeltaDataOStream::sendBuffer(), eq::net::ObjectInstanceDataOStream::sendFooter(), eq::net::ObjectDeltaDataOStream::sendFooter(), eq::View::serialize(), eq::server::Layout::serialize(), eq::server::Canvas::serialize(), eq::net::FullSlaveCM::sync(), eq::FrameData::transmit(), eq::server::Observer::unmap(), eq::server::Layout::unmap(), eq::server::Canvas::unmap(), eqPly::Config::unmapData(), eqPly::ModelAssigner::visit(), eq::server::CompoundUpdateInputVisitor::visit(), and eq::server::CompoundInitVisitor::visit().

| uint32_t eq::net::Object::getInstanceID | ( | ) | const [inline] |
Definition at line 124 of file net/object.h.
Referenced by eq::net::FullSlaveCM::_unpackOneVersion(), eq::net::StaticSlaveCM::applyMapData(), eq::net::FullSlaveCM::applyMapData(), eq::net::FullSlaveCM::sync(), and eq::FrameData::update().

| bool eq::net::Object::isMaster | ( | ) | const |
Definition at line 269 of file net/object.cpp.
References eq::net::ObjectCM::isMaster().
Referenced by attachToSession(), becomeMaster(), eq::Observer::deregister(), eq::Layout::deregister(), eq::Canvas::deregister(), detachFromSession(), eq::net::Session::mapObjectNB(), eq::net::Session::mapObjectSync(), eqPly::Config::unmapData(), and eq::net::Session::unmapObject().


| virtual ChangeType eq::net::Object::getChangeType | ( | ) | const [inline, virtual] |
Reimplemented in eq::Frame, eq::FrameData, eq::Object, eq::View, eq::net::Barrier, eqPly::FrameData, eq::server::ConfigSerializer, eq::server::Frame, and eq::server::FrameData.
Definition at line 136 of file net/object.h.
References STATIC.
Referenced by eq::net::FullMasterCM::addSlave(), becomeMaster(), eq::net::UnbufferedMasterCM::commitNB(), eq::net::FullMasterCM::commitNB(), eq::net::DeltaMasterCM::commitNB(), and eq::net::Session::registerObject().

| void eq::net::Object::becomeMaster | ( | ) |
Switches a slave object to become the master instance.
This function unmaps and registers this instance, making it a master instance with a new identifier. The old master is informed of this change and becomes a slave.
Additional slaves are not informed. The object is synced to the head version before switching.
Definition at line 179 of file net/object.cpp.
References eq::net::ObjectCM::addOldMaster(), EQINFO, getChangeType(), eq::net::Session::getID(), eq::net::Session::getIDMaster(), eq::net::Session::getLocalNode(), getMasterInstanceID(), isMaster(), eq::base::RefPtr< T >::isValid(), eq::net::Session::registerObject(), sync(), eq::net::Session::unmapObject(), and eq::base::UUID::ZERO.
Referenced by eq::Layout::deserialize().


| virtual bool eq::net::Object::isDirty | ( | ) | const [inline, virtual] |
Return if this object needs a commit.
This function is used for optimization, to detect early that no commit() is needed. If it returns true, pack() or getInstanceData() will be executed. These functions can still decide to not write any data, upon which no new version will be created. If it returns false, commit() will exit early. Applications using asynchronous commits (commitNB(), commitSync()) should use isDirty() to decide if commitNB() should be called.
Reimplemented in eq::Object.
Definition at line 163 of file net/object.h.
Referenced by commit().

| uint32_t eq::net::Object::commit | ( | ) | [virtual] |
Commit a new version of this object.
If the object has not changed no new version will be generated, that is, the previous version number is returned. This method is a convenience function for commitNB(); commitSync()
Reimplemented in eq::server::Frame.
Definition at line 221 of file net/object.cpp.
References commitNB(), commitSync(), getVersion(), and isDirty().
Referenced by eq::server::Frame::commitData(), and eq::server::Compound::update().


| uint32_t eq::net::Object::commitNB | ( | ) |
Start committing a new version of this object.
The commit transaction has to be completed using commitSync, passing the returned identifier.
Definition at line 274 of file net/object.cpp.
References eq::net::ObjectCM::commitNB().
Referenced by commit().


| uint32_t eq::net::Object::commitSync | ( | const uint32_t | commitID | ) |
Finalizes a commit transaction.
| commitID | the commit identifier returned from commitNB |
Definition at line 279 of file net/object.cpp.
References eq::net::ObjectCM::commitSync().
Referenced by commit().


| void eq::net::Object::obsolete | ( | const uint32_t | version | ) |
Explicitly obsoletes all versions including version.
The head version can not be obsoleted.
| version | the version to obsolete |
Definition at line 284 of file net/object.cpp.
References eq::net::ObjectCM::obsolete().

| void eq::net::Object::setAutoObsolete | ( | const uint32_t | count, | |
| const uint32_t | flags = AUTO_OBSOLETE_COUNT_VERSIONS | |||
| ) |
Automatically obsolete old versions.
Flags are a bitwise combination of the following values:
AUTO_OBSOLETE_COUNT_VERSIONS: count 'full' versions are retained. AUTO_OBSOLETE_COUNT_COMMIT: The versions for the last count commits are retained. Note that the number of versions may be less since commit may not generate a new version. This flags takes precedence over AUTO_OBSOLETE_COUNT_VERSIONS.
| count | the number of versions to retain, excluding the head version. | |
| flags | additional flags for the auto-obsoletion mechanism |
Definition at line 289 of file net/object.cpp.
References eq::net::ObjectCM::setAutoObsolete().
Referenced by eq::server::Frame::cycleData(), eq::Layout::deserialize(), eq::server::Node::getBarrier(), and eq::server::CompoundInitVisitor::visit().


| uint32_t eq::net::Object::getAutoObsoleteCount | ( | ) | const |
Definition at line 294 of file net/object.cpp.
References eq::net::ObjectCM::getAutoObsoleteCount().
Referenced by eq::server::Frame::cycleData().


| uint32_t eq::net::Object::sync | ( | const uint32_t | version = VERSION_HEAD |
) |
Sync to a given version.
Syncing to VERSION_HEAD syncs to the last received version, does not block, ignores the timeout and always returns true.
| version | the version to synchronize, must be bigger than the current version. |
Definition at line 299 of file net/object.cpp.
References eq::net::ObjectCM::sync().
Referenced by becomeMaster(), eqPly::Pipe::frameStart(), eq::Node::getBarrier(), eq::Pipe::getFrame(), eq::Node::getFrameData(), and eq::Pipe::getView().


| uint32_t eq::net::Object::getHeadVersion | ( | ) | const |
Definition at line 304 of file net/object.cpp.
References eq::net::ObjectCM::getHeadVersion().

| uint32_t eq::net::Object::getVersion | ( | ) | const |
Definition at line 309 of file net/object.cpp.
References eq::net::ObjectCM::getVersion().
Referenced by eq::FrameData::addListener(), commit(), eq::server::Frame::commit(), eq::net::Barrier::enter(), eq::Node::getFrameData(), eq::FrameData::isReady(), notifyNewHeadVersion(), eq::FrameData::setReady(), eq::FrameData::transmit(), eq::server::CompoundUpdateInputVisitor::visit(), and eq::FrameData::waitReady().


| uint32_t eq::net::Object::getOldestVersion | ( | ) | const |
Definition at line 314 of file net/object.cpp.
References eq::net::ObjectCM::getOldestVersion().

| virtual void eq::net::Object::notifyNewHeadVersion | ( | const uint32_t | version | ) | [inline, virtual] |
Notification that a new head version was received by a slave object.
The notification is send from the command thread, which is different from the node main thread. The object should not be sync()'ed from this notification, as this might lead to synchronization issues with the application thread changing the object. Its purpose is to send a message to the application, which then takes the appropriate action.
| version | The new head version. |
Definition at line 258 of file net/object.h.
References getVersion().

| void eq::net::Object::setupChangeManager | ( | const Object::ChangeType | type, | |
| const bool | master, | |||
| const uint32_t | masterInstanceID = EQ_ID_INVALID | |||
| ) |
Setup the change manager.
| type | the type of the change manager. | |
| master | true if this object is the master. | |
| masterInstanceID | the instance identifier of the master object, when master == false. |
Definition at line 230 of file net/object.cpp.
References DELTA, INSTANCE, STATIC, and UNBUFFERED.
| virtual void eq::net::Object::getInstanceData | ( | DataOStream & | os | ) | [protected, pure virtual] |
Serialize the instance information about this managed object.
The default implementation uses the data provided by setInstanceData.
| os | The output stream. |
Implemented in eq::ConfigDeserializer, eq::Frame, eq::FrameData, eq::net::Barrier, eqPly::VertexBufferDist, eq::server::ConfigSerializer, eq::server::Frame, and eq::server::FrameData.
Referenced by eq::net::UnbufferedMasterCM::addSlave(), eq::net::StaticMasterCM::addSlave(), and pack().

| virtual void eq::net::Object::applyInstanceData | ( | DataIStream & | is | ) | [protected, pure virtual] |
Deserialize the instance data.
This method is called during object mapping to populate slave instances with the master object's data. The default implementation writes the data into the memory declared by setInstanceData.
| is | the input stream. |
Implemented in eq::ConfigDeserializer, eq::Frame, eq::FrameData, eq::net::Barrier, eqPly::VertexBufferDist, eq::server::ConfigSerializer, eq::server::Frame, and eq::server::FrameData.
Referenced by eq::net::StaticSlaveCM::applyMapData(), eq::net::FullSlaveCM::applyMapData(), and unpack().

| virtual void eq::net::Object::pack | ( | DataOStream & | os | ) | [inline, protected, virtual] |
Serialize the modifications since the last call to commit().
No new version will be created if no data is written to the ostream. The default implementation uses the data provided by setDeltaData or setInstanceData.
| os | the output stream. |
Reimplemented in eq::net::Barrier.
Definition at line 317 of file net/object.h.
References getInstanceData().

| virtual void eq::net::Object::unpack | ( | DataIStream & | is | ) | [inline, protected, virtual] |
Deserialize a change.
The default implementation writes the data into the memory declared by setDeltaData or setInstanceData.
| is | the input data stream. |
Reimplemented in eq::net::Barrier.
Definition at line 327 of file net/object.h.
References applyInstanceData().
Referenced by eq::net::FullSlaveCM::_unpackOneVersion().


| uint32_t eq::net::Object::getMasterInstanceID | ( | ) | const [protected] |
Definition at line 319 of file net/object.cpp.
References eq::net::ObjectCM::getMasterInstanceID().
Referenced by becomeMaster().


| void eq::net::Object::addSlave | ( | NodePtr | node, | |
| const uint32_t | instanceID, | |||
| const uint32_t | version | |||
| ) | [protected] |
Add a slave subscriber.
| node | the slave node. | |
| instanceID | the object instance identifier on the slave node. | |
| version | the initial version. |
Definition at line 324 of file net/object.cpp.
References eq::net::ObjectCM::addSlave().

| void eq::net::Object::removeSlave | ( | NodePtr | node | ) | [protected] |
Remove a subscribed slave.
| node | the slave node. |
Definition at line 330 of file net/object.cpp.
References eq::net::ObjectCM::removeSlave().

| bool eq::net::Object::send | ( | NodePtr | node, | |
| ObjectPacket & | packet | |||
| ) | [protected] |
Send a packet to peer object instance(s) on another node.
Definition at line 153 of file net/object.cpp.
References eq::net::Session::getID().
Referenced by eq::net::UnbufferedMasterCM::addOldMaster(), eq::net::FullMasterCM::addOldMaster(), eq::net::DeltaMasterCM::addOldMaster(), eq::net::FullMasterCM::addSlave(), eq::net::DeltaMasterCM::addSlave(), eq::net::UnbufferedMasterCM::commitNB(), eq::net::FullMasterCM::commitNB(), eq::net::DeltaMasterCM::commitNB(), eq::net::Barrier::enter(), eq::Node::releaseFrame(), eq::Channel::setNearFar(), eq::Window::setPixelViewport(), and eq::FrameData::update().


| bool eq::net::Object::send | ( | NodePtr | node, | |
| ObjectPacket & | packet, | |||
| const std::string & | string | |||
| ) | [protected] |
Send a packet to peer object instance(s) on another node.
Definition at line 161 of file net/object.cpp.
References eq::net::Session::getID().

| bool eq::net::Object::send | ( | NodePtr | node, | |
| ObjectPacket & | packet, | |||
| const void * | data, | |||
| const uint64_t | size | |||
| ) | [protected] |
Send a packet to peer object instance(s) on another node.
Definition at line 170 of file net/object.cpp.
References eq::net::Session::getID().

0.9 by
1.5.8