![]() |
VR-Forces 4.0.4 Class Documentation
|
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 | 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 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. | |
Protected Attributes | |
| int | myPort |
| bool | myTimeToQuit |
| DtCgf * | myCgf |
| DtVrfMessageInterface * | myMessageIf |
| DtFilename | myDir |
| DtCompressedFileTransporter | myTransporter |
| DtIfLoadScenario * | myPendingLoadScenario |
| 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 | mySimMgmtPduProcessLevel |
This class handles messages from the front-end for loading and saving scenarios, and controlling the simulation state (run, pause, rewind, etc.).
| 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 DtCgfDispatcher::~DtCgfDispatcher | ( | ) | [virtual] |
| virtual void DtCgfDispatcher::closeScenario | ( | DtIfCloseScenario * | msg | ) | [virtual] |
Message processing functions.
| virtual void DtCgfDispatcher::loadScenario | ( | DtIfLoadScenario * | msg | ) | [virtual] |
| 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.
| 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.
| 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] |
| virtual DtVrfMessageInterface* DtCgfDispatcher::messageInterface | ( | ) | const [virtual] |
Accessor for the message interface.
| virtual DtCgf* DtCgfDispatcher::cgf | ( | ) | const [virtual] |
Accessor for the cgf.
| 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.
| 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 | ) | [protected, virtual] |
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
| virtual void DtCgfDispatcher::pause | ( | ) | [protected, virtual] |
Puts back-end into pause mode (simulation time does not advance).
| virtual void DtCgfDispatcher::run | ( | ) | [protected, virtual] |
Puts back-end into run mode (simulation time advances).
| virtual void DtCgfDispatcher::rewind | ( | ) | [protected, virtual] |
Rewinds current scenario running in back-end.
| virtual void DtCgfDispatcher::step | ( | const DtSimulationAddress & | sender | ) | [protected, virtual] |
Steps forward one tick.
| sender | Simulation address of the front-end that made the request. |
| virtual void DtCgfDispatcher::runForDuration | ( | double | duration, |
| const DtSimulationAddress & | sender | ||
| ) | [protected, virtual] |
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. |
int DtCgfDispatcher::myPort [protected] |
bool DtCgfDispatcher::myTimeToQuit [protected] |
DtCgf* DtCgfDispatcher::myCgf [protected] |
DtVrfMessageInterface* DtCgfDispatcher::myMessageIf [protected] |
DtFilename DtCgfDispatcher::myDir [protected] |
DtIfLoadScenario* DtCgfDispatcher::myPendingLoadScenario [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] |