![]() |
VR-Forces 4.0.4 Class Documentation
|
DtAggregatePatrolAlongController is a task controller responsible for executing DtPatrolAlongTasks in aggregate entities. More...

Public Types | |
| enum | DtPatrolAlongState { DtMovingAlongRoute = 0, DtReversingDirection = 1 } |
Public Member Functions | |
| DtDisaggregatedPatrolAlongController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtDisaggregatedPatrolAlongController () |
| destructor | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual bool | init () |
| Override to cache a pointer to our DtFormationState and register formationStateChangedCallback to be invoked when formation state changes. | |
| virtual void | tick () |
| Override to check and set myFirstTick flag. | |
| virtual void | registerTaskMsgCallbacks () |
| Registers patrolAlongTaskCallback callback for DtPatrolRouteTasks. | |
| DtSimTaskStatePtr | currentTaskState () const |
| Returns current task execution state (i.e. | |
Static Public Member Functions | |
| static void | patrolAlongTaskCallback (DtSimMessage *msg, void *usr, DtSimTaskStatePtr taskStatePtr) |
| Called upon reciept of DtPatrolRotueTasks. | |
| static void | taskCompleteReportCallback (DtSimMessage *msg, void *usr) |
| Called upon receipt of a DtTaskCompleteReport. | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
Protected Member Functions | |
| virtual void | processPatrolAlongTask (DtSimMessage *msg, DtSimTaskStatePtr taskStatePtr) |
| Unpacks the incoming DtPatrolRouteTask and calls myMoveAlongController->moveAlong(), sets myReverseDirection to true, and calls startTask(). | |
| virtual void | onTaskComplete (DtSimMessage *msg) |
| If tasked() is true and report is for a DtMoveAlongTask type, send set heading request to reverse direction and sends new move along task to ourself to start moving in opposite direction along route. | |
| virtual bool | createPSR () |
| Creates myProcessState data member, and adds it to our process state repository manager. | |
| virtual DtIteratorDirection | initialTraversalDirection (const DtString &routeName, const DtVector &initialWorldPosition) const |
| Determines initial traversal direction for patrol task. | |
| virtual void | sendMoveAlongToSelf (const DtString &routeName, enum DtIteratorDirection traversalDirection, bool startAtClosestPoint) |
| Send move along task as subtask to ourself. | |
Protected Attributes | |
| const DtAggregatePatrolAlongDescriptor * | myAggregatePatrolAlongDescriptor |
| Descriptor used to configure this component. | |
| DtFormationState * | myFormationState |
| Aggregate's formation state, cached in this class for convenience. | |
| DtAggregatePatrolAlongPSR * | myProcessState |
| Container for state data associated with this component. | |
| bool | myFirstTick |
Private Member Functions | |
| DtDisaggregatedPatrolAlongController (const DtDisaggregatedPatrolAlongController &orig) | |
| copy constructor - not implemented | |
| DtDisaggregatedPatrolAlongController & | operator= (const DtDisaggregatedPatrolAlongController &orig) |
| assignment operator - not implemented | |
DtAggregatePatrolAlongController is a task controller responsible for executing DtPatrolAlongTasks in aggregate entities.
End User Description: DtAggregatePatrolAlongController models an aggregate's patrol-along <route> behavior. The behavior is implemented by issuing move-along subtasks to itself, alternating between forward and reverse directions along ther route. The DtAggregateMoveAlongController executes the subtasks. The task executes indefinitely (unless stopped by an external event, such as receipt of a skip task message).
This controller may only be configured as a part of an entity that has a vrf-aggregate-state-repository.
Uses Descriptor Type: DtAggregatePatrolAlongDescriptor
| DtDisaggregatedPatrolAlongController::DtDisaggregatedPatrolAlongController | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString&,DtVrfObject*,DtSimManager*,
| 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 DtDisaggregatedPatrolAlongController::~DtDisaggregatedPatrolAlongController | ( | ) | [virtual] |
destructor
| DtDisaggregatedPatrolAlongController::DtDisaggregatedPatrolAlongController | ( | const DtDisaggregatedPatrolAlongController & | orig | ) | [private] |
copy constructor - not implemented
| virtual DtString DtDisaggregatedPatrolAlongController::type | ( | ) | const [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.
Implements DtTaskControllerComponent.
| virtual bool DtDisaggregatedPatrolAlongController::init | ( | ) | [virtual] |
Override to cache a pointer to our DtFormationState and register formationStateChangedCallback to be invoked when formation state changes.
Reimplemented from DtControllerComponent.
| virtual void DtDisaggregatedPatrolAlongController::tick | ( | ) | [virtual] |
Override to check and set myFirstTick flag.
Reimplemented from DtSimComponent.
| virtual void DtDisaggregatedPatrolAlongController::registerTaskMsgCallbacks | ( | ) | [virtual] |
Registers patrolAlongTaskCallback callback for DtPatrolRouteTasks.
Reimplemented from DtTaskControllerComponent.
| DtSimTaskStatePtr DtDisaggregatedPatrolAlongController::currentTaskState | ( | ) | const [virtual] |
Returns current task execution state (i.e.
what is our traversal direction). Creates and fills out a DtPatrolRouteTaskState object.
Reimplemented from DtSingleTaskControllerComponent.
| static void DtDisaggregatedPatrolAlongController::patrolAlongTaskCallback | ( | DtSimMessage * | msg, |
| void * | usr, | ||
| DtSimTaskStatePtr | taskStatePtr | ||
| ) | [static] |
Called upon reciept of DtPatrolRotueTasks.
Calls processPatrolAlongTask().
| msg | Message containing a DtPatrolRouteTask. |
| usr | Pointer to an instance of this class. |
| static void DtDisaggregatedPatrolAlongController::taskCompleteReportCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Called upon receipt of a DtTaskCompleteReport.
Calls onTaskComplete to process the message.
| msg | Message containing a DtTaskCompleteReport. |
| usr | Pointer to an instance of this class. |
| static DtSimComponent* DtDisaggregatedPatrolAlongController::creator | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) | [static] |
(const DtString&,DtVrfObject*,DtSimManager*,
| 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 void DtDisaggregatedPatrolAlongController::processPatrolAlongTask | ( | DtSimMessage * | msg, |
| DtSimTaskStatePtr | taskStatePtr | ||
| ) | [protected, virtual] |
Unpacks the incoming DtPatrolRouteTask and calls myMoveAlongController->moveAlong(), sets myReverseDirection to true, and calls startTask().
| msg | Message containing a DtPatrolAlongTask. |
| virtual void DtDisaggregatedPatrolAlongController::onTaskComplete | ( | DtSimMessage * | msg | ) | [protected, virtual] |
If tasked() is true and report is for a DtMoveAlongTask type, send set heading request to reverse direction and sends new move along task to ourself to start moving in opposite direction along route.
| msg | Message containing a DtTaskCompleteReport. |
| virtual bool DtDisaggregatedPatrolAlongController::createPSR | ( | ) | [protected, virtual] |
Creates myProcessState data member, and adds it to our process state repository manager.
Passes in the name and type specified in the component descriptor (if they exist) to the DtVrfProcessStateRepository::createRepository factory method. If name and/or type is not specified, uses the appropriate default strings defined in procSRTypes.h.
| virtual DtIteratorDirection DtDisaggregatedPatrolAlongController::initialTraversalDirection | ( | const DtString & | routeName, |
| const DtVector & | initialWorldPosition | ||
| ) | const [protected, virtual] |
Determines initial traversal direction for patrol task.
Returns traversal in forward direction, unless closest vertex is the last vertex. If closest vertex is the last vertex, checks to see if aggregate is beyond the end of the route. If so, returns a traversal direction of reverse, otherwise returns traversal direction of forward.
| routeName | Object name of the route we are following. |
| worldPosition | Initial position in geocentric coordinates. |
| virtual void DtDisaggregatedPatrolAlongController::sendMoveAlongToSelf | ( | const DtString & | routeName, |
| enum DtIteratorDirection | traversalDirection, | ||
| bool | startAtClosestPoint | ||
| ) | [protected, virtual] |
Send move along task as subtask to ourself.
| routeName | Object name of the route we are following. |
| traversalDirection | Direction to move along route. Increasing vertex index corresponds to forward direction, decreasing vertex index corresponds to reverse direction. |
| startAtClosestPoint | If true, starts at nearest vertex, otherwise starts at logical beginning of route (which may be at the 'end', if the traversal direction is reverse). |
| DtDisaggregatedPatrolAlongController& DtDisaggregatedPatrolAlongController::operator= | ( | const DtDisaggregatedPatrolAlongController & | orig | ) | [private] |
assignment operator - not implemented
const DtAggregatePatrolAlongDescriptor* DtDisaggregatedPatrolAlongController::myAggregatePatrolAlongDescriptor [protected] |
Descriptor used to configure this component.
Aggregate's formation state, cached in this class for convenience.
Container for state data associated with this component.
This state is saved and restored as part of a scenario (or checkpoint).