![]() |
VR-Forces Developer's Guide
|
Class Description: DtSimTaskManager manages the bookkeeping associated with starting, completing, clearing, and skipping tasks.

Classes | |
| struct | BackgroundProcessInformation |
| struct | DelayTaskExecution |
Public Types | |
| typedef DtCallbackList< const DtTaskMessage & > | DtTaskCompleteCallbackList |
| typedef std::set < DtSimTaskMessageType > | SupportingTasks |
| typedef std::map< int, SupportingTasks > | AvailableSupportingTasks |
Public Types inherited from DtReaderWriter | |
| typedef std::vector < DtSymbolString > | aliasContainer |
| typedef std::vector < DtSymbolString >::iterator | aliasIter |
| typedef std::vector < DtSymbolString > ::const_iterator | aliasConstIter |
| typedef std::vector< DtFilename > | SearchPaths |
| typedef std::pair < DtSymbolString, DtString > | DtVariableNameType |
| typedef DtReaderWriterFactory *(* | DtReaderWriterFactoryCreatorFcn )() |
Public Member Functions | |
| DtSimTaskManager (const DtString &name, DtLocalObject *vrfObject, const DtString &naame="sim-task-manager", DtReaderWriterRegistry *parentRegistry=nullptr) | |
| virtual | ~DtSimTaskManager () override |
| virtual bool | init () |
| virtual void | tick () |
| virtual void | addTaskProcessor (const DtSimTaskMessageType &taskType, DtTaskControllerComponent *taskController) |
| virtual void | removeTaskProcessor (const DtSimTaskMessageType &taskType, DtTaskControllerComponent *taskController) |
| virtual void | removeAllReferencesToController (DtTaskControllerComponent *taskController) |
| virtual std::vector < DtSimTaskMessageType > | capableTaskIds () const |
| virtual AvailableSupportingTasks | supportingTasks () const |
| virtual SupportingTasks | supportingTasks (int) const |
| virtual void | addBackgroundProcess (const DtString &scriptId, int backgroundProcessId, const DtString &controllerName) |
| virtual void | removeBackgroundProcess (const DtString &scriptId) |
| virtual void | addScriptedSet (const DtString &scriptId, int backgroundProcessId, const DtString &controllerName) |
| virtual void | removeScriptedSet (const DtString &scriptId) |
| virtual bool | transitionTask (DtTaskMessage &taskMsg, DtSimTaskStatePtr taskState) |
| virtual int | suspendTasks (std::set< DtString > actionCategories) |
| virtual int | suspendAllTopLevelTasks (bool suspendedFromTrigger=false) |
| virtual int | suspendSubtask (int taskId, int subtaskId) |
| virtual DtSuspendedTaskInfo * | suspendTask (int taskId) |
| virtual bool | resumeTasks (int suspendId) |
| virtual bool | taskActive (int taskId) const |
| virtual void | registerInterfaceMessageCallbacks () |
| virtual void | registerRadioMessageCallbacks () |
| virtual void | taskNotify (const DtSimTask &task, const DtSimComponent ¬ifier, bool clearConflictingTopLevelTasks=true) |
| virtual void | skipTask (bool fromSuperior=false) |
| virtual void | taskComplete (const DtVrfObjectMessage &radioMsg, bool success, bool affectsIndependentTaskStatus=true) |
| virtual void | sendTaskCompleted (const DtTaskMessage &taskMsg, bool success) |
| void | awaitingTask (int taskIdJustCompleted=-1) |
| virtual void | setTaskedBySuperior () |
| virtual bool | requestTaskNeeded () const |
| virtual void | setRequestTaskNeeded (bool requestTaskNeeded) |
| virtual bool | independentlyTasked () const |
| virtual void | setIndependentlyTasked (bool independentlyTasked) |
| virtual bool | isPseudoAggregate () const |
| virtual DtString | type () const |
| virtual void | addOnTaskNotifyCallback (DtOnTaskNotifyCallbackFcn fcn, void *userData) |
| virtual void | removeOnTaskNotifyCallback (DtOnTaskNotifyCallbackFcn fcn, void *userData) |
| virtual void | clearSubtask (int subtaskId) |
| virtual DtTaskWithTaskStateListPtr | topLevelTasks () const |
| virtual bool | hasTopLevelTask () const |
| virtual bool | taskTypesAreExclusive (const DtSimTaskMessageType &taskType1, const DtSimTaskMessageType &taskType2) const |
| virtual bool | taskTypesAreExclusive (const std::list< DtString > &task1Categories, const DtSimTaskMessageType &taskType2) const |
| virtual bool | canExecuteTask (const DtSimTaskMessageType &) const |
| virtual void | clearTaskByType (const DtSimTaskMessageType &taskType) |
| virtual void | updateTaskInfo () |
| virtual bool | canBeExecutedConcurrently (const DtSimTaskMessageType &taskType) const |
| virtual DtScriptReactiveTaskController * | reactiveTaskController () |
| virtual void | setReactiveTaskController (DtScriptReactiveTaskController *reactiveTaskController) |
| virtual void | setTaskVisualizationsActive (bool) |
| virtual bool | hasTopLevelTasks () const |
| virtual void | addClutterTask (const DtSimTaskMessageType &taskType) |
| virtual bool | taskVisualizationsEnabled (bool includeUnTimedOut) const |
| virtual bool | taskVisualizationsActivated () const |
| virtual void | taskCancelled (int taskId) |
| virtual bool | startTaskExecution (const DtTaskMessage &taskMsg, DtSimTaskStatePtr taskState, bool taskNotify, bool clearConflictingTopLevelTasks=true, bool doNotAbandonPlan=false) |
| virtual void | addSupportingTask (int, const DtSimTaskMessageType &) |
| virtual void | addSupportingTasks (int, const SupportingTasks &) |
| virtual void | removeSupportingTask (int, const DtSimTaskMessageType &) |
| virtual void | removeSupportingTasks (int) |
| virtual bool | executeTask (DtTaskMessage &taskMsg, bool clearConflictingTopLevelTasks=true, bool doNotAbandonPlan=false) |
| virtual bool | executeTask (DtTaskMessage &taskMsg, DtSimTaskStatePtr taskState, bool clearConflictingTopLevelTasks=true, bool doNotAbandonPlan=false) |
| virtual void | addTaskCompleteCallback (DtTaskCompleteCallbackList::DtCallbackFunctionType fcn, void *usr) |
| virtual void | removeTaskCompleteCallback (DtTaskCompleteCallbackList::DtCallbackFunctionType fcn, void *usr) |
| virtual void | setSendSkipTaskMessages (bool sendSkipTaskMessages) |
| virtual bool | sendSkipTaskMessages () |
Public Member Functions inherited from DtReaderWriter | |
| DtReaderWriter () | |
| DtReaderWriter (const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false) | |
| DtReaderWriter (const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false) | |
| DtReaderWriter (const DtString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL) | |
| DtReaderWriter (const DtSymbolString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL) | |
| DtReaderWriter (const DtReaderWriter &, DtReaderWriterRegistry *parentRegistry=NULL) | |
| const DtReaderWriter & | operator= (const DtReaderWriter &orig) |
| bool | operator== (const DtReaderWriter &) const |
| bool | operator!= (const DtReaderWriter &rhs) const |
| virtual | ~DtReaderWriter () |
| virtual void | putSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename()) |
| virtual void | postPutSelf () |
| virtual void | prePutSelf () |
| virtual void | getSelf (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference()) |
| virtual void | preGetSelf () |
| virtual void | writeSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename()) |
| virtual DtSymbolString | name () const |
| virtual void | addAlias (const DtSymbolString &alias) |
| virtual void | addAlias (const DtString &alias) |
| virtual bool | hasAlias (const DtSymbolString &alias) |
| virtual const aliasContainer & | aliases () const |
| virtual void | setReadonly (bool flag) |
| bool | isReadonly () const |
| virtual void | reset () |
| virtual int | alignment () const |
| virtual bool | variableIsBound () const |
| virtual void | unbindVariable () |
| virtual void | setName (const DtString &) |
| virtual const char * | readerWriterType () const |
| virtual const char * | xmlType () const |
| virtual DtString | prettyPrint () const |
| std::string | debugText () const |
| virtual void | bindVariables (DtVariableBindingsList variableBindings) |
| virtual std::list < DtVariableNameType > | unboundVariables () const |
| bool | invalid () const |
| virtual bool | hasChild (const DtReaderWriter *p) const |
| virtual bool | hasVariableReference () const |
| virtual void | bindLocalVariables (const DtVariableBindingsList &variableBindings) |
| virtual void | recordUpdateTime () const |
| virtual bool | changedSinceLastChecked () |
| virtual bool | peekChangedSinceLastChecked () const |
| virtual void | putData (std::string &fp, int indentLevel=0) |
| virtual DtlObjPtr | getData (DtlObjPtr args, const SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings) |
| virtual void | setValueSpecified (bool specified, bool recurse=false) |
| virtual bool | valueSpecified () const |
| virtual bool | isVariableReference () const |
| virtual void | setIsVariableReference (bool value) |
| virtual void | clearAllVariableReferenceFlags () |
| virtual DtSymbolString | variableName () const |
| virtual void | setVariableName (const DtSymbolString variableName) |
| virtual const DtReaderWriter * | defaultRWValue () const |
| virtual DtReaderWriter * | defaultRWValue () |
| virtual void | setDefaultRWValue (DtReaderWriter *) |
| virtual bool | checkAndSetDefaultRWValue (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference()) |
| const DtReaderWriterRegistry & | registry () const |
| DtReaderWriterRegistry & | registry () |
| virtual DtPropertyInterface * | property () |
| virtual const DtPropertyInterface * | property () const |
| virtual DtString | toXml () const |
| virtual DtRwVariableBindings * | generateVariableBindings () const |
| virtual bool | toXml (const DtFilename &) const |
| virtual bool | fromXml (const DtString &) |
| virtual bool | fromXmlFile (const DtFilename &) |
| virtual void | putSelf (DtEnvironmentSP, DtEnvValueSP parent) const |
| virtual void | putData (DtEnvironmentSP, DtEnvValueSP value) const |
| virtual void | putVariableReference (DtEnvironmentSP, DtEnvValueSP value) const |
| virtual void | getSelf (const DtEnvironmentSP, const DtEnvValueSP root, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList()) |
| virtual void | getData (const DtEnvironmentSP, const DtEnvValueSP, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList()) |
| virtual void | unrecognizedItem (const DtEnvironmentSP env, const DtEnvValueSP root, const SearchPaths &searchPaths, const DtVariableBindingsList &varBindings) |
| virtual void | getVariableReference (DtEnvironmentSP, DtEnvValueSP value) |
Protected Types | |
| typedef std::multimap < DtSimTaskMessageType, DtTaskControllerComponent * > | DtTaskProcessorMap |
| typedef std::map< DtString, BackgroundProcessInformation > | BackgroundProcesses |
| typedef std::vector < DelayTaskExecution > | DelayedTaskExecution |
Static Protected Member Functions | |
| static void | taskMessageCallback (DtSimMessage *msg, void *usr) |
| static void | requestCurrentTasksCallback (const DtVrfObjectMessage *msg, void *usr) |
| static void | unsubscribeCurrentTasksCallback (const DtVrfObjectMessage *msg, void *usr) |
| static void | clearTaskByTrackingNumberCallback (const DtVrfObjectMessage *msg, void *usr) |
Static Protected Attributes | |
| static DtSimTaskManagerFactory * | theFactory |
Static Protected Attributes inherited from DtReaderWriter | |
| static DtString | theUnspecifiedValue |
| static DtGetSelfCallbackInfo | thePostGetSelfCallback |
| static DtPutSelfCallbackInfo | thePrePutSelfCallback |
| static const DtVariableBindingsList | theEmptyVariableBindingsList |
| static bool | theCreatorFcnSet |
| static DtReaderWriterFactory * | theFactory |
| static DtReaderWriterFactoryCreatorFcn | theFactoryCreatorFcn |
| static bool | thePutIndent |
| static DtOutputStream * | theOutputStream |
Private Member Functions | |
| DtSimTaskManager () | |
| DtSimTaskManager (const DtSimTaskManager &orig) | |
| const DtSimTaskManager & | operator= (const DtSimTaskManager &orig) |
| typedef DtCallbackList<const DtTaskMessage&> DtSimTaskManager::DtTaskCompleteCallbackList |
| typedef std::set<DtSimTaskMessageType> DtSimTaskManager::SupportingTasks |
| typedef std::map<int, SupportingTasks> DtSimTaskManager::AvailableSupportingTasks |
|
protected |
|
protected |
|
protected |
|
private |
Not implemented.
|
private |
copy constructor
| DtSimTaskManager::DtSimTaskManager | ( | const DtString & | name, |
| DtLocalObject * | vrfObject, | ||
| const DtString & | naame = "sim-task-manager", |
||
| DtReaderWriterRegistry * | parentRegistry = nullptr |
||
| ) |
constructor
|
overridevirtual |
destructor
|
private |
assignment operator
|
virtual |
Calls base class init(), and registerRadioMessageCallbacks().
|
virtual |
Sends awaitingTask message to plan engine if needed.
|
virtual |
Registers a task controller as a processor for a specific task type. This controller will have its beginProcessingTask() method called whenever a task of this type is executed by this task manager.
|
virtual |
Removes a task controller that has previously registered for as a task processor for a specific task type.
|
virtual |
Removes all task processors that are registered by this controller.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Adds/remove supporting tasks. Types are available in scriptedTaskMetaData.h.
|
virtual |
Adds/remove supporting tasks. Types are available in scriptedTaskMetaData.h.
|
virtual |
Adds/remove supporting tasks. Types are available in scriptedTaskMetaData.h.
|
virtual |
Adds/remove supporting tasks. Types are available in scriptedTaskMetaData.h.
|
virtual |
Starts the execution of this task. This is the main entry point of an entity to start executing any task or subtask. The task will be passed off to any task controller that has registered to process the particular type of this task. Fills in the taskId of the task message with the newly assigned ID of the task.
| taskState | If present, used to convey information about the current execution state of the task (may be at some intermediate point in execution). |
| clearConflictingTopLevelTasks | Normally executing a new task will clear any top level tasks that are conflicting. If, however, you have previously suspended the conflicting tasks, you may not want to clear them out. |
|
virtual |
Starts the execution of this task. This is the main entry point of an entity to start executing any task or subtask. The task will be passed off to any task controller that has registered to process the particular type of this task. Fills in the taskId of the task message with the newly assigned ID of the task.
| taskState | If present, used to convey information about the current execution state of the task (may be at some intermediate point in execution). |
| clearConflictingTopLevelTasks | Normally executing a new task will clear any top level tasks that are conflicting. If, however, you have previously suspended the conflicting tasks, you may not want to clear them out. |
|
virtual |
Used for reporting curent tasks only. Keeps track of all currently executing background processes.
|
virtual |
|
virtual |
Used for reporting current tasks only. Keeps track of scripted sets that are currently running.
|
virtual |
|
virtual |
Transitions the task from controller state to another. Basically reissues the task with the same id to the same controller, using saved state. Currently used by the aggregate model resolution controller when transitioning from aggregated <-> dissaggregated states. When transitioning the task, if there is a plan in progress that is executing this task the plan will not be abandoned. Also, the newly issued task will maintain the same task id as the original task.
Function to suspend. Suspends all top level tasks that conflict with any of the listed actionCategories.
Suspends all top level tasks.
Suspends a specific subtask.
|
virtual |
Suspends a specific task, and returns the suspend info.
Takes a suspend ID generated from a call to suspend, and resumes any tasks that were suspended with this ID.
|
virtual |
Callbacks that are invoked any time a task is complete.
|
virtual |
Callbacks that are invoked any time a task is complete.
|
virtual |
Registers a callback for Skip Task messages.
|
virtual |
Register for TaskedBySuperior and DtClearTask radio messages.
|
virtual |
Called by controller component when task is received. Calls clearTask() on the currently tasked controller that has a top-level (non-subtask) task.
|
virtual |
Called by controller component when task is received. Calls clearTask() on the currently tasked controller that has a top-level (non-subtask) task. If fromSuperior is false, calls sendAwaitingTask().
|
virtual |
Called by controller component when task is complete.
| success | indicates whether the task was successfully completed or failed. There are some tasks (such as reactive tasks) when they complete should not affect the independently tasked flag. The las parameter, if set to true, will do just that |
|
virtual |
send a task complete report message to the originator of a task (as indicated by the sender field of the task message sent)
| void DtSimTaskManager::awaitingTask | ( | int | taskIdJustCompleted = -1 | ) |
Calls awaitingTask on the DtPlan via the DtVrfObjectPlanManager Specify the task ID of the task that just completed, if available.
|
virtual |
Equivalent to localState()->setIndependentlyTasked(false) for local entities, but deriving pseudo aggregates do more...
|
virtual |
Will we ask the plan manager for a task this tick.
|
virtual |
Used within the task manager.
|
virtual |
Are we tasked independently (plan or user) or by a superior (pseudo-aggregate) entity?
|
virtual |
Sets independentlyTasked flag. Normally done when a task is received, or a setTaskedBySuperior message is received.
|
inlinevirtual |
Indicates whether or not the type of task manager created supports pseudo-aggregates.
|
virtual |
Returns the type of task manager object. Strings are defined in taskMgrTypes.h.
|
virtual |
Accessor/mutator for mySendSkipTaskMessages. This should only be called by DtCgf::rewind.
|
virtual |
Accessor/mutator for mySendSkipTaskMessages. This should only be called by DtCgf::rewind.
|
virtual |
Registers callback to invoked after taskNotify() is called (at the point when an entity starts executing a new task).
|
virtual |
Removes callback to invoked after taskNotify() is called (at the point when an entity starts executing a new task).
|
virtual |
Locates DtTaskControllerComponent currently executing a task with the given subtaskId, and calls clearTask() on that component.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
static |
The manager will register a callback with the radio's msg executive requesting notification of Tasked By Superior Set Data Requests.
|
static |
The manager will register a callback with its simManager's msg executive requesting notification of Skip Task Interface Requests.
|
static |
Callback function for handling DtClearTask messages. Calls processClearTask to process the message.
|
static |
Callback function for handling task visualization request messages. Calls processTaskVisualizationRequest.
|
virtual |
Set to false to turn off task visualizations for this object.
|
static |
|
static |
A DtSimEntityFactory is allocated by the DtSimCreator, and this pointer is set. The DtSimCreator deletes this pointer when it is deleted. This is done this way because we don't allow static initialization.
|
static |
|
static |
|
static |
Creates a new task manager, using the factory.
|
virtual |
Returns true if there are top level tasks.
|
virtual |
Adds a task that can be used for clutter entities.
Returns true if task visualizations are enabled for this object.
|
virtual |
Returns true if any of this object's components have task visualizations activated.
|
virtual |
Called when a task is cancelled as part of clearing a task. If this task is part of a plan will move to the next statement in the plan.
|
virtual |
Used by executeTask() and other similar methods to start the execution of a task.
|
overrideprotectedvirtual |
For ownership transfer, archive/dearchive the current state.
Reimplemented from DtReaderWriter.
|
protectedvirtual |
Finds task controller currently tasked with task of type specified in clear task message and calls its clearTask() method. task type, calls clearTask().
|
protectedvirtual |
Creates or destroys task visualization objects.
|
protectedvirtual |
|
protectedvirtual |
Cancels all top level tasks currently executing on the entity.
|
protectedvirtual |
Cancels any top level tasks that are running on the entity if they conflict with the specified task type. taskTypesAreExclusive() is used to determine if they conflict.
|
protectedvirtual |
Hook function called at the end of taskNotify(). Invokes any onTaskNotify() callback functions that are registered with the task manager.
|
protected |
If we are currently tasked and former subordinate is not independently tasked, sends a skip task message to this former subordinate. The subordinate should no longer be participating in any tasks currently being executed by this entity.
|
protectedvirtual |
Called in response to the owner being deleted.
|
staticprotected |
Callback resisted with the local radio for all task messages. Calls processTaskMessage().
|
protectedvirtual |
Calls executeTask().
|
protectedvirtual |
Finds a registered controller to execute the specified task, using the controllers registered in myTaskProcessorMap.
|
protectedvirtual |
|
protectedvirtual |
|
staticprotected |
|
protectedvirtual |
|
staticprotected |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Updates the list of current activated task visualizations. Called once per tick.
|
protectedvirtual |
Stops sending any current task visualizations. Called when task visualizations are disabled or deactivated.
|
staticprotected |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Handles registration/deregistration of callbacks.
Reimplemented in DtSimEngineeringTaskManager.
|
protectedvirtual |
Handles registration/deregistration of callbacks.
|
protectedvirtual |
Handles registration/deregistration of callbacks.
|
protectedvirtual |
Handles registration/deregistration of callbacks.
|
protectedvirtual |
Called during initialization to add task types that can be used for clutter entities.
|
protected |
|
protected |
|
protected |
Stores all the registered task processor interfaces, indexed by task type they process.
|
protected |
Determines whether processSubordinateRemoved will send a skip task message. This should only be changed by DtCgf::rewind.
|
protected |
Counter which holds the number of times the current task status has been subscribed to minus the number of times it has been unsubscribed. (>0 means that someone is subscribed)
|
protected |
Set to true if the task manager should send the list of current tasks next tick.
|
protected |
Whether task visualizations are enabled for this object.
|
protected |
Time at which task visualizations should be removed.
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |