VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions
DtSimObjectManager Class Reference

This class is the central access point for all current-frame state of all objects in the simulation in a read-only form. This includes all simulation objects for the sim engine, including locally simulated objects, and remote objects received from the network, both VRF simulated and non-VRF simulated. This gives access to the external state of all of these objects and their current-frame state in a manner that is thread-safe during the simulation frame.

Related Examples

Public Types

typedef std::map< unsigned
long long,
DtSimObjectReference
SimObjects
 
typedef std::set< const
makVrf::DtFrameStateInterface * > 
CurrentFrameStates
 
typedef
boost::signals2::signal< void(makVrf::DtStateComponent *)> 
StateComponentAddedSignal
 
typedef
boost::signals2::signal< void(makVrf::DtStateComponent *)> 
StateComponentRemovedSignal
 

Public Member Functions

 DtSimObjectManager (DtSimulationServices *m)
 
virtual ~DtSimObjectManager ()
 
virtual void tick ()
 
virtual void init ()
 
DtSimulationServicessimManager ()
 
virtual void advanceFrame ()
 
virtual DtSimObjectReference lookup (const DtUUID &) const
 
virtual DtSimObjectReference lookup (const DtEntityIdentifier &) const
 
virtual DtSimObjectReference lookup (unsigned long long) const
 
SimObjects simObjects () const
 
virtual void objectsEmbarkedOn (const DtUUID &, std::vector< DtSimObjectReference > &list) const
 
virtual void clear ()
 
virtual bool hasValidSimulatedEntity () const
 
virtual bool has (const DtUUID &) const
 
template<typename T_Component >
const CurrentFrameStatesstateComponents () const
 
template<typename T_Component >
StateComponentAddedSignalsignalWhenStateComponentAdded ()
 
template<typename T_Component >
StateComponentAddedSignalsignalWhenStateComponentRemoved ()
 
virtual DtSimObjectReferenceList entitiesTracking (const DtUUID &) const
 
virtual DtSimObjectReferenceList entitiesJamming (const DtUUID &) const
 
virtual std::vector
< DtSimObjectReference
objectsOfType (const DtEntityType &) const
 
VRF4API_METHOD DtSimObjectReference lookupVrfObjectByUUID (const DtUUID &u) const
 
VRF4API_METHOD DtSimObjectReference lookupVrfObjectByGlobalId (const DtUUID &u) const
 
VRF4API_METHOD DtSimObjectReference lookupVrfObjectByEntityIdentifier (const DtEntityIdentifier &id) const
 
VRF4API_METHOD const
DtDiGuyCharacterDataManager
diGuyCharacterManager () const
 

Static Public Member Functions

static DtSimObjectManagercreator (DtSimulationServices *)
 

Public Attributes

boost::signals2::signal< void()> signal_advancedFrame
 
boost::signals2::signal< void(DtSimObjectReference)> signal_simObjectAdded
 
boost::signals2::signal< void(DtSimObjectReference)> signal_simObjectDeleted
 
boost::signals2::signal< void(const
DtUUID &oldUUID, const DtUUID
&newUUID)> 
signal_uuidChanged
 
boost::signals2::signal< void(const
DtUUID &oldUUID, const DtUUID
&newUUID)> 
signal_uuidUpgradedTo
 
boost::signals2::signal< void(const
DtSimObject *, const DtString
&oldText, const DtString
&newText)> 
signal_simObjectRenamed
 

Protected Types

typedef std::map< DtString,
DtSimObjectReference
AwaitingMap
 

Protected Member Functions

virtual void simObjectDeleted (const DtSimObject *)
 
virtual DtSimObjectReference getOrCreateSimObjectReference (makVrf::DtStateData *, bool createOnlyIfNotPresent=false) const
 
virtual void uuidChanged (unsigned long long, const DtUUID &oldUUID, const DtUUID &newUUID)
 
virtual void objectRenamed (const DtSimObject *, const DtString &oldName, const DtString &newName)
 
virtual void simObjectAdded (makVrf::DtStateData *)
 
virtual void discoveredObjectReference (const DtString &awaiting)
 
bool isDeleted (const DtUUID &) const
 
virtual void slot_uuidUpgradedTo (const DtUUID &oldUUID, const DtUUID &newUUID)
 

