VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
DtSimManager Class Reference

The simulation engine is controlled by a single,top-level class called the Simulation Manager. More...

List of all members.

Public Member Functions

 DtSimManager (DtExerciseConn *connection)
 constructor
virtual ~DtSimManager ()
 destructor
virtual bool init ()
 creates all the other pieces.
virtual bool createExerciseClock ()
 Exercise clock for back-end.
virtual bool createScheduler ()
virtual bool createMessageInterface ()
virtual bool createFrameRateMonitor ()
virtual bool createVrfSimSettingsManager ()
 Creates the DtVrfSimSettingsManager.
virtual void tick ()
 Ticks the scheduler and then all registered tick callbacks.
virtual void sleep () const
 Calls DtSleep(0.01) when the simulation is paused or when the mean frame rate is above the frame rate specified by targetFrameRate().
virtual bool deliverMessage (const DtSimInterfaceMessage &msg)
virtual bool receiveMessage (const DtSimInterfaceMessage &msg)
virtual bool createAndDeliverMessage (const DtSimulationAddress &recipient, const DtSimInterfaceContent &content, bool overrideTimestampOrder=true)
virtual DtExerciseConn * exerciseConn ()
 exerciseConn() provides access to the virtual network.
virtual DtExerciseClockexerciseClock ()
 exerciseClock() provides access to the current dT, current exercise time and current elapsed time.
virtual DtFrameRateMonitorframeRateMonitor ()
 provides access to the frameRateMonitor, which is responsible for providing frame rate statistics as requested.
virtual DtSchedulerscheduler ()
 scheduler() is used to schedule, control, and delete internal events.
virtual void setVrfObjectManager (DtVrfObjectManager *entityManager)
 vrfObjectManager() provides access to all the objects in the system; both local and remote.
virtual DtVrfObjectManagervrfObjectManager ()
virtual const DtVrfObjectManagervrfObjectManager () const
virtual void setAggregateSpatialModel (DtAggregateSpatialModel *aggregateSpatialModel)
 aggregateSpatialModel() provides an up to date view of all aggregates' location (location, velocity, orientation, and bounding geometry).
virtual DtAggregateSpatialModelaggregateSpatialModel ()
virtual const
DtAggregateSpatialModel
aggregateSpatialModel () const
virtual void setDetonationManager (DtDetonationManager *detonationManager)
 Manages the detonation callbacks generated by the simulation.
virtual DtDetonationManagerdetonationManager ()
virtual void setFireManager (DtFireManager *fireManager)
 Manages the fire callbacks (fire/detonation interactions) generated by the simulation.
virtual DtFireManagerfireManager ()
virtual void setJoyDeviceManager (DtJoyDeviceManager *joyDeviceManager)
 joyDeviceManager() is used to access the joystick manager.
virtual const DtJoyDeviceManagerjoyDeviceManager () const
virtual DtJoyDeviceManagerjoyDeviceManager ()
virtual void setStealthRemoteController (DtStealthRemoteController *controller)
 Allow access to the global stealth remote controller.
virtual DtStealthRemoteControllerstealthRemoteController ()
virtual DtVrfSimSettingsManagervrfSimSettingsManager ()
 Returns the DtVrfSimSettingsManager.
virtual void addMessageCallback (int type, DtMessageCallbackFcn fcn, void *usrData)
 Add/Remove a function to be called when a particular message type is received.
virtual void removeMessageCallback (int type, DtMessageCallbackFcn fcn, void *usrData)
virtual DtVrfMessageInterfacemessageInterface () const
 messageInterface() provides access to the interface used to send messages between the simulation back-end and a (logically or physically) remote front-end command interface.
virtual
DtInterfaceMessageExecutive
messageExecutive ()
virtual void registerInterfaceCallbacks ()
 Register callbacks on the sim manager's interface message executive.
virtual const DtSimulationAddress & messageAddress () const
 This is the address that should be used as the sender for all messages originating from the backend.
virtual unsigned long sequenceNumber ()
 Gets the sequence number of the current scenario.
virtual void setSequenceNumber (unsigned long sequenceNumber)
 Sets the sequence number -- should only be called from classes which actually create and send out the number in a load scenario message.
DtResourceMonitorresourceMonitor ()
 Get/set resource monitor.
void setResourceMonitor (DtResourceMonitor *)
virtual int vrfSessionId () const
 Returns the session id from the message interface.
virtual int vrfMessageVersionSupported () const
 Returns the vrf message version from the message interface.
virtual void setTargetFrameRate (int rate)
 The frame rate above which the back-end will call sleep() in order to yield CPU time to other processes.
virtual int targetFrameRate () const
 The frame rate above which the back-end will call sleep() in order to yield CPU time to other processes.
