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 | saveSimulationObjectGroup (DtIfSaveSimulationObjectGroup *msg, const DtSimulationAddress &requester) |
| | Handles the given simulation object group save request, and if successful sends a DtIfSavedSimulationObjectGroup message to the given requester address.
|
| virtual void | createSimulationObjectGroup (DtIfCreateSimulationObjectGroup *msg, const DtSimulationAddress &requester) |
| | Handles the given simulation object group create request.
|
| 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 void | clearSimulationObjects () |
| | Clears out all simulation objects in scenario.
|
| 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 | processDIGuyAppearAndAnimationsQuery (DtSimMessage *msg) |
| virtual void | processRunDurationComplete (DtSimRunDurationUsrData *) |
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 (void *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 (int scenarioRunId=0) |
| | 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.
|
This class handles messages from the front-end for loading and saving scenarios, and controlling the simulation state (run, pause, rewind, etc.).
| 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. |