![]() |
VR-Forces 5.0.1 Developer's Guide
|
Manage scripted tasks (primarily Lua tasks) known by VR-Forces.
Classes | |
| struct | ScenarioSystemPair |
Public Types | |
| typedef std::map< std::string, ScenarioSystemPair > | ScriptedTaskMetaDataList |
| typedef std::map< std::string, ScriptedTaskMetaDataList > | ScriptedTasksByDirectory |
Public Member Functions | |
| DtScriptedTaskManager (DtSimulationServices *) | |
| virtual | ~DtScriptedTaskManager () |
| virtual void | addAdditionSystemScriptDirectory (const std::string &, bool send=true) |
| virtual void | removeAllSystemScriptedTasksFromDirectory (const std::string &, bool send=true) |
| virtual void | removeAllScenarioScripts (bool send=true) |
| virtual const ScriptedTasksByDirectory & | scriptedTasksByDirectory () const |
| virtual const ScriptedTaskMetaDataList & | scenarioScripts () const |
| virtual const ScriptedTaskMetaDataList & | allScriptsById () const |
| virtual void | sendRequestedScripts (DtU32 responseId=0, const std::vector< std::string > &scriptIds=std::vector< std::string >(), bool sendScripts=false, bool sendUiLayout=false, const std::string &language="", const int scriptType=1) |
| virtual const DtScriptedTaskMetaData * | lookupScriptById (const DtGenericMessageType &scriptId) const |
| virtual const DtScriptedTaskMetaData * | lookupScriptById (const DtSetMessageType &scriptId) const |
| virtual const DtScriptedTaskMetaData * | lookupScriptById (const DtSimTaskMessageType &scriptId) const |
| virtual const DtScriptedTaskMetaData * | lookupScriptById (const std::string &) const |
| virtual void | modifyScenarioScriptedTask (const DtScriptedTaskMetaData &, const std::string &sourceScriptId="", bool send=true, bool keepScriptInMessage=false, bool keepLayoutInMessage=false) |
| virtual bool | removeScriptedTask (const std::string &id, bool send=true, bool scenarioOnly=true, bool removeSystemScriptFromDisk=false) |
| virtual bool | loadScenarioScripts (const DtFilename &, bool send=true) |
| virtual bool | loadScenarioScriptsFromZipFile (const DtFilename &scenarioZipFile, const std::string &, bool send=true) |
| virtual bool | loadScenarioScripts (const std::string &str, bool send=true) |
| virtual bool | writeScenarioScripts (const DtFilename &) |
| virtual bool | writeScenarioScripts (std::string &) |
| virtual bool | removeScriptById (const std::string &s, bool scenarioOnly=true, bool removeSystemScriptFromDisk=false) |
| virtual void | setSimulationModelSetScriptsDirectory (const std::string &s, bool send=true) |
| virtual std::string | simulationModelSetScriptsDirectory () const |
| virtual std::vector < DtSimTaskMessageType > | tasksValidFor (const DtEntityType &, int force) const |
| virtual std::vector < DtSetMessageType > | setsValidFor (const DtEntityType &, int force) const |
| virtual std::vector < DtSimTaskMessageType > | reactiveTasksValidFor (const DtEntityType &, int force) const |
| virtual std::vector< std::string > | scriptsValidFor (const DtEntityType &, int scriptType, int force) const |
| virtual void | reportError (const DtGenericMessageType &scriptId, const std::string &error, bool sendReport=true) |
| virtual void | reportError (const DtSimTaskMessageType &scriptId, const std::string &error, bool sendReport=true) |
| virtual void | reportError (const DtSetMessageType &scriptId, const std::string &error, bool sendReport=true) |
| virtual void | reportError (const std::string &scriptId, const std::string &error, bool sendReport=true) |
| virtual std::string | findSystemDirectoryFor (const std::string &scriptId) const |
| virtual void | clearError (const DtGenericMessageType &scriptId) |
| virtual void | clearError (const DtSimTaskMessageType &scriptId) |
| virtual void | clearError (const DtSetMessageType &scriptId) |
| virtual void | clearError (const std::string &scriptId) |
| virtual int | scriptType (const DtGenericMessageType &scriptId) const |
| virtual int | scriptType (const DtSetMessageType &scriptId) const |
| virtual int | scriptType (const DtSimTaskMessageType &scriptId) const |
| virtual int | scriptType (const std::string &) const |
| virtual DtGenericMessageType | remapScriptId (const DtGenericMessageType &scriptId) const |
| virtual DtSetMessageType | remapScriptId (const DtSetMessageType &scriptId) const |
| virtual DtSimTaskMessageType | remapScriptId (const DtSimTaskMessageType &scriptId) const |
| virtual std::string | remapScriptId (const std::string &scriptId) const |
| virtual void | merge (DtScriptedTaskManager *mgr, std::vector< DtRwTranslatableStringObject > &) |
| virtual DtScriptResourceManager * | resourceManager (const DtString &type) |
| virtual DtScriptResourceManagerMap & | resourceManagers () |
| DtSimulationServices * | simulationServices () const |
| virtual void | addScriptedTaskChangedCallback (DtScriptedTaskManagerCallbackFcn fcn, void *usr) |
| virtual void | removeScriptedTaskChangedCallback (DtScriptedTaskManagerCallbackFcn fcn, void *usr) |
| virtual void | addSample (const DtGenericMessageType &scriptId, double sample) |
| virtual void | addSample (const DtSetMessageType &scriptId, double sample) |
| virtual void | addSample (const DtSimTaskMessageType &scriptId, double sample) |
| virtual void | addSample (const std::string &scriptId, double sample) |
| virtual void | monitor (const std::string &scriptId, bool) |
| virtual void | setMonitorTime (double) |
| virtual void | addFrameRateReference (const DtGenericMessageType &) |
| virtual void | addFrameRateReference (const DtSimTaskMessageType &) |
| virtual void | addFrameRateReference (const DtSetMessageType &) |
| virtual void | addFrameRateReference (const std::string &) |
| virtual void | removeFrameRateReference (const DtGenericMessageType &scriptId) |
| virtual void | removeFrameRateReference (const DtSetMessageType &scriptId) |
| virtual void | removeFrameRateReference (const DtSimTaskMessageType &scriptId) |
| virtual void | removeFrameRateReference (const std::string &) |
| virtual void | setDoctrines (const std::set< std::string > &) |
| virtual void | addDoctrine (const std::string &, bool send=true) |
| virtual bool | removeDoctrine (const std::string &, bool send=true) |
| virtual const std::set < std::string > & | doctrines () const |
| virtual void | clearDoctrines (bool send=true) |
| virtual void | loadDoctrines (const DtFilename &f, bool send=true) |
| virtual void | sendDoctrines () |
| virtual void | sendDoctrineAssignments () |
| virtual void | updateDoctrines (const DtScriptedTaskMetaData &) |
| virtual void | saveDoctrines (const DtFilename &f) const |
| virtual ScriptedTaskMetaDataList | scriptsValidForDoctrine (const std::string &) const |
| virtual std::string | doctrineForForce (int) const |
| virtual void | setDoctrineForForce (const std::string &, int) |
| virtual void | setDoctrineAssignments (const std::map< int, std::string > &) |
| virtual void | setLanguage (const DtString &) |
| const DtString & | language () const |
| virtual bool | renameDoctrine (const std::string &from, const std::string &to, bool send=true) |
Protected Types | |
| typedef DtCallbackList< const DtScriptedTaskManagerCallbackInfo & > | DtScriptedTaskChangedCallbackList |
| typedef std::map< int, std::string > | DoctrinesForForce |
Protected Member Functions | |
| virtual void | initializeDefaultScripts () |
| virtual void | processRequestScriptedTasks (DtSimMessage *) |
| virtual bool | loadScenarioScripts (std::istream &ifs, bool send) |
| virtual void | processScriptedTaskOperation (DtSimMessage *) |
| virtual void | processDoctrinesOperation (DtSimMessage *) |
| virtual void | makeSystemScript (const std::string &) |
| virtual void | modifySystemScript (const std::string &scriptid, const std::string &) |
| virtual void | modifySystemLayout (const std::string &scriptid, const std::string &) |
| virtual void | modifySystemScriptedTask (const DtScriptedTaskMetaData &, const std::string &sourceSciptId="", bool send=true) |
| virtual void | modifyScript (const std::string &id, const std::string &script) |
| virtual void | modifyLayout (const std::string &id, const std::string &script) |
| virtual bool | changeScriptScriptId (const DtIfScriptedTaskOperation &, bool &needsCompleteResend) |
| virtual void | addTaskToTaskFactory (const std::string &id) |
| virtual void | removeTaskFromTaskFactory (const std::string &id) |
| virtual void | addSetToSetFactory (const std::string &id) |
| virtual void | removeSetFromSetFactory (const std::string &id) |
| virtual void | signalNewScriptedTask (const std::string &) |
| virtual void | loadDefaultScript (DtScriptedTaskMetaData &) |
| virtual void | loadDefaultUiLayout (DtScriptedTaskMetaData &) |
| virtual void | tick () |
| virtual void | sendMonitorInformation () |
| virtual void | updateScenarioScripts (std::map< std::string, DtScriptedTaskMetaData > &, bool send) |
Static Protected Member Functions | |
| static void | requestScriptedTasks (DtSimMessage *, void *) |
| static void | scriptedTaskOperation (DtSimMessage *, void *) |
| static void | doctrinesOperation (DtSimMessage *, void *) |
| static void | tickCallback (void *) |
Protected Attributes | |
| DtSimulationServices * | mySimulationServices |
| std::string | mySimulationModelSetScriptsDirectory |
| ScriptedTasksByDirectory | mySystemScriptedTasks |
| ScriptedTaskMetaDataList | myScenarioScripts |
| ScriptedTaskMetaDataList | myAllScriptsById |
| tbb::spin_rw_mutex | myMutableScriptsByDoctrineMutex |
| std::map< std::string, ScriptedTaskMetaDataList > | myMutableScriptsByDoctrine |
| DtScriptedTaskChangedCallbackList | myScriptedTaskChangedCallbackList |
| double | myMonitorTime |
| double | myLastMonitorSentTime |
| int | myMonitoringAll |
| int | myMonitoringScripts |
| bool | mySendMonitorMessage |
| std::set< std::string > | myDoctrines |
| DtFilename | myDoctrinesFile |
| DoctrinesForForce | myDoctrinesForForce |
| std::vector< std::string > | myScriptPaths |
| DtString | myLastLanguageRequested |
| DtScriptResourceManagerMap | myScriptResourceManagers |
| std::map< std::string, std::string > | myScriptIdToScriptIdMap |
| std::map< int, std::string > | myDefaultTemplatesForScriptTypes |
| tbb::mutex | myMutex |
Private Member Functions | |
| DtScriptedTaskManager (const DtScriptedTaskManager &orig) | |
| DtScriptedTaskManager & | operator= (const DtScriptedTaskManager &orig) |
| typedef std::map<std::string, ScenarioSystemPair> DtScriptedTaskManager::ScriptedTaskMetaDataList |
| typedef std::map<std::string, ScriptedTaskMetaDataList> DtScriptedTaskManager::ScriptedTasksByDirectory |
|
protected |
|
protected |
| DtScriptedTaskManager::DtScriptedTaskManager | ( | DtSimulationServices * | ) |
CTOR.
|
virtual |
DTOR.
|
private |
copy constructor
|
private |
assignment operator
|
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 |
Removes all scripted tasks that appear in the supplied directory. If send is true sends out message with new list of scripts.
|
virtual |
Removes all scripts that are loaded from the scenario. If send is true sends out a new list.
|
virtual |
Returns the list of all scripted tasks by directory.
|
virtual |
Returns a list of all the scripts assigned to the currently loaded scenario.
|
virtual |
Returns a list of all the scripts from system and scenario lists.
|
virtual |
Send out a list of the scripts that match the supplied ids, or if no ids are provided, all of the scripts. Include script text if script text flag is true. Note that the scriptType is only used if no script is found with the given id; in that case a default template is returned.
|
virtual |
Looks up a scripted task data by script id.
|
virtual |
|
virtual |
|
virtual |
|
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 |
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 |
Loads the scenario scripts from the specified file. If send is true sends out all scripts onto the network.
|
virtual |
|
virtual |
Loads the scenario scripts from the given string.
|
virtual |
Writes the local scenario scripts to the specified file.
|
virtual |
Writes the local scenario scripts to the specified string.
|
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 |
Sets the current simulation model set directory. This will be used as the directory to save system scripts to.
|
virtual |
Gets the current simulation model set directory.
|
virtual |
Returns a list of all scripted task ids that are valid for the given entity type and force (by doctrine).
|
virtual |
Returns a list of all scripted set ids that are valid for the given entity type and force (by doctrine).
|
virtual |
Returns a list of all reactive task ids that are valid for the given entity type and force (by doctrine).
|
virtual |
Returns a list of all task ids that are valid for the given entity type and script type and force (by doctrine).
|
virtual |
Callback that is invoked whenever a scripted task changes.
|
virtual |
Callback that is invoked whenever a scripted task changes.
|
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 |
|
virtual |
|
virtual |
|
virtual |
Given the script id finds the place where it was originally loaded from or the current main system script directory.
|
virtual |
Clears out any existing error. Will not send a message, but, rather clears out error variable.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
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 |
Sets the time to update the network with frame rates if anything is being monitored. Default is every 2 seconds.
|
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 |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Removes a frame rate reference. If no more references removes averager.
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Code to support frame rate sampling and reporting for scripted tasks Adds a frame rate sample for the given script id.
|
virtual |
Returns the type of script for the given script id. If no script with that id is present returns -1.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Remaps the script id from a possible original to an alias. If the id given is not a script, or, does not have an alias returns the script id.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Return true if scripts have changed.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Set the language to send out on any request that does not have a language specified.
| const DtString& DtScriptedTaskManager::language | ( | ) | const |
Keeps list of doctrines categories that this script is part of.
|
virtual |
Return true if scripts have changed.
|
virtual |
Merges the supplied scripted tasks (scenario level only!) into this manager. Will not copy over scripted task ids that there are already scenario scripted tasks for, but, will supply a warning in the supplied vector if the ids are the same but the variables or scripts are different.
|
virtual |
Returns the central resource manager for scripts of the given type.
|
virtual |
Returns all of the central resource managers for scripts of the given type.
|
inline |
|
protectedvirtual |
Initializes the table mapping script types to initial script templates.
|
staticprotected |
Invoked when a request is made for scripted tasks.
|
protectedvirtual |
|
protectedvirtual |
|
staticprotected |
Called in response to a scripted task operation request.
|
protectedvirtual |
|
staticprotected |
Called in response to a doctrines operation request.
|
protectedvirtual |
|
protectedvirtual |
Moves the specified script from a scenario to system script.
|
protectedvirtual |
Modifies the system script.
|
protectedvirtual |
Modifies the system ui layout.
|
protectedvirtual |
Modifies the system script meta data.
|
protectedvirtual |
Modifies the scenario script.
|
protectedvirtual |
Modifies the scenario ui layout.
|
protectedvirtual |
Changes the scenario script script id from the original to the new id. Returns true if old id is found.
|
protectedvirtual |
Adds a task into the task factory by the given script id.
|
protectedvirtual |
Removes a task from the task factory by the given task id.
|
protectedvirtual |
Adds a set into the set factory by the given script id.
|
protectedvirtual |
Removes a set from the set factory by the given task id.
|
protectedvirtual |
Invokes callbacks for a new scripted task.
|
protectedvirtual |
Loads the default script into the supplied meta data.
|
protectedvirtual |
Loads the default ui layout into the supplied meta data.
|
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.
|
protectedvirtual |
|
protectedvirtual |
Sends frame rate information for all monitored items.
|
protectedvirtual |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Map of script type to the name of a file that holds the default script template for that type.
|
mutableprotected |