virtual void addTickEntry (DtSimTickFunction tickFunction, void *userData)
 Callback that will be called every simulation tick of the system.
virtual void removeTickEntry (DtSimTickFunction tickFunction, void *userData)
 Callback that will be called every simulation tick of the system.
virtual void setPhysicalWorld (DtPhysicalWorld *newPhysicalWorld)
virtual DtPhysicalWorldphysicalWorld ()
virtual const DtPhysicalWorldphysicalWorld () const
virtual void setCommModelManager (DtCommModelManager *newCommModelManager)
virtual DtCommModelManagercommModelManager ()
virtual const DtCommModelManagercommModelManager () const
virtual void setGlobalPlanManager (DtGlobalPlanManager *planManager)
 The global plan manager tracks and executes all "global plans" which are plans that are not associated with a particular entity, but rather with the simulation as a whole.
virtual const DtGlobalPlanManagerglobalPlanManager () const
 The global plan manager tracks and executes all "global plans" which are plans that are not associated with a particular entity, but rather with the simulation as a whole.
virtual DtGlobalPlanManagerglobalPlanManager ()
 The global plan manager tracks and executes all "global plans" which are plans that are not associated with a particular entity, but rather with the simulation as a whole.
virtual void setHostilityManager (DtHostilityManager *hostilityManager)
 The hostility manager keeps track of which forces are hostile to each other.
virtual const DtHostilityManagerhostilityManager () const
 The hostility manager keeps track of which forces are hostile to each other.
virtual DtHostilityManagerhostilityManager ()
 The hostility manager keeps track of which forces are hostile to each other.
virtual void setScenarioExtrasMgr (DtScenarioExtrasMgr *scenarioExtrasMgr)
 The hostility manager keeps track of which forces are hostile to each other.
virtual const DtScenarioExtrasMgrscenarioExtrasMgr () const
 The hostility manager keeps track of which forces are hostile to each other.
virtual DtScenarioExtrasMgrscenarioExtrasMgr ()
 The hostility manager keeps track of which forces are hostile to each other.

Static Public Member Functions

static void TickFunction (void *userData)
 This function is registered on the execution list for the sim thread (called pvPacketThread, currently).
static void randSeedCallback (DtSimMessage *msg, void *usr)
 Callbacks registered on the simManagers Message executive.

Protected Attributes

DtSchedulermyScheduler
 Objects we create.
DtExerciseClockmyExerciseClock
 The simulation back-end's clock.
DtNoArgumentCallbackList myTickList
DtFrameRateMonitormyFrameRateMonitor
DtVrfSimSettingsManagermyVrfSimSettingsManager
DtVrfMessageInterfacemyMessageInterface
 out message interface
DtExerciseConn * myExerciseConn
 Objects we hold pointers onto for others.
DtPhysicalWorldmyPhysicalWorld
DtCommModelManagermyCommModelManager
DtVrfObjectManagermyVrfObjectManager
DtAggregateSpatialModelmyAggregateSpatialModel
DtDetonationManagermyDetonationManager
DtFireManagermyFireManager
DtGlobalPlanManagermyGlobalPlanManager
DtJoyDeviceManagermyJoyDeviceManager
DtHostilityManagermyHostilityManager
DtScenarioExtrasMgrmyScenarioExtrasMgr
DtResourceMonitormyResourceMonitor
DtStealthRemoteControllermyStealthRemoteController
int myTargetFrameRate

Private Member Functions

 DtSimManager (const DtSimManager &orig)
 Copy constructor - not implemented.
DtSimManageroperator= (const DtSimManager &orig)
 Assignment operator - not implemented.

Detailed Description

The simulation engine is controlled by a single,top-level class called the Simulation Manager.

All the objects in the simulation backend are owned by the Simulation Manager. The Simulation Manager will be called via a tick() member function once each simulation frame, at which time it will process incoming messages and provide execution control to all the other objects it manages.


Constructor & Destructor Documentation

DtSimManager::DtSimManager ( DtExerciseConn *  connection)

constructor

virtual DtSimManager::~DtSimManager ( ) [virtual]

destructor

DtSimManager::DtSimManager ( const DtSimManager orig) [private]

Copy constructor - not implemented.

Note:
This class is not copyable.

Member Function Documentation

DtSimManager& DtSimManager::operator= ( const DtSimManager orig) [private]

Assignment operator - not implemented.

Note:
This class is not assignable.
virtual bool DtSimManager::init ( ) [virtual]

creates all the other pieces.

Note that the object id generator is created and set in the DtVrfObjectIdGenerator class as the default generator to use. If yo have not set a new creator in the factory, reset in the DtVrfObjectIdGenerator class after init() is called

