VR-Forces 4.1 Class Documentation
List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions
DtScriptedTaskManager Class Reference

Classes

struct  ScenarioSystemPair
 Map is by unique id of script. More...

Public Types

typedef std::map< std::string,
ScenarioSystemPair
ScriptedTaskMetaDataList
typedef std::map< std::string,
ScriptedTaskMetaDataList
ScriptedTasksByDirectory

Public Member Functions

 DtScriptedTaskManager (DtSimManager *)
 CTOR.
virtual ~DtScriptedTaskManager ()
 DTOR.
virtual DtSimManagersimManager () const
virtual void addAdditionSystemScriptDirectory (const std::string &, bool send=true)
 Processes this system script directory and loads any meta data from that directory that is a system script into the manager.
virtual void removeAllSystemScriptedTasksFromDirectory (const std::string &, bool send=true)
 Removes all scripted tasks that appear in the supplied directory.
virtual void removeAllScenarioScripts (bool send=true)
 Removes all scripts that are loaded from the scenario. If send is true sends out a new list.
virtual const
ScriptedTasksByDirectory
scriptedTasksByDirectory () const
 Returns the list of all scripted tasks by directory.
virtual const
ScriptedTaskMetaDataList
scenarioScripts () const
 Returns a list of all the scripts assigned to the currently loaded scenario.
virtual const
ScriptedTaskMetaDataList
allScriptsById () const
 Returns a list of all the scripts from system and scenario lists.
virtual void sendRequestedScripts (DtU32 responseId=0, const std::vector< std::string > &scriptIds=std::vector< std::string >(), bool sendScripts=false)
 Send out a list of all the scripts or the scripts that match the supplied ids, including script text if script text flag is true.
virtual bool lookupScriptById (const std::string &, DtScriptedTaskMetaData &) const
 Looks up a scripted task data by script id.
virtual void modifyScenarioScriptedTask (const DtScriptedTaskMetaData &, const std::string &sourceScriptId="", bool send=true)
 If the scripted task does not exist adds it either as a scenario script, else modified the script.
virtual void removeScriptedTask (const std::string &id, bool send=true, bool scenarioOnly=true, bool removeSystemScriptFromDisk=false)
 Removes the current script and sends out a message that the specified script has been removed.
virtual bool loadScenarioScripts (const std::string &, bool send=true)
 Loads the scenario scripts from the specified file. If send is true sends out all scripts onto the network.
virtual bool writeScenarioScripts (const std::string &)
 Writes the local scenario scripts to the specified file.
virtual bool removeScriptById (const std::string &s, bool scenarioOnly=true, bool removeSystemScriptFromDisk=false)
 Removes script by id and replaces with a like id item from another source if it exists.
virtual void setSimulationModelSetScriptsDirectory (const std::string &s, bool send=true)
 Sets the current simulation model set directory.
virtual std::vector< std::string > scriptsValidFor (const DtEntityType &) const
 Returns a list of all scripts ids that are valid for the given entity type.
virtual void reportError (const std::string &scriptId, const std::string &error, bool sendReport=true)
 Assigns error to script.
virtual void clearError (const std::string &scriptId)
 Clears out any existing error. Will not send a message, but, rather clears out error variable.
virtual void addScriptedTaskChangedCallback (DtScriptedTaskManagerCallbackFcn fcn, void *usr)
 Callback that is invoked whenever a scripted task changes.
virtual void removeScriptedTaskChangedCallback (DtScriptedTaskManagerCallbackFcn fcn, void *usr)
 Callback that is invoked whenever a scripted task changes.
virtual void addSample (const std::string &scriptId, double sample)
 Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
virtual void monitor (const std::string &scriptId, bool)
 Adds 1 to the number of monitors on the particular script id if true, remove 1 if false.
virtual void setMonitorTime (double)
 Sets the time to update the network with frame rates if anything is being monitored.
virtual void addFrameRateReference (const std::string &)
 Adds a reference for this script that something is adding to its frame rate averages.
virtual void removeFrameRateReference (const std::string &)
 Removes a frame rate reference. If no more references removes averager.