Protected Attributes

DtSimulationServicesmySimulationServices
 
tbb::spin_rw_mutex myMutex
 
boost::signals2::scoped_connection myStateDataAddedConnection
 
boost::signals2::scoped_connection myUUIDChangedConnection
 
boost::signals2::scoped_connection myUUIDUpgradedConnection
 
SimObjects mySimObjects
 
AwaitingMap myAwaitingMap
 
SimObjects myAdded
 
std::map< DtUUID,
DtSimObjectReference
myDeleted
 

Private Member Functions

 DtSimObjectManager ()
 
 DtSimObjectManager (const DtSimObjectManager &)
 
DtSimObjectManageroperator= (const DtSimObjectManager &)
 

Member Typedef Documentation

Constructor & Destructor Documentation

DtSimObjectManager::DtSimObjectManager ( )
private
DtSimObjectManager::DtSimObjectManager ( const DtSimObjectManager )
private
DtSimObjectManager::DtSimObjectManager ( DtSimulationServices m)

CTOR – Takes the state data manager so this can be made aware of the comings and goings of state data.

virtual DtSimObjectManager::~DtSimObjectManager ( )
virtual

DTOR.

Member Function Documentation

DtSimObjectManager& DtSimObjectManager::operator= ( const DtSimObjectManager )
private
virtual void DtSimObjectManager::tick ( )
virtual

Ticks this manager and performs any operations it needs to.

virtual void DtSimObjectManager::init ( )
virtual

Any initialization that wants to be done.

static DtSimObjectManager* DtSimObjectManager::creator ( DtSimulationServices )
static

Static creator that creates the state data manager.

DtSimulationServices* DtSimObjectManager::simManager ( )
inline
Returns
Pointer to the DtSimulationServies instance for the sim. This is named simManager() for API compatibility with VRF 4.x code.
virtual void DtSimObjectManager::advanceFrame ( )
virtual

Send out an added signal for all objects added and advanced since the last frame began.

virtual DtSimObjectReference DtSimObjectManager::lookup ( const DtUUID ) const
virtual

Find a DtSimObject by DtUUID.

virtual DtSimObjectReference DtSimObjectManager::lookup ( const DtEntityIdentifier &  ) const
virtual

Find a DtSimObject by DtEntityIdentifier.

virtual DtSimObjectReference DtSimObjectManager::lookup ( unsigned long  long) const
virtual

Returns the simObjectReference (if it exists) by the legionGlobalId.

SimObjects DtSimObjectManager::simObjects ( ) const
Returns
A full list of all DtSimObject instances.
Note
Use this wisely as this creates a copy of the internal map for thread safety reasons, so, if the map is large, might be a bit of time to return the map
virtual void DtSimObjectManager::objectsEmbarkedOn ( const DtUUID ,
std::vector< DtSimObjectReference > &  list 
) const
virtual

Returns a list of all objects embarked on the given object. These are objects that are only directly embarked – not objects that are embarked on objects embarked on.

virtual void DtSimObjectManager::clear ( )
virtual

Clears sim objects and awaiting map.

virtual bool DtSimObjectManager::hasValidSimulatedEntity ( ) const
virtual

Returns true if there is a locally simulated entity or unit in this simulation.

virtual bool DtSimObjectManager::has ( const DtUUID ) const
virtual

Returns true if this manager has the UUID in the mySimObjects list.

template<typename T_Component >
const CurrentFrameStates& DtSimObjectManager::stateComponents ( ) const
template<typename T_Component >
StateComponentAddedSignal& DtSimObjectManager::signalWhenStateComponentAdded ( )
template<typename T_Component >
StateComponentAddedSignal& DtSimObjectManager::signalWhenStateComponentRemoved ( )
virtual DtSimObjectReferenceList DtSimObjectManager::entitiesTracking ( const DtUUID ) const
virtual

Given the global object designator, find all the entities that are tracking the given object by their emitter systems.

virtual DtSimObjectReferenceList DtSimObjectManager::entitiesJamming ( const DtUUID ) const
virtual

Given the global object designator, find all the entities that are tracking the given object by their emitter systems.

