VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions
DtSurfaceEntityPatrolRouteController Class Reference

DtSurfaceEntityPatrolRouteController is a controller that models patrolling along a route for surface entities. More...

Inheritance diagram for DtSurfaceEntityPatrolRouteController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtSurfaceEntityPatrolRouteController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtSurfaceEntityPatrolRouteController ()
 destructor
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual void processPatrolRouteTask (DtSimMessage *msg)
 Retrives the name of the route for the patrol from the task message.
virtual void registerTaskMsgCallbacks ()
 Registers interest in patrol tasks by calling addTaskProcessorCallback with patrolRouteCallback as the function pointer, and the 'this' pointer as the user data.
virtual void doMoving (double desiredSpeed)
 Overridden to call sailTo, preventing the base class from using a driftTo which would cause the entity to stop.
virtual bool targetNextVertex ()
 Overridden to continually loop route state.

Static Public Member Functions

static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
static void patrolRouteCallback (DtSimMessage *msg, void *usrData)
 Called when a patrol route message is received.

Protected Member Functions

 DtSurfaceEntityPatrolRouteController ()
 Default constructor; not implemented.
 DtSurfaceEntityPatrolRouteController (const DtSurfaceEntityPatrolRouteController &orig)
 copy constructor; not implemented
const
DtSurfaceEntityPatrolRouteController
operator= (const DtSurfaceEntityPatrolRouteController &orig)
 assignment operator; not implemented

Detailed Description

DtSurfaceEntityPatrolRouteController is a controller that models patrolling along a route for surface entities.

End User Description:
DtSurfaceEntityPatrolRouteController (surfEntPtrlRt.h) is derived from DtSurfaceEntityMoveAlongController. It changes the functionality of DtSurfaceEntityMoveAlongController from Move Along Route to Patrol Along Route by modifying the route state when the end of a route is reached, instead of completing the task. DtSurfaceEntityPatrolRouteController adds uses the reverse flag from the process state repository to keep track of the direction in which the route is being followed. It overrides registerTaskMsgCallbacks() to register for DtPatrolRouteType. By overriding doMoving(), the controller can insure that sailTo() is always called (as opposed to the base class which calls driftTo() at the end of the route). Overriding targetNextVertex() allows continuous iteration back and forth through the vertices, and maintains the reverse flag.

Uses Descriptor Type: DtSurfaceEntityPilotControllerDescriptor


Constructor & Destructor Documentation

(const DtString&,DtVrfObject*,DtSimManager*,

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&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

destructor

Default constructor; not implemented.

copy constructor; not implemented


Member Function Documentation

static DtSimComponent* DtSurfaceEntityPatrolRouteController::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

(const DtString&,DtVrfObject*,DtSimManager*,

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&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

Returns:
New instance of this class.

Reimplemented from DtSurfaceEntityMoveAlongController.

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.

Returns:
DtSurfaceEntityPatrolRouteType

Reimplemented from DtSurfaceEntityMoveAlongController.

static void DtSurfaceEntityPatrolRouteController::patrolRouteCallback ( DtSimMessage msg,
void *  usrData 
) [static]

Called when a patrol route message is received.

Instances of this component will register this callback in registerTaskMsgCallbacks (with their own 'this' pointer as user data) by calling addTaskProcessorCallback in order to request for notification of patrol route tasks. When this callback is activated, the user data pointer is cast to an instance of this class upon which processPatrolRouteTask is called with the patrol route task message.

Retrives the name of the route for the patrol from the task message.

Called by patrolRouteCallback to store the names of the route in the process state repository. The reverse flag in the PSR is reset to false. The route is lookup up in the object manager and a pointer to it is stored in myRoute. The route verticies are then copied in the route state in the process state repository and setToClosest is called on the PSR with the location of the entity. A verticesChangedCallback is added on the route with routeChangedCallback as the function pointer. The myRouteHasChanged flag is set to false. A call is made to setupControlPoint() to initilize the base class.

Registers interest in patrol tasks by calling addTaskProcessorCallback with patrolRouteCallback as the function pointer, and the 'this' pointer as the user data.

Reimplemented from DtSurfaceEntityMoveAlongController.

virtual void DtSurfaceEntityPatrolRouteController::doMoving ( double  desiredSpeed) [virtual]

Overridden to call sailTo, preventing the base class from using a driftTo which would cause the entity to stop.

Reimplemented from DtSurfaceEntityMoveAlongController.

Overridden to continually loop route state.

Checks to see if the current vertex in the route state (from the process state repository) is the last vertex in the route. If so the reverse flag is flipped, and the route state is reset. Once the route state is upddated, next() is called to advance to the next vertex, setupControlPoint() is called to initilize the base class and doMoving() is called with findDesiredSpeed().

Reimplemented from DtSurfaceEntityMoveAlongController.

const DtSurfaceEntityPatrolRouteController& DtSurfaceEntityPatrolRouteController::operator= ( const DtSurfaceEntityPatrolRouteController orig) [protected]

assignment operator; not implemented


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)