virtual bool DtSimManager::createExerciseClock ( ) [virtual]

Exercise clock for back-end.

Maintains concept of simulation time, frame rate and the various frame rate modes (variable, fixed-frame best effort, fixed-frame run to complete). If application is HLA13 or HLA1516 (i.e. if DtHLA is defined), creates a clock of type DtHlaExerciseClock. Otherwise, creates a a clock of type DtExerciseClock. DtHlaExerciseClock is extended to include the concept of HLA time management mode. Clock may optionally be configured to enable time regulating and constrained modes. Configurable through the vrfSim.mtl parameter file.

virtual bool DtSimManager::createScheduler ( ) [virtual]
virtual void DtSimManager::tick ( ) [virtual]

Ticks the scheduler and then all registered tick callbacks.

Calls sleep().

virtual void DtSimManager::setTargetFrameRate ( int  rate) [virtual]

The frame rate above which the back-end will call sleep() in order to yield CPU time to other processes.

Once the frame rate drops below this level, the back-end will no longer sleep. This parameter only takes effect when the simulation is running in variable frame mode.

virtual int DtSimManager::targetFrameRate ( ) const [virtual]

The frame rate above which the back-end will call sleep() in order to yield CPU time to other processes.

Once the frame rate drops below this level, the back-end will no longer sleep. This parameter only takes effect when the simulation is running in variable frame mode.

virtual void DtSimManager::sleep ( ) const [virtual]

Calls DtSleep(0.01) when the simulation is paused or when the mean frame rate is above the frame rate specified by targetFrameRate().

virtual bool DtSimManager::deliverMessage ( const DtSimInterfaceMessage msg) [virtual]
virtual bool DtSimManager::receiveMessage ( const DtSimInterfaceMessage msg) [virtual]
virtual bool DtSimManager::createAndDeliverMessage ( const DtSimulationAddress &  recipient,
const DtSimInterfaceContent content,
bool  overrideTimestampOrder = true 
) [virtual]
virtual void DtSimManager::addTickEntry ( DtSimTickFunction  tickFunction,
void *  userData 
) [virtual]

Callback that will be called every simulation tick of the system.

Note:
DtSimTickFunction was previously (VRF 3.10) a method that took an argument of DtSimTickArguments*, but now takes a void*. This has been changed to make it more consistent with other callbacks in VR-Forces. A special subclass of DtSimTickArguments is no longer required. Simply pass any pointer in when registering the callback, and this same pointer will be passed back to the callback method when it is invoked.
virtual void DtSimManager::removeTickEntry ( DtSimTickFunction  tickFunction,
void *  userData 
) [virtual]

Callback that will be called every simulation tick of the system.

Note:
DtSimTickFunction was previously (VRF 3.10) a method that took an argument of DtSimTickArguments*, but now takes a void*. This has been changed to make it more consistent with other callbacks in VR-Forces. A special subclass of DtSimTickArguments is no longer required. Simply pass any pointer in when registering the callback, and this same pointer will be passed back to the callback method when it is invoked.
virtual DtExerciseConn* DtSimManager::exerciseConn ( ) [virtual]

exerciseConn() provides access to the virtual network.

Use it to send or register callbacks for interactions (but see the interaction manager below).

exerciseClock() provides access to the current dT, current exercise time and current elapsed time.

provides access to the frameRateMonitor, which is responsible for providing frame rate statistics as requested.

Note:
The frame rate monitor registers for and responds to frame rate request messages.
virtual DtScheduler* DtSimManager::scheduler ( ) [virtual]

scheduler() is used to schedule, control, and delete internal events.

virtual void DtSimManager::setPhysicalWorld ( DtPhysicalWorld newPhysicalWorld) [virtual]
Returns:
A pointer to the physical world.
Note:
This function should never return false.
Returns:
A pointer to the physical world.
Note:
This function should never return false.
virtual const DtPhysicalWorld* DtSimManager::physicalWorld ( ) const [virtual]
Returns:
A pointer to the physical world.
Note:
This function should never return false.
virtual void DtSimManager::setCommModelManager ( DtCommModelManager newCommModelManager) [virtual]
Returns:
A pointer to the DtCommModelManager.
Returns:
A pointer to the DtCommModelManager.
virtual const DtCommModelManager* DtSimManager::commModelManager ( ) const [virtual]
Returns:
A pointer to the DtCommModelManager.
virtual void DtSimManager::setVrfObjectManager ( DtVrfObjectManager entityManager) [virtual]

vrfObjectManager() provides access to all the objects in the system; both local and remote.

Objects include entities, control objects.

virtual const DtVrfObjectManager* DtSimManager::vrfObjectManager ( ) const [virtual]
virtual void DtSimManager::setAggregateSpatialModel ( DtAggregateSpatialModel aggregateSpatialModel) [virtual]

