![]() |
VR-Forces Developer's Guide
|
This class handles messages from the front-end for loading and saving scenarios, and controlling the simulation state (run, pause, rewind, etc.).
Classes | |
| struct | dtSimRunDurationUsrData |
Public Types | |
| typedef struct DtCgfDispatcher::dtSimRunDurationUsrData | DtSimRunDurationUsrData |
Static Public Member Functions | |
| static void | processMessageCb (DtSimMessage *msg, void *usr) |
| static void | setTimeMultiplierCallback (DtSimMessage *msg, void *usr) |
| static void | frameModeCallback (DtSimMessage *msg, void *usr) |
| static void | receiveFileCb (const DtFilename &f, void *usr) |
| static void | runDurationCompleteCallback (void *timer) |
Protected Member Functions | |
| virtual bool | shouldTryReload (const DtScenario &scenario) |
| virtual bool | shouldTryReload (const DtIfImportScenarioDescriptionFile *) |
| virtual void | pause () |
| virtual void | run () |
| virtual void | rewind (int scenarioRunId=0) |
| virtual void | step (const DtSimulationAddress &sender) |
| virtual void | runForDuration (double duration, const DtSimulationAddress &sender) |
Protected Attributes | |
| int | myPort |
| bool | myTimeToQuit |
| DtCgf * | myCgf |
| DtVrfMessageInterface * | myMessageIf |
| DtFilename | myDir |
| DtCompressedFileTransporter | myTransporter |
| DtIfLoadScenario * | myPendingLoadScenario |
| DtIfImportScenarioDescriptionFile * | myPendingScenarioDescriptionImport |
| DtCgfDispatcher::DtCgfDispatcher | ( | DtCgf * | cgf, |
| DtVrfMessageInterface * | messageIf, | ||
| int | receivePort = 8000 |
||
| ) |
Constructor.
| 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 |
|
virtual |
Message processing functions.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Handles the given save request, and if successful sends a DtIfSaveComplete message to the given requester address.
|
virtual |
Handles the given simulation object group save request, and if successful sends a DtIfSavedSimulationObjectGroup message to the given requester address.
|
virtual |
Handles the given simulation object group create request. Will make sure all files are present (as like load or import) before continuing.
|
virtual |
Makes sure import description file is present then tells cgf to import if.
|
virtual |
Exports current scenario to scenario description file.
|
virtual |
Handles simulation control messages (run, pause, rewind, run for duration) sent from a front-end.
| msgData | Interface message content for controlling back-end simulation state. |
| sender | Simulation address of the front-end that sent the message. |
|
virtual |
|
virtual |
Perform periodic processing.
|
virtual |
Set/Get whether it's time to quit.
|
virtual |
|
virtual |
Clears out all simulation objects in scenario.
|
virtual |
Accessor for the message interface.
|
virtual |
Accessor for the cgf.
|
virtual |
Get the port for sending files.
|
virtual |
Set/Get the temperary directory.
|
virtual |
|
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 |
|
virtual |
|
static |
Interface message callback. Forwards the msg's interface content to the appropriate message processing function.
|
static |
Callback registered on the simManager's Message executive. Calls processSetTimeMultipler().
|
static |
Callback registered on the simManager's Message executive.
|
static |
New file arrival callback.
|
static |
Callback invoked after the duration time has been reached after simulation has been put in run duration mode.
| 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 |
|
virtual |
Sets time multiplier with value given in message.
|
virtual |
Sets time multiplier with value given in message.
|
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.
|
protectedvirtual |
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.
|
protectedvirtual |
Puts back-end into pause mode (simulation time does not advance).
|
protectedvirtual |
Puts back-end into run mode (simulation time advances).
|
protectedvirtual |
Rewinds current scenario running in back-end.
|
protectedvirtual |
Steps forward one tick.
| sender | Simulation address of the front-end that made the request. |
|
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.
| duration | Simulation time in seconds that the back-end should run before pausing. |
| sender | Simulation address of the front-end that made the request. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
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.
|
protected |