This class handles messages from the front-end for loading and saving scenarios, and controlling the simulation state (run, pause, rewind, etc.).
More...
Public Member Functions |
| | DtCgfDispatcher (DtCgf *cgf, DtVrfMessageInterface *messageIf, int receivePort=8000) |
| | Constructor.
|
| virtual | ~DtCgfDispatcher () |
| virtual void | closeScenario (DtIfCloseScenario *msg) |
| | Message processing functions.
|
| virtual void | loadScenario (DtIfLoadScenario *msg) |
| virtual void | saveScenario (DtIfSaveScenario *msg, const DtSimulationAddress &requester) |
| | Handles the given save request, and if successful sends a DtIfSaveComplete message to the given requester address.
|
| virtual void | importScenarioDescriptionFile (DtIfImportScenarioDescriptionFile *) |
| | Makes sure import description file is present then tells cgf to import if.
|
| virtual void | exportScenarioDescriptionFile (DtIfExportScenarioDescriptionFile *) |
| | Exports current scenario to scenario description file.
|
| virtual void | controlScenario (DtIfControl *msgData, const DtSimulationAddress &sender) |
| | Handles simulation control messages (run, pause, rewind, run for duration) sent from a front-end.
|
| virtual void | setEnableResourceMonitor (bool b) |
| virtual void | tick () |
| | Perform periodic processing.
|
| virtual void | setTimeToQuit (bool yesNo) |
| | Set/Get whether it's time to quit.
|
| virtual bool | timeToQuit () const |
| virtual DtVrfMessageInterface * | messageInterface () const |
| | Accessor for the message interface.
|
| virtual DtCgf * | cgf () const |
| | Accessor for the cgf.
|
| virtual int | port () const |
| | Get the port for sending files.
|
| virtual const DtFilename & | tempDirectory () |
| | Set/Get the temperary directory.
|
| virtual void | setTempDirectory (const DtFilename &f) |
| virtual void | cleanupSockets () |
| | Asks the file transporter to go through it's socket list and see which sockets are still ok.
|
| virtual unsigned int | simMgmtPduProcessLevel () const |
| | Set/Get the type of receiver ids to process when processing a sim mgmt PDU 1={*,*,*}&{*,*,0} <- wildcarded recipients 2={a,b,0} <- specific ids only 3= both 1 and 2.
|
| virtual void | setSimMgmtPduProcessLevel (unsigned int level) |
| virtual void | processCapableTaskAndSetQuery (DtSimMessage *msg) |
| virtual void | processDIGuyAppearAndAniamtionsQuery (DtSimMessage *msg) |
Static Public Member Functions |
| static void | processMessageCb (DtSimMessage *msg, void *usr) |
| | Interface message callback.
|
| static void | startResumeSimCb (DtStartResumeInteraction *msg, void *usr) |
| | sim mgmt PDU callback for processing a start/run PDU
|
| static void | stopFreezeSimCb (DtStopFreezeInteraction *msg, void *usr) |
| | sim mgmt PDU callback for processing a stop/freeze PDU
|
| static void | receiveFileCb (const DtFilename &f, void *usr) |
| | New file arrival callback.
|
| static void | runDurationCompleteCallback (DtTimer *timer) |
| | Callback invoked after the duration time has been reached after simulation has been put in run duration mode.
|
Protected Member Functions |
| virtual bool | shouldTryReload (const DtScenario &scenario) |
| | Return true/false depending on whether or not scenario that failed to load should be tried to be reloaded on next tick.
|
| virtual bool | shouldTryReload (const DtIfImportScenarioDescriptionFile *) |
| | Return true/false depending on whether or not scenario description import that failed to load should be tried to be reloaded on next tick.
|
| virtual void | pause () |
| | Puts back-end into pause mode (simulation time does not advance).
|
| virtual void | run () |
| | Puts back-end into run mode (simulation time advances).
|
| virtual void | rewind () |
| | Rewinds current scenario running in back-end.
|
| virtual void | step (const DtSimulationAddress &sender) |
| | Steps forward one tick.
|
| virtual void | runForDuration (double duration, const DtSimulationAddress &sender) |
| | Puts the back-end into run mode for a specified duration in simulation time.
|
Detailed Description
This class handles messages from the front-end for loading and saving scenarios, and controlling the simulation state (run, pause, rewind, etc.).
Constructor & Destructor Documentation
Constructor.
- Parameters
-
| cgf | DtCgf for which this instance will be acting as a dispatcher |
| messageIf | message interface used for communications |
| receivePort | port used by the file transporter to receive order of battle and plan files from a DtVrfRemoteController. If the port requested cannot be opened, the next open port will be used. |
| virtual DtCgfDispatcher::~DtCgfDispatcher |
( |
| ) |
|
|
virtual |
Member Function Documentation
Message processing functions.
| virtual void DtCgfDispatcher::saveScenario |
( |
DtIfSaveScenario * |
msg, |
|
|
const DtSimulationAddress & |
requester |
|
) |
| |
|
virtual |
Handles the given save request, and if successful sends a DtIfSaveComplete message to the given requester address.
Makes sure import description file is present then tells cgf to import if.
Exports current scenario to scenario description file.
| virtual void DtCgfDispatcher::controlScenario |
( |
DtIfControl * |
msgData, |
|
|
const DtSimulationAddress & |
sender |
|
) |
| |
|
virtual |
Handles simulation control messages (run, pause, rewind, run for duration) sent from a front-end.
- Parameters
-
| msgData | Interface message content for controlling back-end simulation state. |
| sender | Simulation address of the front-end that sent the message. |
| virtual void DtCgfDispatcher::setEnableResourceMonitor |
( |
bool |
b | ) |
|
|
virtual |
| virtual void DtCgfDispatcher::tick |
( |
| ) |
|
|
virtual |
Perform periodic processing.
| virtual void DtCgfDispatcher::setTimeToQuit |
( |
bool |
yesNo | ) |
|
|
virtual |
Set/Get whether it's time to quit.
| virtual bool DtCgfDispatcher::timeToQuit |
( |
| ) |
const |
|
virtual |
Accessor for the message interface.
| virtual DtCgf* DtCgfDispatcher::cgf |
( |
| ) |
const |
|
virtual |
| virtual int DtCgfDispatcher::port |
( |
| ) |
const |
|
virtual |
Get the port for sending files.
| virtual const DtFilename& DtCgfDispatcher::tempDirectory |
( |
| ) |
|
|
virtual |
Set/Get the temperary directory.
| virtual void DtCgfDispatcher::setTempDirectory |
( |
const DtFilename & |
f | ) |
|
|
virtual |
| virtual void DtCgfDispatcher::cleanupSockets |
( |
| ) |
|
|
virtual |
Asks the file transporter to go through it's socket list and see which sockets are still ok.
Any that are not will be removed from the socket list
| virtual unsigned int DtCgfDispatcher::simMgmtPduProcessLevel |
( |
| ) |
const |
|
virtual |
Set/Get the type of receiver ids to process when processing a sim mgmt PDU 1={*,*,*}&{*,*,0} <- wildcarded recipients 2={a,b,0} <- specific ids only 3= both 1 and 2.
| virtual void DtCgfDispatcher::setSimMgmtPduProcessLevel |
( |
unsigned int |
level | ) |
|
|
virtual |
| virtual void DtCgfDispatcher::processCapableTaskAndSetQuery |
( |
DtSimMessage * |
msg | ) |
|
|
virtual |
| virtual void DtCgfDispatcher::processDIGuyAppearAndAniamtionsQuery |
( |
DtSimMessage * |
msg | ) |
|
|
virtual |
| static void DtCgfDispatcher::processMessageCb |
( |
DtSimMessage * |
msg, |
|
|
void * |
usr |
|
) |
| |
|
static |
Interface message callback.
Forwards the msg's interface content to the appropriate message processing function.
| static void DtCgfDispatcher::startResumeSimCb |
( |
DtStartResumeInteraction * |
msg, |
|
|
void * |
usr |
|
) |
| |
|
static |
sim mgmt PDU callback for processing a start/run PDU
| static void DtCgfDispatcher::stopFreezeSimCb |
( |
DtStopFreezeInteraction * |
msg, |
|
|
void * |
usr |
|
) |
| |
|
static |
sim mgmt PDU callback for processing a stop/freeze PDU
| static void DtCgfDispatcher::receiveFileCb |
( |
const DtFilename & |
f, |
|
|
void * |
usr |
|
) |
| |
|
static |
New file arrival callback.
| static void DtCgfDispatcher::runDurationCompleteCallback |
( |
DtTimer * |
timer | ) |
|
|
static |
Callback invoked after the duration time has been reached after simulation has been put in run duration mode.
- Parameters
-
| timer | Object maintained by the scheduler, containing a pointer to the callback, the simulation time the callback should be invoked, and and user-specified data to pass into the callback. |
| virtual bool DtCgfDispatcher::shouldTryReload |
( |
const DtScenario & |
scenario | ) |
|
|
protectedvirtual |
Return true/false depending on whether or not scenario that failed to load should be tried to be reloaded on next tick.
By default returns true
Return true/false depending on whether or not scenario description import that failed to load should be tried to be reloaded on next tick.
By default returns true
| virtual void DtCgfDispatcher::pause |
( |
| ) |
|
|
protectedvirtual |
Puts back-end into pause mode (simulation time does not advance).
| virtual void DtCgfDispatcher::run |
( |
| ) |
|
|
protectedvirtual |
Puts back-end into run mode (simulation time advances).
| virtual void DtCgfDispatcher::rewind |
( |
| ) |
|
|
protectedvirtual |
Rewinds current scenario running in back-end.
| virtual void DtCgfDispatcher::step |
( |
const DtSimulationAddress & |
sender | ) |
|
|
protectedvirtual |
Steps forward one tick.
- Parameters
-
| sender | Simulation address of the front-end that made the request. |
| virtual void DtCgfDispatcher::runForDuration |
( |
double |
duration, |
|
|
const DtSimulationAddress & |
sender |
|
) |
| |
|
protectedvirtual |
Puts the back-end into run mode for a specified duration in simulation time.
Puts back-end into run mode (simulation time advances), and registers runDurationCompleteCallback with the scheduler, to be invoked at the future time specified in the control message (current simulation time + duration). In the callback, back-end will be put into pause mode.
- Parameters
-
| duration | Simulation time in seconds that the back-end should run before pausing. |
| sender | Simulation address of the front-end that made the request. |
Member Data Documentation
| int DtCgfDispatcher::myPort |
|
protected |
| bool DtCgfDispatcher::myTimeToQuit |
|
protected |
| DtCgf* DtCgfDispatcher::myCgf |
|
protected |
| DtFilename DtCgfDispatcher::myDir |
|
protected |
This pointer is used to keep a scenario load message in queue for those times that a load scenario messages comes in before all the appropriate files are present.
| unsigned int DtCgfDispatcher::mySimMgmtPduProcessLevel |
|
protected |
The documentation for this class was generated from the following file:
- /exports/nfedora7-1/nightly/docs/vrforcesDevelopment.tot/include/vrfcgf/cgfDispatcher.h