Protected Types

typedef DtCallbackList< const
DtScriptedTaskManagerCallbackInfo & > 
DtScriptedTaskChangedCallbackList

Protected Member Functions

virtual void processRequestScriptedTasks (DtSimMessage *)
virtual void processScriptedTaskOperation (DtSimMessage *)
virtual void makeSystemScript (const std::string &)
 Moves the specified script from a scenario to system script.
virtual void modifySystemScript (const std::string &scriptid, const std::string &)
 Modifies the system script.
virtual void modifySystemScriptedTask (const DtScriptedTaskMetaData &, const std::string &sourceSciptId="", bool send=true)
 Modifies the system script meta data.
virtual void modifyScript (const std::string &id, const std::string &script)
 Modifies the scenario script.
virtual bool changeScenarioScriptScriptId (const std::string &from, const std::string &to)
 Changes the scenario script script id from the original to the new id. Returns true if old id is found.
virtual void addTaskToTaskFactory (const std::string &id)
 Adds a task into the task factory by the given script id.
virtual void removeTaskFromTaskFactory (const std::string &id)
 Removes a task from the task factory by the given task id.
virtual void signalNewScriptedTask (const std::string &)
 Invokes callbacks for a new scripted task.
virtual void loadDefaultScript (DtScriptedTaskMetaData &)
 Loads the default script into th supplied meta data.
virtual void tick ()
virtual void sendMonitorInformation ()
 Sends frame rate information for all monitored items.

Static Protected Member Functions

static void requestScriptedTasks (DtSimMessage *, void *)
 Invoked when a request is made for scripted tasks.
static void scriptedTaskOperation (DtSimMessage *, void *)
 Called in response to a scripted task operation request.
static void tickCallback (void *)
 Tick callback.

Protected Attributes

DtSimManagermySimManager
std::string mySimulationModelSetScriptsDirectory
ScriptedTasksByDirectory mySystemScriptedTasks
ScriptedTaskMetaDataList myScenarioScripts
ScriptedTaskMetaDataList myAllScriptsById
DtScriptedTaskChangedCallbackList myScriptedTaskChangedCallbackList
double myMonitorTime
double myLastMonitorSentTime
int myMonitoringAll
int myMonitoringScripts
bool mySendMonitorMessage

Private Member Functions

 DtScriptedTaskManager (const DtScriptedTaskManager &orig)
 copy constructor
DtScriptedTaskManageroperator= (const DtScriptedTaskManager &orig)
 assignment operator

Member Typedef Documentation

Constructor & Destructor Documentation

DtScriptedTaskManager::DtScriptedTaskManager ( DtSimManager )

CTOR.

virtual DtScriptedTaskManager::~DtScriptedTaskManager ( )
virtual

DTOR.

DtScriptedTaskManager::DtScriptedTaskManager ( const DtScriptedTaskManager orig)
private

copy constructor

Member Function Documentation

DtScriptedTaskManager& DtScriptedTaskManager::operator= ( const DtScriptedTaskManager orig)
private

assignment operator

virtual DtSimManager* DtScriptedTaskManager::simManager ( ) const
virtual
virtual void DtScriptedTaskManager::addAdditionSystemScriptDirectory ( const std::string &  ,
bool  send = true 
)
virtual

Processes this system script directory and loads any meta data from that directory that is a system script into the manager.

Will then send out a message with all scripted tasks. If send is true sends out a message with newly loaded scripts

virtual void DtScriptedTaskManager::removeAllSystemScriptedTasksFromDirectory ( const std::string &  ,
bool  send = true 
)
virtual

Removes all scripted tasks that appear in the supplied directory.

If send is true sends out message with new list of scripts

virtual void DtScriptedTaskManager::removeAllScenarioScripts ( bool  send = true)
virtual

Removes all scripts that are loaded from the scenario. If send is true sends out a new list.

virtual const ScriptedTasksByDirectory& DtScriptedTaskManager::scriptedTasksByDirectory ( ) const
virtual

