![]() |
VR-Forces 4.0.4 Class Documentation
|
This class provides a base class for all controllers that are capable of executing a DtSimTask, and execute multiple DtSimTask instances at a time. More...

Public Member Functions | |
| DtMultiTaskControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *compDesc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString& name, | |
| virtual | ~DtMultiTaskControllerComponent () |
| destructor | |
| virtual void | postTick () |
| Override to check if we're tasked and we want to give up (only performs the check if we're in play mode (dT() > 0)). | |
| virtual bool | beginProcessingTask (const DtTaskMessage &task, DtSimTaskStatePtr taskState) |
| Called by the task manager when this controller should start executing the specified task. | |
| virtual void | taskComplete (int taskId, bool success) |
| This indicates that the specified task is complete. | |
| virtual void | clearTask (int taskId) |
| Clears the specified task out, includes any related subtasks. | |
| virtual DtTaskMessage * | currentTaskMessage (int taskId) |
| virtual DtSimTaskStatePtr | currentTaskState (int taskId) const |
| virtual int | sendSubtask (DtSimTask &task, int taskId) |
| Sends subtask to ourself. | |
| virtual void | clearSubtask (int subtaskId, int taskId) |
| Clears subtask with the given subtaskId (subtaskId is returned sendSubtask()). | |
| virtual void | addPendingSubtaskId (int subtaskId, int taskId) |
| Adds given subtask Id to list of pending subtasks. | |
| virtual bool | findPendingSubtaskId (int subtaskId, int taskId) |
| Checks to see if given subtaskId exists in our list of pending subtasks. | |
| virtual void | removePendingSubtaskId (int subtaskId, int taskId) |
| Removes pending subtask from list of subtasks for this component. | |
| virtual void | removeAllPendingSubtaskIds (int taskId) |
| Clear all pending subtasks from our list of subtasks for taskId. | |
| virtual std::vector< int > | currentPendingSubstaskIds (int taskId) const |
| Returns the list of all currently pending subtask ids for this controller. | |
| virtual bool | decideToGiveUpTask () const |
| The DtMultiTaskControllerComponent does not current support decideToGiveUp. | |
| virtual void | giveUpTask () |
| Called when controller is tasked and decideToGiveUp() returns true. | |
| virtual bool | taskActive (int taskId) const |
| | |
| virtual bool | clearTopLevelTasks () |
| If this controller has any top level tasks (not subtasks), they are cleared. | |
| virtual void | clearConflictingTopLevelTasks (int conflictId) |
| Clears any top level tasks on this controller that conflict with the conflictId. | |
| virtual void | clearTasksByType (int taskType) |
| Clears any tasks of the specified type running in this controller. | |
| virtual void | clearTaskById (int taskId) |
| Clears any task of the specified ID running in this controller. | |
| virtual std::list < DtTaskMessage * > | currentTaskMessages () const |
| | |
| virtual DtTaskWithTaskStateListPtr | topLevelTasks () const |
| | |
Protected Member Functions | |
| virtual void | addCurrentTaskMessage (const DtTaskMessage *taskMessage) |
| Adds a new task message to the list of current tasks for this controller. | |
| virtual void | clearCurrentTaskMessage (int taskId) |
| Removes task with the specified task ID from the list of current tasks for this controller. | |
| virtual void | clearPendingSubtasks (int taskId) |
| Iterates over collection of all pending subtasks for this controller, and calls clearSubtask() for each subtask type. | |
| virtual void | clearSubtasksByType (int taskType, int taskId) |
| Clear all subtasks of a given type. | |
| virtual int | taskIdWhichStartedSubtask (int subtaskId) |
This class provides a base class for all controllers that are capable of executing a DtSimTask, and execute multiple DtSimTask instances at a time.
This is a special case for some controllers. Typeically, task controllers will be derived from DtSingleTaskControllerComponent.
| DtMultiTaskControllerComponent::DtMultiTaskControllerComponent | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | compDesc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString& name,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual DtMultiTaskControllerComponent::~DtMultiTaskControllerComponent | ( | ) | [virtual] |
destructor
| virtual void DtMultiTaskControllerComponent::postTick | ( | ) | [virtual] |
Override to check if we're tasked and we want to give up (only performs the check if we're in play mode (dT() > 0)).
Calls decideToGiveUpTask() to determine if we should give up. If true, calls giveUpTask().
Reimplemented from DtTaskControllerComponent.
| virtual bool DtMultiTaskControllerComponent::beginProcessingTask | ( | const DtTaskMessage & | task, |
| DtSimTaskStatePtr | taskState | ||
| ) | [virtual] |
Called by the task manager when this controller should start executing the specified task.
| taskState | Used to convey at what point the task should begin execution. If taskState exists, execution of task may begin at some point other than the logical start of the task. If taskState is 0, begin processing at the logical start of the task. |
Reimplemented from DtTaskControllerComponent.
| virtual void DtMultiTaskControllerComponent::taskComplete | ( | int | taskId, |
| bool | success | ||
| ) | [virtual] |
This indicates that the specified task is complete.
This will kick off a series of events in the task manager to clean up this task and notify anyone relevant of the state change. To indicate that the task has failed (and is being abandoned) call this method with success set to false.
| virtual void DtMultiTaskControllerComponent::clearTask | ( | int | taskId | ) | [virtual] |
Clears the specified task out, includes any related subtasks.
| virtual DtTaskMessage* DtMultiTaskControllerComponent::currentTaskMessage | ( | int | taskId | ) | [virtual] |
| virtual DtSimTaskStatePtr DtMultiTaskControllerComponent::currentTaskState | ( | int | taskId | ) | const [virtual] |
| virtual int DtMultiTaskControllerComponent::sendSubtask | ( | DtSimTask & | task, |
| int | taskId | ||
| ) | [virtual] |
Sends subtask to ourself.
Creates task message and sends task to ourself through radio. Adds subtask Id to list of pending subtasks. Returns subtask Id.
| virtual void DtMultiTaskControllerComponent::clearSubtask | ( | int | subtaskId, |
| int | taskId | ||
| ) | [virtual] |
Clears subtask with the given subtaskId (subtaskId is returned sendSubtask()).
Also removed the subtask ID from the pending subtask ID list.
| taskId | Is the task ID of the task which owns this subtask. |
| virtual void DtMultiTaskControllerComponent::addPendingSubtaskId | ( | int | subtaskId, |
| int | taskId | ||
| ) | [virtual] |
Adds given subtask Id to list of pending subtasks.
This is done automatically by sendSubtask (user should not typically have to call this directly).
| virtual bool DtMultiTaskControllerComponent::findPendingSubtaskId | ( | int | subtaskId, |
| int | taskId | ||
| ) | [virtual] |
Checks to see if given subtaskId exists in our list of pending subtasks.
Typically checked from within a task complete callback, to determine if given report corresponds to the specific subtask we issued.
| virtual void DtMultiTaskControllerComponent::removePendingSubtaskId | ( | int | subtaskId, |
| int | taskId | ||
| ) | [virtual] |
Removes pending subtask from list of subtasks for this component.
Users will typically call this from within a task complete callback, upon receipt of the specific subtasking task complete report they were waiting for.
| virtual void DtMultiTaskControllerComponent::removeAllPendingSubtaskIds | ( | int | taskId | ) | [virtual] |
Clear all pending subtasks from our list of subtasks for taskId.
Users should not typically have to call this.
| virtual std::vector<int> DtMultiTaskControllerComponent::currentPendingSubstaskIds | ( | int | taskId | ) | const [virtual] |
Returns the list of all currently pending subtask ids for this controller.
| virtual bool DtMultiTaskControllerComponent::decideToGiveUpTask | ( | ) | const [virtual] |
The DtMultiTaskControllerComponent does not current support decideToGiveUp.
This function always returns false.
| virtual void DtMultiTaskControllerComponent::giveUpTask | ( | ) | [virtual] |
Called when controller is tasked and decideToGiveUp() returns true.
Base class implementation calls clearTask(). Derived classes may override this function to perform some specific handling.
| virtual bool DtMultiTaskControllerComponent::taskActive | ( | int | taskId | ) | const [virtual] |
Implements DtTaskControllerComponent.
| virtual bool DtMultiTaskControllerComponent::clearTopLevelTasks | ( | ) | [virtual] |
If this controller has any top level tasks (not subtasks), they are cleared.
Implements DtTaskControllerComponent.
| virtual void DtMultiTaskControllerComponent::clearConflictingTopLevelTasks | ( | int | conflictId | ) | [virtual] |
Clears any top level tasks on this controller that conflict with the conflictId.
The task manager is used to determine what tasks conflict.
Implements DtTaskControllerComponent.
| virtual void DtMultiTaskControllerComponent::clearTasksByType | ( | int | taskType | ) | [virtual] |
Clears any tasks of the specified type running in this controller.
Implements DtTaskControllerComponent.
| virtual void DtMultiTaskControllerComponent::clearTaskById | ( | int | taskId | ) | [virtual] |
Clears any task of the specified ID running in this controller.
Implements DtTaskControllerComponent.
| virtual std::list<DtTaskMessage*> DtMultiTaskControllerComponent::currentTaskMessages | ( | ) | const [virtual] |
Implements DtTaskControllerComponent.
| virtual DtTaskWithTaskStateListPtr DtMultiTaskControllerComponent::topLevelTasks | ( | ) | const [virtual] |
Implements DtTaskControllerComponent.
| virtual void DtMultiTaskControllerComponent::addCurrentTaskMessage | ( | const DtTaskMessage * | taskMessage | ) | [protected, virtual] |
Adds a new task message to the list of current tasks for this controller.
| virtual void DtMultiTaskControllerComponent::clearCurrentTaskMessage | ( | int | taskId | ) | [protected, virtual] |
Removes task with the specified task ID from the list of current tasks for this controller.
| virtual void DtMultiTaskControllerComponent::clearPendingSubtasks | ( | int | taskId | ) | [protected, virtual] |
Iterates over collection of all pending subtasks for this controller, and calls clearSubtask() for each subtask type.
| virtual void DtMultiTaskControllerComponent::clearSubtasksByType | ( | int | taskType, |
| int | taskId | ||
| ) | [protected, virtual] |
Clear all subtasks of a given type.
Should not normally be called (call clearSubtask(int subtaskId) to clear a given subtask instead). Provided as a utility function as an aid to backwards compatibility.
| virtual int DtMultiTaskControllerComponent::taskIdWhichStartedSubtask | ( | int | subtaskId | ) | [protected, virtual] |