VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Private Member Functions
DtTaskControllerComponent Class Reference

End User Description: DtTaskControllerComponent is the base class for all controllers that respond to tasks. More...

Inheritance diagram for DtTaskControllerComponent:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtTaskControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *compDesc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString& name,
virtual ~DtTaskControllerComponent ()
 destructor
virtual DtString type () const =0
 Returns a string identifies the class type of component.
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 taskNotify (const DtSimTask &task)
 This is called to let us know when some other component receives a task In the case of this component, we don't care what the task actually is.
virtual bool showCurrentTaskInGui () const
virtual void setRadio (DtSimBaseRadio *radio)
 Calls registerTaskMsgCallbacks.
virtual void registerTaskMsgCallbacks ()
virtual void addTaskProcessorCallback (int taskType, DtTaskMessageCallbackFcn fcn, void *usr)
 Adds a new function for processing the specified task type.
virtual void addTaskProcessorCallback (int taskType, DtMessageCallbackFcn fcn, void *usr)
 Deprecated form of addTaskProcessorCallback.
virtual void removeTaskProcessorCallback (int taskType, DtMessageCallbackFcn fcn, void *usr)
 Undoes anything done by addTaskProcessorCallback().
virtual void removeTaskProcessorCallback (int taskType, DtTaskMessageCallbackFcn fcn, void *usr)
 Deprecated form of removeTaskProcessorCallback.
virtual bool taskActive (int taskId) const =0
virtual bool clearTopLevelTasks ()=0
 If this controller has any top level tasks (not subtasks), they are cleared.
virtual void clearConflictingTopLevelTasks (int conflictId)=0
 Clears any top level tasks on this controller that conflict with the conflictId.
virtual void clearTasksByType (int taskType)=0
 Clears any tasks of the specified type running in this controller.
virtual void clearTaskById (int taskId)=0
 Clears any task of the specified ID running in this controller.
virtual std::list
< DtTaskMessage * > 
currentTaskMessages () const =0
virtual DtTaskWithTaskStateListPtr topLevelTasks () const =0
virtual void enable ()
 Overridden to call registerTaskMsgCallbacks().
virtual void disable ()
 Overridden to 1) remove any task message callbacks registered by this controller 2) call clear task.
virtual void setTasked (bool tasked)
 The current tasked state of this controller.
virtual bool tasked () const
 The current tasked state of this controller.

Static Public Member Functions