Returns the list of all scripted tasks by directory.

virtual const ScriptedTaskMetaDataList& DtScriptedTaskManager::scenarioScripts ( ) const
virtual

Returns a list of all the scripts assigned to the currently loaded scenario.

virtual const ScriptedTaskMetaDataList& DtScriptedTaskManager::allScriptsById ( ) const
virtual

Returns a list of all the scripts from system and scenario lists.

virtual void DtScriptedTaskManager::sendRequestedScripts ( DtU32  responseId = 0,
const std::vector< std::string > &  scriptIds = std::vector< std::string >(),
bool  sendScripts = false 
)
virtual

Send out a list of all the scripts or the scripts that match the supplied ids, including script text if script text flag is true.

virtual bool DtScriptedTaskManager::lookupScriptById ( const std::string &  ,
DtScriptedTaskMetaData  
) const
virtual

Looks up a scripted task data by script id.

virtual void DtScriptedTaskManager::modifyScenarioScriptedTask ( const DtScriptedTaskMetaData ,
const std::string &  sourceScriptId = "",
bool  send = true 
)
virtual

If the scripted task does not exist adds it either as a scenario script, else modified the script.

If the script moves from being a scenario script to a system script will write out new script files and update internal structures appropriately. If send is true sends out update notification message

If sourceScriptId is non-null, and the meta data for that script exists, copies the script source into the scenario script from the source script

virtual void DtScriptedTaskManager::removeScriptedTask ( const std::string &  id,
bool  send = true,
bool  scenarioOnly = true,
bool  removeSystemScriptFromDisk = false 
)
virtual

Removes the current script and sends out a message that the specified script has been removed.

If send is true sends out notification of removal. If scenarioOnly is true only removes scenario script. If false removes both scenario and system script (if tied to the same id)

virtual bool DtScriptedTaskManager::loadScenarioScripts ( const std::string &  ,
bool  send = true 
)
virtual

Loads the scenario scripts from the specified file. If send is true sends out all scripts onto the network.

virtual bool DtScriptedTaskManager::writeScenarioScripts ( const std::string &  )
virtual

Writes the local scenario scripts to the specified file.

virtual bool DtScriptedTaskManager::removeScriptById ( const std::string &  s,
bool  scenarioOnly = true,
bool  removeSystemScriptFromDisk = false 
)
virtual

Removes script by id and replaces with a like id item from another source if it exists.

If scenarioOnly is true only removes scenario script. If false removes both scenario and system script (if tied to the same id)

virtual void DtScriptedTaskManager::setSimulationModelSetScriptsDirectory ( const std::string &  s,
bool  send = true 
)
virtual

Sets the current simulation model set directory.

This will be used as the directory to save system scripts to

virtual std::vector<std::string> DtScriptedTaskManager::scriptsValidFor ( const DtEntityType &  ) const
virtual

Returns a list of all scripts ids that are valid for the given entity type.

virtual void DtScriptedTaskManager::addScriptedTaskChangedCallback ( DtScriptedTaskManagerCallbackFcn  fcn,
void *  usr 
)
virtual

Callback that is invoked whenever a scripted task changes.

virtual void DtScriptedTaskManager::removeScriptedTaskChangedCallback ( DtScriptedTaskManagerCallbackFcn  fcn,
void *  usr 
)
virtual

Callback that is invoked whenever a scripted task changes.

virtual void DtScriptedTaskManager::reportError ( const std::string &  scriptId,
const std::string &  error,
bool  sendReport = true 
)
virtual

Assigns error to script.

If the current script error is not the one being assigned will send out a message detailing the new error

virtual void DtScriptedTaskManager::clearError ( const std::string &  scriptId)
virtual

Clears out any existing error. Will not send a message, but, rather clears out error variable.

virtual void DtScriptedTaskManager::addSample ( const std::string &  scriptId,
double  sample 
)
virtual

Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.

virtual void DtScriptedTaskManager::monitor ( const std::string &  scriptId,
bool   
)
virtual

Adds 1 to the number of monitors on the particular script id if true, remove 1 if false.

