VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | 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. This includes the objects and updates as well as the drivers used to control the objects.

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

Classes

struct  AsynchronousInterfaceEntry
 
struct  MessageParcel
 

Public Member Functions

 DtAgentManager (DtDe &)
 
virtual ~DtAgentManager ()
 
virtual void cleanup ()
 
virtual void tick ()
 
virtual void updateScene (DtMessage &message)
 
virtual
DtAgentUpdateResolverInterface
findUpdater (DtUniqueID id)
 
DtElementID findElementId (DtUniqueID id)
 
virtual bool sceneObjectIsVisible (DtElementID id) const
 
DtDede ()
 
void clear ()
 
virtual
DtAsynchronousAgentManager
createAsynchronousManager (const std::string &ownerName)
 
void checkForIgLock (bool forceLock=false)
 
virtual DtDeacquireLockedIg ()
 
virtual void releaseLockedIg ()
 
- Public Member Functions inherited from makVrv::DtAgentManagerInterface
 DtAgentManagerInterface (const DtAgentFactory *factory, unsigned char myNamespaceId)
 
virtual ~DtAgentManagerInterface ()
 
DtUniqueID createNewUniqueId ()
 
unsigned char namespaceId () const
 
bool uniqueIdFromAgentManagerInterface (const DtUniqueID &id) const
 
unsigned int createNewCallID ()
 
virtual DtAgentcreateNewObject (const std::string &objectClass, bool bDistribute)
 
virtual void recreateObject (DtAgent *proxy)
 
bool encodeUpdate (DtMessage &masterMsg, DtMessage &distributedMsg, double simulationTime)
 

Public Attributes

boost::signalslib::signal
< void(DtUniqueID id)> 
signal_objectCreated
 

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 Types inherited from makVrv::DtAgentManagerInterface
typedef std::list
< IndexedMessage,
tbb::tbb_allocator
< IndexedMessage > > 
OrderedCallList
 
typedef std::list< DtAgent * > AgentList
 

Protected Member Functions

virtual unsigned char acquireNamespaceId (DtAsynchronousAgentManager *sceneManagerInterface, const std::string &ownerName)
 
virtual void releaseNamespaceId (unsigned char nsId)
 
virtual void addAsynchronousUpdateMessages (MessageParcelVector &messages)
 
void distributeAndUpdate (MessageList &masterMessages, MessageList &distributedMessages)
 
virtual void localEncodeAndUpdateScene ()
 
virtual void createObject (const std::string &className, DtUniqueID id)
 
virtual void updateObject (DtUniqueID id, DtMessage &msg, unsigned int updatesize)
 
virtual void destroyObject (DtUniqueID id)
 
- Protected Member Functions inherited from makVrv::DtAgentManagerInterface
void deleteObject (DtAgent *)
 
void queueObjectForUpdate (DtAgent *object)
 

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
 
- Protected Attributes inherited from makVrv::DtAgentManagerInterface
DtUniqueID myNamespaceId
 
DtUniqueID myFreeID
 
unsigned int myUpdateCallIndex
 
AgentList myUpdatedObjects
 
AgentList myToBeDeletedObjects
 
const DtAgentFactorymyDriverFactory
 
OrderedCallList myMasterList
 

Friends

class DtAsynchronousAgentManager
 

Additional Inherited Members

- Static Public Member Functions inherited from makVrv::DtAgentManagerInterface
static unsigned char namespaceFromUniqueId (DtUniqueID id)
 
- Static Public Attributes inherited from makVrv::DtAgentManagerInterface
static const double IgnoreSimulationTime
 

Member Typedef Documentation

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

Constructor & Destructor Documentation

makVrv::DtAgentManager::DtAgentManager ( DtDe )

CTOR.

virtual makVrv::DtAgentManager::~DtAgentManager ( )
virtual

DTOR.

Member Function Documentation

virtual void makVrv::DtAgentManager::cleanup ( )
virtual

Cleans up the agent manager. Should be called prior to deletion. This is not called from the destructor, so call this to clean up any outstanding messages before deleting the manager.

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.

Warning
DO NOT deallocate the returned pointer.

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

DtElementID makVrv::DtAgentManager::findElementId ( DtUniqueID  id)

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.

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.

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 
)
protectedvirtual

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)
protectedvirtual

Release a namespace id, this should be called by a SceneManagerInterface DTOR.

virtual void makVrv::DtAgentManager::addAsynchronousUpdateMessages ( MessageParcelVector messages)
protectedvirtual

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 ( )
protectedvirtual

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 
)
protectedvirtual

Create an object.

virtual void makVrv::DtAgentManager::updateObject ( DtUniqueID  id,
DtMessage msg,
unsigned int  updatesize 
)
protectedvirtual

Update an object.

virtual void makVrv::DtAgentManager::destroyObject ( DtUniqueID  id)
protectedvirtual

Destroy an Object by it's ID.

Friends And Related Function Documentation

friend class DtAsynchronousAgentManager
friend

Member Data Documentation

boost::signalslib::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
bool makVrv::DtAgentManager::myForceCheckAysncMessages
protected

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

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)