VR-Forces 4.0.4 Class Documentation
Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends
makVrv::DtAgentManager Class Reference

The DtAgentManager manages the distributed scene object framework. More...

Inheritance diagram for makVrv::DtAgentManager:
Inheritance graph
[legend]

List of all members.

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.
DtDede ()
 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 DtDeacquireLockedIg ()
 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

DtDemyDe
UpdaterMap myUpdaterMap
std::pair< DtUniqueID,
DtAgentUpdateResolverInterface * > 
myLastObjectCache
DtSceneProctormySceneProctor
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

Detailed Description

The DtAgentManager manages the distributed scene object framework.

This includes the objects and updates as well as the drivers used to control the objects.


Member Typedef Documentation

typedef std::vector<DtMessage*> makVrv::DtAgentManager::MessageList [protected]
typedef std::vector<DtAgent*> makVrv::DtAgentManager::DriverVector [protected]

Constructor & Destructor Documentation

CTOR.

DTOR.


Member Function Documentation

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.

Find the update handler for a particular object id.

Warning:
DO NOT deallocate the returned pointer.

Referenced by makVrv::Cast< DesiredType >::toFunctionType().

Attempt to find the element ID for a scene object id.

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.

Warning:
This function is NOT thread-safe or Reentrant. It should be called in the main thread.
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.

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.

Get the scene manager's Ig object.

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.

Exceptions:
DtCorruptedStateif 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.

Exceptions:
DtInvalidInputif 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.


Friends And Related Function Documentation

friend class DtAsynchronousAgentManager [friend]

Member Data Documentation

Signal for creation of actual objects (represented by their unique id).

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]

The documentation for this class was generated from the following file:

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)