![]() |
VR-Forces 4.0.4 Class Documentation
|
The DtAgentManager manages the distributed scene object framework. More...

Classes | |
| struct | AsynchronousInterfaceEntry |
| struct | MessageParcel |
| Helper struct for sending messages via the asynchronous message queue. More... | |
Public Member Functions | |
| DtAgentManager (DtDe &) | |
| CTOR. | |
| virtual | ~DtAgentManager () |
| DTOR. | |
| virtual void | tick () |
| Tick the scene manager. | |
| virtual void | updateScene (DtMessage &message) |
| Update the scene from an update message. | |
| virtual DtAgentUpdateResolverInterface * | findUpdater (DtUniqueID id) |
| Find the update handler for a particular object id. | |
| DtElementID | findElementId (DtUniqueID id) |
| Attempt to find the element ID for a scene object id. | |
| virtual bool | sceneObjectIsVisible (DtElementID id) const |
| Return true if the given element is visible in the first available model set. | |
| DtDe & | de () |
| Get the scene manager's Ig object. | |
| void | clear () |
| Forcibly clear the scene. | |
| virtual DtAsynchronousAgentManager * | createAsynchronousManager (const std::string &ownerName) |
| Create a new DtAsynchronousAgentManager. | |
| void | checkForIgLock (bool forceLock=false) |
| An internal function the scene manager calls to allow for asynchronous scene managers to use the DtDe& reference. | |
| virtual DtDe & | acquireLockedIg () |
| Get the locked de. | |
| virtual void | releaseLockedIg () |
| Release the locked de, the de reference is now invalid to be used in the thread. | |
Public Attributes | |
| boost::signal< void(DtUniqueID id)> | signal_objectCreated |
| Signal for creation of actual objects (represented by their unique id). | |
Protected Types | |
| typedef std::vector < MessageParcel > | MessageParcelVector |
| typedef std::vector< DtMessage * > | MessageList |
| typedef boost::function< void(DtAgentManagerInterface *) > | AgentManagerInterfaceFunction |
| typedef DtLockedBufferedQueue < AgentManagerInterfaceFunction > | AsynchronousAgentManagerInterfaceFunctionQueue |
| typedef boost::unordered_map < DtUniqueID, AsynchronousInterfaceEntry > | NamespaceMap |
| typedef boost::unordered_map < DtUniqueID, DtAgentUpdateResolverInterface * > | UpdaterMap |
| typedef std::vector< DtAgent * > | DriverVector |
Protected Member Functions | |
| virtual unsigned char | acquireNamespaceId (DtAsynchronousAgentManager *sceneManagerInterface, const std::string &ownerName) |
| Acquire a namespace. | |
| virtual void | releaseNamespaceId (unsigned char nsId) |
| Release a namespace id, this should be called by a SceneManagerInterface DTOR. | |
| virtual void | addAsynchronousUpdateMessages (MessageParcelVector &messages) |
| Add asynchronous update messages. | |
| void | distributeAndUpdate (MessageList &masterMessages, MessageList &distributedMessages) |
| Implementation of updating via message and sending it if necessary. | |
| virtual void | localEncodeAndUpdateScene () |
| Special update scene function used to update only the local scene from the internal objects. | |
| virtual void | createObject (const std::string &className, DtUniqueID id) |
| Create an object. | |
| virtual void | updateObject (DtUniqueID id, DtMessage &msg, unsigned int updatesize) |
| Update an object. | |
| virtual void | destroyObject (DtUniqueID id) |
| Destroy an Object by it's ID. | |
Protected Attributes | |
| DtDe & | myDe |
| UpdaterMap | myUpdaterMap |
| std::pair< DtUniqueID, DtAgentUpdateResolverInterface * > | myLastObjectCache |
| DtSceneProctor * | mySceneProctor |
| DtLockedBufferedQueue < MessageParcel > | myAsynchronousMessageQueue |
| NamespaceMap | myNamespaceMap |
| unsigned char | myNextValidNamespaceIdGuess |
| boost::detail::atomic_count | myAtomicWaitingCount |
| boost::condition | myRequestIgCondition |
| boost::condition | myReleaseIgCondition |
| boost::mutex | myMonitor |
| bool | myForceCheckAysncMessages |
Friends | |
| class | DtAsynchronousAgentManager |
The DtAgentManager manages the distributed scene object framework.
This includes the objects and updates as well as the drivers used to control the objects.
typedef std::vector<MessageParcel> makVrv::DtAgentManager::MessageParcelVector [protected] |
typedef std::vector<DtMessage*> makVrv::DtAgentManager::MessageList [protected] |
typedef boost::function< void (DtAgentManagerInterface*) > makVrv::DtAgentManager::AgentManagerInterfaceFunction [protected] |
typedef DtLockedBufferedQueue<AgentManagerInterfaceFunction> makVrv::DtAgentManager::AsynchronousAgentManagerInterfaceFunctionQueue [protected] |
typedef boost::unordered_map<DtUniqueID,AsynchronousInterfaceEntry> makVrv::DtAgentManager::NamespaceMap [protected] |
typedef boost::unordered_map<DtUniqueID,DtAgentUpdateResolverInterface*> makVrv::DtAgentManager::UpdaterMap [protected] |
typedef std::vector<DtAgent*> makVrv::DtAgentManager::DriverVector [protected] |
CTOR.
| virtual makVrv::DtAgentManager::~DtAgentManager | ( | ) | [virtual] |
DTOR.
| virtual void makVrv::DtAgentManager::tick | ( | ) | [virtual] |
Tick the scene manager.
This will generate a message and deliver that message to the slaves (if the IG is the master) and handle the message.
Implements makVrv::DtAgentManagerInterface.
| virtual void makVrv::DtAgentManager::updateScene | ( | DtMessage & | message | ) | [virtual] |
Update the scene from an update message.
| virtual DtAgentUpdateResolverInterface* makVrv::DtAgentManager::findUpdater | ( | DtUniqueID | id | ) | [virtual] |
Find the update handler for a particular object id.
Referenced by makVrv::Cast< DesiredType >::toFunctionType().
Attempt to find the element ID for a scene object id.
| virtual bool makVrv::DtAgentManager::sceneObjectIsVisible | ( | DtElementID | id | ) | const [virtual] |
Return true if the given element is visible in the first available model set.
Will not check element data, only the state of the scene object
| virtual DtAsynchronousAgentManager* makVrv::DtAgentManager::createAsynchronousManager | ( | const std::string & | ownerName | ) | [virtual] |
Create a new DtAsynchronousAgentManager.
An asynchronous interface is required if a Driver will be executing in a separate thread. The Interface returned should be deallocated by the Sim Driver when it is finished with it.
| void makVrv::DtAgentManager::checkForIgLock | ( | bool | forceLock = false | ) |
An internal function the scene manager calls to allow for asynchronous scene managers to use the DtDe& reference.
| virtual DtDe& makVrv::DtAgentManager::acquireLockedIg | ( | ) | [virtual] |
Get the locked de.
The calling thread will get the de instance. which will be thread safe. This will stall the main thread and possibly other threads as well. Use only when necessary and release when possible. This should only be called by a separate thread.
| virtual void makVrv::DtAgentManager::releaseLockedIg | ( | ) | [virtual] |
Release the locked de, the de reference is now invalid to be used in the thread.
This should only be called by a separate thread. This must be called after acquireLockedIg or the entire process will be in deadlock.
| DtDe& makVrv::DtAgentManager::de | ( | ) | [inline] |
Get the scene manager's Ig object.
| void makVrv::DtAgentManager::clear | ( | ) |
Forcibly clear the scene.
This function normally should not be called. It is called in the case when a slave losses it's connection to the master.
| virtual unsigned char makVrv::DtAgentManager::acquireNamespaceId | ( | DtAsynchronousAgentManager * | sceneManagerInterface, |
| const std::string & | ownerName | ||
| ) | [protected, virtual] |
Acquire a namespace.
Namespace ids are used by additional SceneManagerInterfaces to ensure there are not id collisions. There are a total of 255 namespaces (0 is reserved for the SceneManager). Once a namespace is acquired it must be released due to the possibility of running out. The DtAsynchronousAgentManager automatically releases its id when it is destroyed.
| DtCorruptedState | if all available namspaces are in use. |
| virtual void makVrv::DtAgentManager::releaseNamespaceId | ( | unsigned char | nsId | ) | [protected, virtual] |
Release a namespace id, this should be called by a SceneManagerInterface DTOR.
| virtual void makVrv::DtAgentManager::addAsynchronousUpdateMessages | ( | MessageParcelVector & | messages | ) | [protected, virtual] |
Add asynchronous update messages.
This function is thread-safe and reentrant, which allows it to be called by DtAsynchronousSceneManagerInterfaces in separate threads. This function does not need to be called by any other classes. Ownership of the memory is transfered to the main thread.
| DtInvalidInput | if the message pointer is null. |
| void makVrv::DtAgentManager::distributeAndUpdate | ( | MessageList & | masterMessages, |
| MessageList & | distributedMessages | ||
| ) | [protected] |
Implementation of updating via message and sending it if necessary.
| virtual void makVrv::DtAgentManager::localEncodeAndUpdateScene | ( | ) | [protected, virtual] |
Special update scene function used to update only the local scene from the internal objects.
This is automatically called by tick if there is only a single master IG.
| virtual void makVrv::DtAgentManager::createObject | ( | const std::string & | className, |
| DtUniqueID | id | ||
| ) | [protected, virtual] |
Create an object.
| virtual void makVrv::DtAgentManager::updateObject | ( | DtUniqueID | id, |
| DtMessage & | msg, | ||
| unsigned int | updatesize | ||
| ) | [protected, virtual] |
Update an object.
| virtual void makVrv::DtAgentManager::destroyObject | ( | DtUniqueID | id | ) | [protected, virtual] |
Destroy an Object by it's ID.
friend class DtAsynchronousAgentManager [friend] |
| boost::signal<void (DtUniqueID id)> makVrv::DtAgentManager::signal_objectCreated |
Signal for creation of actual objects (represented by their unique id).
DtDe& makVrv::DtAgentManager::myDe [protected] |
UpdaterMap makVrv::DtAgentManager::myUpdaterMap [protected] |
std::pair<DtUniqueID,DtAgentUpdateResolverInterface*> makVrv::DtAgentManager::myLastObjectCache [protected] |
DtSceneProctor* makVrv::DtAgentManager::mySceneProctor [protected] |
DtLockedBufferedQueue< MessageParcel > makVrv::DtAgentManager::myAsynchronousMessageQueue [protected] |
NamespaceMap makVrv::DtAgentManager::myNamespaceMap [protected] |
unsigned char makVrv::DtAgentManager::myNextValidNamespaceIdGuess [protected] |
boost::detail::atomic_count makVrv::DtAgentManager::myAtomicWaitingCount [protected] |
boost::condition makVrv::DtAgentManager::myRequestIgCondition [protected] |
boost::condition makVrv::DtAgentManager::myReleaseIgCondition [protected] |
boost::mutex makVrv::DtAgentManager::myMonitor [protected] |