virtual std::vector<DtSimObjectReference> DtSimObjectManager::objectsOfType ( const DtEntityType &  ) const
virtual
Returns
All the objects that match the pattern of the given type.
Note
This will lock the list for read, so, use sparingly
virtual void DtSimObjectManager::simObjectDeleted ( const DtSimObject )
protectedvirtual
virtual DtSimObjectReference DtSimObjectManager::getOrCreateSimObjectReference ( makVrf::DtStateData ,
bool  createOnlyIfNotPresent = false 
) const
protectedvirtual

If createOnlyIfNotPresent is true, will create and return, but not add to the mySimObjects list.

virtual void DtSimObjectManager::uuidChanged ( unsigned long  long,
const DtUUID oldUUID,
const DtUUID newUUID 
)
protectedvirtual
virtual void DtSimObjectManager::objectRenamed ( const DtSimObject ,
const DtString oldName,
const DtString newName 
)
protectedvirtual
virtual void DtSimObjectManager::simObjectAdded ( makVrf::DtStateData )
protectedvirtual
virtual void DtSimObjectManager::discoveredObjectReference ( const DtString awaiting)
protectedvirtual
bool DtSimObjectManager::isDeleted ( const DtUUID ) const
protected

If this is in the list but is marked as deleted, returns true.

virtual void DtSimObjectManager::slot_uuidUpgradedTo ( const DtUUID oldUUID,
const DtUUID newUUID 
)
protectedvirtual

Called, when as part of an import process, a UUID is upgraded from an old to a new version. Some items might need to know this to remap items that hap not yet been discovered.

VRF4API_METHOD DtSimObjectReference DtSimObjectManager::lookupVrfObjectByUUID ( const DtUUID u) const
inline

Deprecated API added to allow for older code to compile.

VRF4API_METHOD DtSimObjectReference DtSimObjectManager::lookupVrfObjectByGlobalId ( const DtUUID u) const
inline

Deprecated API added to allow for older code to compile.

VRF4API_METHOD DtSimObjectReference DtSimObjectManager::lookupVrfObjectByEntityIdentifier ( const DtEntityIdentifier &  id) const
inline

Deprecated API added to allow for older code to compile.

VRF4API_METHOD const DtDiGuyCharacterDataManager* DtSimObjectManager::diGuyCharacterManager ( ) const

Deprecated API added to allow for older code to compile.

Member Data Documentation

boost::signals2::signal<void ()> DtSimObjectManager::signal_advancedFrame
mutable

Signal sent when frame is advanced.

boost::signals2::signal<void (DtSimObjectReference)> DtSimObjectManager::signal_simObjectAdded
mutable

Signal sent when a new DtSimObjectReference has been added.

boost::signals2::signal<void (DtSimObjectReference)> DtSimObjectManager::signal_simObjectDeleted
mutable

Signal sent when a new DtSimObjectReference has been deleted.

boost::signals2::signal<void (const DtUUID& oldUUID, const DtUUID& newUUID)> DtSimObjectManager::signal_uuidChanged
mutable

Signal when UUID is changed. Called before the map is updated with the new uuid.

boost::signals2::signal<void (const DtUUID& oldUUID, const DtUUID& newUUID)> DtSimObjectManager::signal_uuidUpgradedTo
mutable

Signal when a UUID is remapped. Called after awaiting list has been changed.

boost::signals2::signal<void (const DtSimObject*, const DtString& oldText, const DtString& newText)> DtSimObjectManager::signal_simObjectRenamed
mutable

Signal sent when an objects name has changed.

DtSimulationServices* DtSimObjectManager::mySimulationServices
protected
tbb::spin_rw_mutex DtSimObjectManager::myMutex
mutableprotected
boost::signals2::scoped_connection DtSimObjectManager::myStateDataAddedConnection
protected
boost::signals2::scoped_connection DtSimObjectManager::myUUIDChangedConnection
protected
boost::signals2::scoped_connection DtSimObjectManager::myUUIDUpgradedConnection
protected
SimObjects DtSimObjectManager::mySimObjects
mutableprotected
AwaitingMap DtSimObjectManager::myAwaitingMap
mutableprotected
SimObjects DtSimObjectManager::myAdded
protected
std::map<DtUUID, DtSimObjectReference> DtSimObjectManager::myDeleted
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)