Any item that is monitored will have a frame rate update sent for it

virtual void DtScriptedTaskManager::setMonitorTime ( double  )
virtual

Sets the time to update the network with frame rates if anything is being monitored.

Default is every 2 seconds

virtual void DtScriptedTaskManager::addFrameRateReference ( const std::string &  )
virtual

Adds a reference for this script that something is adding to its frame rate averages.

When no items are referencing this script will not be used in averaging and not sent on an update

virtual void DtScriptedTaskManager::removeFrameRateReference ( const std::string &  )
virtual

Removes a frame rate reference. If no more references removes averager.

static void DtScriptedTaskManager::requestScriptedTasks ( DtSimMessage ,
void *   
)
staticprotected

Invoked when a request is made for scripted tasks.

virtual void DtScriptedTaskManager::processRequestScriptedTasks ( DtSimMessage )
protectedvirtual
static void DtScriptedTaskManager::scriptedTaskOperation ( DtSimMessage ,
void *   
)
staticprotected

Called in response to a scripted task operation request.

virtual void DtScriptedTaskManager::processScriptedTaskOperation ( DtSimMessage )
protectedvirtual
virtual void DtScriptedTaskManager::makeSystemScript ( const std::string &  )
protectedvirtual

Moves the specified script from a scenario to system script.

virtual void DtScriptedTaskManager::modifySystemScript ( const std::string &  scriptid,
const std::string &   
)
protectedvirtual

Modifies the system script.

virtual void DtScriptedTaskManager::modifySystemScriptedTask ( const DtScriptedTaskMetaData ,
const std::string &  sourceSciptId = "",
bool  send = true 
)
protectedvirtual

Modifies the system script meta data.

virtual void DtScriptedTaskManager::modifyScript ( const std::string &  id,
const std::string &  script 
)
protectedvirtual

Modifies the scenario script.

virtual bool DtScriptedTaskManager::changeScenarioScriptScriptId ( const std::string &  from,
const std::string &  to 
)
protectedvirtual

Changes the scenario script script id from the original to the new id. Returns true if old id is found.

virtual void DtScriptedTaskManager::addTaskToTaskFactory ( const std::string &  id)
protectedvirtual

Adds a task into the task factory by the given script id.

virtual void DtScriptedTaskManager::removeTaskFromTaskFactory ( const std::string &  id)
protectedvirtual

Removes a task from the task factory by the given task id.

virtual void DtScriptedTaskManager::signalNewScriptedTask ( const std::string &  )
protectedvirtual

Invokes callbacks for a new scripted task.

virtual void DtScriptedTaskManager::loadDefaultScript ( DtScriptedTaskMetaData )
protectedvirtual

Loads the default script into th supplied meta data.

static void DtScriptedTaskManager::tickCallback ( void *  )
staticprotected

Tick callback.

Check to see if there are any scripts being monitored for frame rate, and, if so, send them out if it is time

virtual void DtScriptedTaskManager::tick ( )
protectedvirtual
virtual void DtScriptedTaskManager::sendMonitorInformation ( )
protectedvirtual

Sends frame rate information for all monitored items.

Member Data Documentation

DtSimManager* DtScriptedTaskManager::mySimManager
protected
std::string DtScriptedTaskManager::mySimulationModelSetScriptsDirectory
protected
ScriptedTasksByDirectory DtScriptedTaskManager::mySystemScriptedTasks
protected
ScriptedTaskMetaDataList DtScriptedTaskManager::myScenarioScripts
protected
ScriptedTaskMetaDataList DtScriptedTaskManager::myAllScriptsById
protected
DtScriptedTaskChangedCallbackList DtScriptedTaskManager::myScriptedTaskChangedCallbackList
protected
double DtScriptedTaskManager::myMonitorTime
protected
double DtScriptedTaskManager::myLastMonitorSentTime
protected
int DtScriptedTaskManager::myMonitoringAll
protected
int DtScriptedTaskManager::myMonitoringScripts
protected
bool DtScriptedTaskManager::mySendMonitorMessage
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)