aggregateSpatialModel() provides an up to date view of all aggregates' location (location, velocity, orientation, and bounding geometry).

virtual void DtSimManager::setDetonationManager ( DtDetonationManager detonationManager) [virtual]

Manages the detonation callbacks generated by the simulation.

Notifies the appropriate registered DtVrfObjects (entities) of detonations they should process.

virtual void DtSimManager::setFireManager ( DtFireManager fireManager) [virtual]

Manages the fire callbacks (fire/detonation interactions) generated by the simulation.

Notifies the appropriate registered DtVrfObjects (entities) of fire interactions and detonation interactions they should process for under-fire determination.

virtual DtFireManager* DtSimManager::fireManager ( ) [virtual]
virtual void DtSimManager::setGlobalPlanManager ( DtGlobalPlanManager planManager) [virtual]

The global plan manager tracks and executes all "global plans" which are plans that are not associated with a particular entity, but rather with the simulation as a whole.

virtual const DtGlobalPlanManager* DtSimManager::globalPlanManager ( ) const [virtual]

The global plan manager tracks and executes all "global plans" which are plans that are not associated with a particular entity, but rather with the simulation as a whole.

The global plan manager tracks and executes all "global plans" which are plans that are not associated with a particular entity, but rather with the simulation as a whole.

virtual void DtSimManager::setJoyDeviceManager ( DtJoyDeviceManager joyDeviceManager) [virtual]

joyDeviceManager() is used to access the joystick manager.

virtual const DtJoyDeviceManager* DtSimManager::joyDeviceManager ( ) const [virtual]
virtual void DtSimManager::setHostilityManager ( DtHostilityManager hostilityManager) [virtual]

The hostility manager keeps track of which forces are hostile to each other.

virtual const DtHostilityManager* DtSimManager::hostilityManager ( ) const [virtual]

The hostility manager keeps track of which forces are hostile to each other.

The hostility manager keeps track of which forces are hostile to each other.

virtual void DtSimManager::setScenarioExtrasMgr ( DtScenarioExtrasMgr scenarioExtrasMgr) [virtual]

The hostility manager keeps track of which forces are hostile to each other.

virtual const DtScenarioExtrasMgr* DtSimManager::scenarioExtrasMgr ( ) const [virtual]

The hostility manager keeps track of which forces are hostile to each other.

The hostility manager keeps track of which forces are hostile to each other.

virtual void DtSimManager::setStealthRemoteController ( DtStealthRemoteController controller) [virtual]

Allow access to the global stealth remote controller.

virtual void DtSimManager::addMessageCallback ( int  type,
DtMessageCallbackFcn  fcn,
void *  usrData 
) [virtual]

Add/Remove a function to be called when a particular message type is received.

virtual void DtSimManager::removeMessageCallback ( int  type,
DtMessageCallbackFcn  fcn,
void *  usrData 
) [virtual]

messageInterface() provides access to the interface used to send messages between the simulation back-end and a (logically or physically) remote front-end command interface.

static void DtSimManager::TickFunction ( void *  userData) [static]

This function is registered on the execution list for the sim thread (called pvPacketThread, currently).

It actually calls the simManager->tick().

virtual void DtSimManager::registerInterfaceCallbacks ( ) [virtual]

Register callbacks on the sim manager's interface message executive.

If you override this make sure you call the base function, or the entity manager will stop responding to those messages.

virtual const DtSimulationAddress& DtSimManager::messageAddress ( ) const [virtual]

This is the address that should be used as the sender for all messages originating from the backend.

static void DtSimManager::randSeedCallback ( DtSimMessage msg,
void *  usr 
) [static]

Callbacks registered on the simManagers Message executive.

virtual unsigned long DtSimManager::sequenceNumber ( ) [virtual]

Gets the sequence number of the current scenario.

virtual void DtSimManager::setSequenceNumber ( unsigned long  sequenceNumber) [virtual]

Sets the sequence number -- should only be called from classes which actually create and send out the number in a load scenario message.

Get/set resource monitor.

References myResourceMonitor.

References myResourceMonitor.

virtual int DtSimManager::vrfSessionId ( ) const [virtual]

Returns the session id from the message interface.

virtual int DtSimManager::vrfMessageVersionSupported ( ) const [virtual]

Returns the vrf message version from the message interface.


Member Data Documentation

Objects we create.

The simulation back-end's clock.

Note that this clock is different from the clock associated with the exercise connection. The simulation time maintained by the exercise clock may be offset relative to the exercise connection's clock.

out message interface

DtExerciseConn* DtSimManager::myExerciseConn [protected]

Objects we hold pointers onto for others.


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)