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

DtSurfaceEntityPatrolBetweenController; patrol between waypoint behavior for a surface entity. More...

Inheritance diagram for DtSurfaceEntityPatrolBetweenController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtSurfaceEntityPatrolBetweenController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtSurfaceEntityPatrolBetweenController ()
 destructor
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual void processPatrolBetweenTask (DtSimMessage *msg)
 Retrives the names of the waypoints for the patrol from the task message.
virtual bool atGoal ()
 Overridden to swap goal waypoints every time a waypoint is reached.
virtual bool passedGoal ()
 Overridden to swap goal waypoints if a waypoint has been passed.
virtual void doMoving (double desiredSpeed)
 Overridden to call sailTo.
first waypoint

{@ The first point to patrol between, stored in the process state repository

virtual const DtStringfirstWaypoint () const
virtual void setFirstWaypoint (const DtString &waypoint)
second waypoint

{@ The second point to patrol between, stored in the process state repository

virtual const DtStringsecondWaypoint () const
virtual void setSecondWaypoint (const DtString &waypoint)

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 patrolBetweenCallback (DtSimMessage *msg, void *usrData)
 Called when a patrol between message is received.

Protected Member Functions

virtual void registerTaskMsgCallbacks ()
 Registers interest in patrol tasks by calling addTaskProcessorCallback with patrolBetweenCallback as the function pointer, and the 'this' pointer as the user data.
 DtSurfaceEntityPatrolBetweenController ()
 Default constructor; not implemented.
 DtSurfaceEntityPatrolBetweenController (const DtSurfaceEntityPatrolBetweenController &orig)
 copy constructor; not implemented
const
DtSurfaceEntityPatrolBetweenController
operator= (const DtSurfaceEntityPatrolBetweenController &orig)
 assignment operator; not implemented

Detailed Description

DtSurfaceEntityPatrolBetweenController; patrol between waypoint behavior for a surface entity.

End User Description:
DtSurfaceEntityPatrolBetweenController (surfEntPtlBtwn.h) is derived from DtSurfaceEntityMoveToController. Instead of calling taskComplete() when a waypoint is reached (as Move To Waypoint would do), it switches the destination to the other waypoint in its derived atGoal() and passedGoal() functions. It overrides registerTaskMsgCallbacks() to register for DtPatrolTwoPointsType.

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* DtSurfaceEntityPatrolBetweenController::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 DtSurfaceEntityMoveToController.

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:
DtSurfaceEntityPatrolBetweenType

Reimplemented from DtSurfaceEntityMoveToController.

static void DtSurfaceEntityPatrolBetweenController::patrolBetweenCallback ( DtSimMessage msg,
void *  usrData 
) [static]

Called when a patrol between 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 between tasks. When this callback is activated, the user data pointer is cast to an instance of this class upon which processPatrolBetweenTask is called with the patrol between task message.

Retrives the names of the waypoints for the patrol from the task message.

Called by patrolBetweenCallback to store the names of the first and second waypoints from the task message in the process state repository. The reverse flag in the PSR is reset to false. The control object name in the PSR is set to the name of the first waypoint to initialize the move to behavior from the base class. A call to setupControlPoint is made to the base class to initialize the waypoint, and if it fails an error is printed to the object console and taskComplete() is called to end the task. Finally, setupGoalVector is called with the location of myControlPoint.

virtual void DtSurfaceEntityPatrolBetweenController::setFirstWaypoint ( const DtString waypoint) [virtual]
virtual void DtSurfaceEntityPatrolBetweenController::setSecondWaypoint ( const DtString waypoint) [virtual]

Overridden to swap goal waypoints every time a waypoint is reached.

Calls DtSurfaceEntityMoveToController::atGoal to check to see if the current waypoint has been reached. If so, the value of the reverse flag is checked in the process state repository. If it is true, it's set to false and the control object name in the PSR is set to the first waypoint. If it is false, it's set to true and the control object name in the PSR is set to the second waypoint. Because patrol is a never-ending task, this function always returns false.

Reimplemented from DtSurfaceEntityMoveToController.

Overridden to swap goal waypoints if a waypoint has been passed.

Calls DtSurfaceEntityMoveToController::passedGoal to check to see if the current waypoint has been passed. If so, the value of the reverse flag is checked in the process state repository. If it is true, it's set to false and the control object name in the PSR is set to the first waypoint. If it is false, it's set to true and the control object name in the PSR is set to the second waypoint. Because patrol is a never-ending task, this function always returns false.

Reimplemented from DtSurfaceEntityMoveToController.

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

Overridden to call sailTo.

Because patrol is a never-ending task, doMoving is overridden to make sure that sailTo is called with the position of the current waypoint and that the base class does not call driftTo (which would bring the entity to a stop). Sets myLastDistanceSquared to myDistanceSquared.

Reimplemented from DtSurfaceEntityMoveToController.

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

Reimplemented from DtSurfaceEntityMoveToController.

const DtSurfaceEntityPatrolBetweenController& DtSurfaceEntityPatrolBetweenController::operator= ( const DtSurfaceEntityPatrolBetweenController 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)