static void deprecatedTaskProcessorCallbackAdapter (DtSimMessage *msg, void *usr, DtSimTaskStatePtr taskState)
 Task processor callback function that acts as an adapter for the deprecated forms of addTaskProcessorCallback and removeTaskProcessorCallback (the deprecated form is is version that.

Protected Types

typedef std::pair
< DtTaskMessageCallbackFcn,
void * > 
DtTaskCallbackMapPair
 This map stores callbacks that have been registered to processes various tasks.
typedef std::map< int,
DtTaskCallbackMapPair
DtTaskCallbackMap

Protected Attributes

DtTaskCallbackMap myTaskCallbackMap
std::list
< DtTaskProcessorCallbackInfo * > 
myTaskProcessorCallbackInfoList
 This list stores any DtTaskProcessorCallbackInfo allocated locally so that they can be deleted when the component is deleted.

Private Member Functions

 DtTaskControllerComponent ()
 default constructor; should not be called.
 DtTaskControllerComponent (const DtTaskControllerComponent &orig)
 copy constructor
const DtTaskControllerComponentoperator= (const DtTaskControllerComponent &orig)
 assignment operator

Detailed Description

End User Description: DtTaskControllerComponent is the base class for all controllers that respond to tasks.


Developer Description: DtTaskControllerComponent provides a base class for any controller that intends to register for DtSimTask messages. It implements the basic semantics necessary for the tasking model to work, including, taskNotify(), taskComplete(), skipTask(), and clearTask(). Controllers will want to derive from one of the subclasses of DtTaskControllerComponent, most likely DtSingleTaskControllerComponent.

Examples

Member Typedef Documentation

This map stores callbacks that have been registered to processes various tasks.

The map is indexed by task type ID.


Constructor & Destructor Documentation

DtTaskControllerComponent::DtTaskControllerComponent ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor compDesc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

(const DtString& name,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString& name, DtVrfObject* owner, DtSimManager* simManager, DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0)

destructor

default constructor; should not be called.

Here because the compiler will generate an unprotected one otherwise.

copy constructor


Member Function Documentation

virtual DtString DtTaskControllerComponent::type ( ) const [pure virtual]

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Reimplemented from DtControllerComponent.

Implemented in DtHumanCollisionAvoidanceController, DtTargetSelectionController, DtRailPathController, DtGroundCollisionAvoidanceController, DtPathMovementController, DtSurfaceEntityPilotController, DtDisaggregatedMoveAlongController, DtGroundMovementChooserController, DtDIGuyController, vrfLua::DtLuaScriptController, BHAVE::DtKynapseGroundPlatformController, DtSurfaceEntityMoveAlongController, DtGroundMoveToDestinationControllerComponent, DtSurfaceEntityPatrolRouteController, DtFixedWingTakeoffController, BHAVE::DtKynapseController, DtFixedWingPilotController, BHAVE::DtKynapseLifeformController, DtDisaggregatedMoveIntoFormationController, DtFixedWingMoveAlongController, DtRetreatController, DtOccupancyDirectorController, BHAVE::DtBhaveMoveDirectionController, DtSurfaceEntityPatrolBetweenController, DtAggregatedMoveToController, DtConvoyTaskController, DtDetonationController, DtHumanMoveAlongController, DtCruiseMissileLaunchController, DtIndirectFireController, DtDisaggregatedMoveToLocationController, DtDisaggregatedPatrolAlongController, DtFixedWingLandingController, DtRotaryWingCollisionAvoidanceController, DtEmbarkationController, DtDisaggregatedEmbarkationController, DtHumanMoveToController, DtFixedWingFlyIntoController, DtFixedWingDefaultController, DtGroundMoveToControllerComponent, DtGroundMoveDirectionController, DtRailMovementController, DtSurfaceEntityMoveToLocationController, DtDisaggregatedPatrolBetweenController, DtFixedWingFlightCommandController, DtLasingController, DtRotaryWingLandingController, DtRotaryWingTurnToHeadingController, DtAggregatedPatrolController, DtHumanPatrolController, DtLimitExistenceController, DtMissileMoveToControllerComponent, DtRotaryWingPatrolBetweenController, DtSurfaceEntityFollowEntityController, DtGroundAutoControllerComponent, DtGroundPatrolRouteController, DtGroundStopMovingControllerComponent, DtMissileTrackEntityController, DtDisaggregatedWaitController, DtFixedWingPatrolRouteController, DtGroundFollowEntityController, DtGroundInterceptAndDestroyController, DtMissileControllerComponent, DtRotaryWingPatrolRouteController, DtCruiseMissileDefaultController, DtDisaggregatedMoveToController, DtFixedWingJoyFlightController, DtLasingMissileTrackController, DtRotaryWingMoveAlongControllerComponent, DtSurfaceEntityMoveToController, DtFixedWingFollowEntityController, DtGroundPatrolBetweenController, DtHumanFollowController, DtRotaryWingFlightCommandController, DtRotaryWingFollowEntityController, DtRotaryWingLoiterControllerComponent, DtDisaggregatedOccupancyDirectorController, DtDisaggregatedTurnToHeadingController, DtFixedWingMoveToController, DtFixedWingPatrolBetweenController, DtGroundTurnToControllerComponent, DtWaitController, DtTurnAndMoveController, DtRotaryWingMoveToControllerComponent, DtRotaryWingWaitController, DtRotaryWingTaskController, DtAggregatedMoveAlongController, DtFixedWingEmbarkationController, DtGroundJoyMoveController, DtGroundMoveToLocationControllerComponent, DtHumanTurnToController, DtGroundOrbitController, DtHumanStopMovingController, DtLaunchExpendableResourceController, DtCruiseMissileMoveAlongController, DtGroundMoveAlongControllerComponent, DtFixedWingMoveToLocationController, DtLaunchSmokeController, DtRotaryWingEmbarkationController, DtRotaryWingMoveToLocationControllerComponent, DtSendRadioMessageController, and DtSimpleRadarWarningResponse.

virtual void DtTaskControllerComponent::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 DtSimComponent.

Reimplemented in DtMultiTaskControllerComponent, and DtSingleTaskControllerComponent.

virtual bool DtTaskControllerComponent::beginProcessingTask ( const DtTaskMessage task,
DtSimTaskStatePtr  taskState 
) [virtual]

Called by the task manager when this controller should start executing the specified task.

Parameters:
taskStateUsed 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.
Returns:
True if the controller can successfully start the task.
False if the controller is failing the task.

Reimplemented in DtRotaryWingFlightCommandController, DtFixedWingFlightCommandController, DtMultiTaskControllerComponent, and DtSingleTaskControllerComponent.

virtual void DtTaskControllerComponent::taskNotify ( const DtSimTask task) [inline, virtual]

This is called to let us know when some other component receives a task In the case of this component, we don't care what the task actually is.

Reimplemented from DtControllerComponent.

Reimplemented in DtSingleTaskControllerComponent.

virtual void DtTaskControllerComponent::setTasked ( bool  tasked) [virtual]

The current tasked state of this controller.

True if this controller is currently executing a task.

virtual bool DtTaskControllerComponent::tasked ( ) const [virtual]

The current tasked state of this controller.

True if this controller is currently executing a task.

Returns:
True to show the current task as one of the "Current Tasks" in VRF GUI. The default implementation of this method is to return the value of tasked(). Some controllers may want to override this to show a task even after the task is complete.

Reimplemented in DtFixedWingFlightCommandController, and DtRotaryWingFlightCommandController.

virtual void DtTaskControllerComponent::setRadio ( DtSimBaseRadio radio) [virtual]

Calls registerTaskMsgCallbacks.

Reimplemented from DtControllerComponent.

Reimplemented in DtLasingController, DtGroundJoyMoveController, and DtFixedWingJoyFlightController.

Reimplemented in DtFixedWingMoveToController, DtFixedWingMoveAlongController, DtSurfaceEntityMoveAlongController, DtAggregatedMoveToController, DtSurfaceEntityMoveToController, DtDIGuyController, DtHumanMoveToController, DtDisaggregatedEmbarkationController, DtSurfaceEntityPatrolBetweenController, DtHumanCollisionAvoidanceController, DtIndirectFireController, DtMissileTrackEntityController, DtMissileMoveToControllerComponent, DtTargetSelectionController, DtGroundMoveToDestinationControllerComponent, DtRailPathController, DtSurfaceEntityPatrolRouteController, DtFixedWingFollowEntityController, DtDisaggregatedMoveAlongController, DtLasingController, DtFixedWingDefaultController, DtPathMovementController, DtRotaryWingPatrolBetweenController, DtRotaryWingPatrolRouteController, DtSurfaceEntityFollowEntityController, DtHumanFollowController, DtRotaryWingFollowEntityController, DtDisaggregatedMoveToLocationController, DtRailMovementController, vrfLua::DtLuaScriptController, DtGroundFollowEntityController, DtHumanMoveAlongController, DtFixedWingTakeoffController, DtGroundMovementChooserController, BHAVE::DtKynapseController, DtGroundMoveToControllerComponent, DtOccupancyDirectorController, DtGroundPatrolBetweenController, DtGroundInterceptAndDestroyController, DtRotaryWingCollisionAvoidanceController, DtRotaryWingMoveToControllerComponent, DtSurfaceEntityMoveToLocationController, BHAVE::DtBhaveMovementChooserController, DtRotaryWingFlightCommandController, DtDisaggregatedMoveIntoFormationController, DtFixedWingLandingController, DtFixedWingPatrolBetweenController, DtGroundPatrolRouteController, DtEmbarkationController, DtFixedWingPatrolRouteController, DtRotaryWingLandingController, DtDisaggregatedPatrolAlongController, DtRotaryWingTurnToHeadingController, DtConvoyTaskController, DtGroundTurnToControllerComponent, DtRetreatController, DtAggregatedMoveAlongController, DtGroundStopMovingControllerComponent, DtGroundOrbitController, DtWaitController, DtFixedWingFlyIntoController, DtRotaryWingWaitController, DtGroundMoveToLocationControllerComponent, DtGroundMoveAlongControllerComponent, DtRotaryWingMoveAlongControllerComponent, DtAggregatedPatrolController, DtHumanPatrolController, DtDisaggregatedWaitController, DtRotaryWingMoveToLocationControllerComponent, DtDisaggregatedPatrolBetweenController, DtHumanTurnToController, DtFixedWingMoveToLocationController, DtDisaggregatedMoveToController, DtHumanStopMovingController, DtDisaggregatedTurnToHeadingController, DtTurnAndMoveController, DtSendRadioMessageController, DtLaunchExpendableResourceController, and DtLaunchSmokeController.

virtual void DtTaskControllerComponent::addTaskProcessorCallback ( int  taskType,
DtTaskMessageCallbackFcn  fcn,
void *  usr 
) [virtual]

Adds a new function for processing the specified task type.

Also causes this controller to register for this task type with the task manager.

Note:
It is valid for the callback function to be NULL. This will cause the component to be set to the tasked mode by this task type, but no function will be called when the task message is received.
All these callbacks are removed when the component is destroyed, and there is no need to call removeTaskProcessorCallback from the component destructor.
DtTaskManager:addTaskProcessor will only accept one handler for each task type.
virtual void DtTaskControllerComponent::addTaskProcessorCallback ( int  taskType,
DtMessageCallbackFcn  fcn,
void *  usr 
) [virtual]

Deprecated form of addTaskProcessorCallback.

Callback signature does not include DtTaskState.

virtual void DtTaskControllerComponent::removeTaskProcessorCallback ( int  taskType,
DtMessageCallbackFcn  fcn,
void *  usr 
) [virtual]

Undoes anything done by addTaskProcessorCallback().

virtual void DtTaskControllerComponent::removeTaskProcessorCallback ( int  taskType,
DtTaskMessageCallbackFcn  fcn,
void *  usr 
) [virtual]

Deprecated form of removeTaskProcessorCallback.

Callback signature does not include DtTaskState.

static void DtTaskControllerComponent::deprecatedTaskProcessorCallbackAdapter ( DtSimMessage msg,
void *  usr,
DtSimTaskStatePtr  taskState 
) [static]

Task processor callback function that acts as an adapter for the deprecated forms of addTaskProcessorCallback and removeTaskProcessorCallback (the deprecated form is is version that.

virtual bool DtTaskControllerComponent::taskActive ( int  taskId) const [pure virtual]
Returns:
True if a task of this ID is current active in this controller.

Implemented in DtSingleTaskControllerComponent, and DtMultiTaskControllerComponent.

If this controller has any top level tasks (not subtasks), they are cleared.

Returns:
True if any tasks were cleared.

Implemented in DtSingleTaskControllerComponent, and DtMultiTaskControllerComponent.

virtual void DtTaskControllerComponent::clearConflictingTopLevelTasks ( int  conflictId) [pure virtual]

Clears any top level tasks on this controller that conflict with the conflictId.

The task manager is used to determine what tasks conflict.

Implemented in DtSingleTaskControllerComponent, and DtMultiTaskControllerComponent.

virtual void DtTaskControllerComponent::clearTasksByType ( int  taskType) [pure virtual]

Clears any tasks of the specified type running in this controller.

Implemented in DtSingleTaskControllerComponent, and DtMultiTaskControllerComponent.

virtual void DtTaskControllerComponent::clearTaskById ( int  taskId) [pure virtual]

Clears any task of the specified ID running in this controller.

Implemented in DtSingleTaskControllerComponent, and DtMultiTaskControllerComponent.

virtual std::list<DtTaskMessage*> DtTaskControllerComponent::currentTaskMessages ( ) const [pure virtual]
Returns:
A list of pointers to task messages currently being run on this controller.

Implemented in DtSingleTaskControllerComponent, and DtMultiTaskControllerComponent.

Returns:
A list of all top level tasks currently in this controller along with their task state, if any.

Implemented in DtSingleTaskControllerComponent, and DtMultiTaskControllerComponent.

virtual void DtTaskControllerComponent::enable ( ) [virtual]

Overridden to call registerTaskMsgCallbacks().

Reimplemented from DtSimComponent.

Reimplemented in DtEmbarkationController.

virtual void DtTaskControllerComponent::disable ( ) [virtual]

Overridden to 1) remove any task message callbacks registered by this controller 2) call clear task.

Reimplemented from DtSimComponent.

Reimplemented in DtEmbarkationController.

const DtTaskControllerComponent& DtTaskControllerComponent::operator= ( const DtTaskControllerComponent orig) [private]

assignment operator


Member Data Documentation

This list stores any DtTaskProcessorCallbackInfo allocated locally so that they can be deleted when the component is deleted.


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)