VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Static Public Attributes
DtSimTaskState Class Reference

DtSimTaskState holds the current execution state of a given task. More...

Inheritance diagram for DtSimTaskState:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtSimTaskState ()
 default constructor
 DtSimTaskState (const DtString &writeName, DtReaderWriterRegistry *parentRegistry=0)
 constructor If you have a task staet object 'put' itself, the write name will preface the task state object.
 DtSimTaskState (const DtString &writeName, const DtSimTaskState &orig, DtReaderWriterRegistry *parentRegistry=0)
 copy constructor
const DtSimTaskState & operator= (const DtSimTaskState &orig)
 assignment operator; same as copy constructor
virtual ~DtSimTaskState ()
 destructor
virtual bool init ()
 Base class init does nothing, but this will be called by create, in case any other deriving class needs to do virtual allocation.
virtual int type () const
 What kind of task state object am I? Returns a string indicating the kind of task state object( for example, “move-along-task-state”, Derived classes must implement this member function to return a unique string representing the type of task state.
virtual DtSimTaskState * clone (const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const
 Make a copy of this task.
virtual void putData (FILE *fp, int indentLevel=0)
 putData writes our type, which is provided by the virtual type accessor of the deriving class.
virtual DtlObjPtr getData (DtlObjPtr args, const DtFilename &searchPath, const DtVariableBindingsList &variableBindings)
 getData is just used to get us past the type in the data stream, since it's not actually stored.

Static Public Member Functions

static DtSimTaskState * createTaskState (DtlObjPtr mtlStream)
 Static functions.
static DtSimTaskState * createTaskState (int taskStateType)
static void addTaskStateCreatorFcn (const DtString &taskName, int taskType, DtSimTaskStateCreatorFcn fcn)
 Adds a task creator member function to the task factory.
static void setFactory (DtSimTaskStateFactory *factory)
static DtSimTaskStateFactory * factory ()
static bool getTaskStateNameFromTaskStateType (int taskStateType, DtString &taskStateName)
static bool getTaskStateTypeFromTaskStateName (const DtString &taskStateName, int &taskStateType)

Static Public Attributes

static DtSimTaskStateFactory * myFactory

Detailed Description

DtSimTaskState holds the current execution state of a given task.

DtSimTaskState is an abstract base class that represents the current execution state associated with a given DtSimTask. Derived classes hold details particular to a specific task. For example, for the DtMoveAlongTask there is a corresponding DtMoveAlongTaskState class that holds the current waypoint and direction of movement along the route. DtSimTaskState can be used in transferring responsibility for handling a task from one class to another (i.e. mult-resolution modeling), or in the context of suspending and resuming a task.


Constructor & Destructor Documentation

default constructor

DtSimTaskState::DtSimTaskState ( const DtString &  writeName,
DtReaderWriterRegistry *  parentRegistry = 0 
)

constructor If you have a task staet object 'put' itself, the write name will preface the task state object.

DtSimTaskState::DtSimTaskState ( const DtString &  writeName,
const DtSimTaskState &  orig,
DtReaderWriterRegistry *  parentRegistry = 0 
)

copy constructor

virtual DtSimTaskState::~DtSimTaskState ( ) [virtual]

destructor


Member Function Documentation

const DtSimTaskState& DtSimTaskState::operator= ( const DtSimTaskState &  orig)

assignment operator; same as copy constructor

virtual bool DtSimTaskState::init ( ) [virtual]

Base class init does nothing, but this will be called by create, in case any other deriving class needs to do virtual allocation.

virtual int DtSimTaskState::type ( ) const [virtual]

What kind of task state object am I? Returns a string indicating the kind of task state object( for example, “move-along-task-state”, Derived classes must implement this member function to return a unique string representing the type of task state.

The set of standard task state types supplied with VR-Forces is in taskStateTypes.h.

Returns:
DtBaseTaskStateType

Reimplemented in DtPatrolBetweenPointsTaskState, DtPatrolRouteTaskState, DtMoveAlongTaskState, and DtWaitTaskState.

virtual DtSimTaskState* DtSimTaskState::clone ( const DtString &  name,
DtReaderWriterRegistry *  parentRegistry = 0 
) const [virtual]

Make a copy of this task.

Returns a newly allocated instance of a DtSimTaskState. Override this member function to return a pointer to a newly allocated instance of the derived class.

Reimplemented in DtPatrolBetweenPointsTaskState, DtPatrolRouteTaskState, DtMoveAlongTaskState, and DtWaitTaskState.

virtual void DtSimTaskState::putData ( FILE *  fp,
int  indentLevel = 0 
) [virtual]

putData writes our type, which is provided by the virtual type accessor of the deriving class.

Reimplemented from DtReaderWriter.

virtual DtlObjPtr DtSimTaskState::getData ( DtlObjPtr  args,
const DtFilename &  searchPath,
const DtVariableBindingsList &  variableBindings 
) [virtual]

getData is just used to get us past the type in the data stream, since it's not actually stored.

static DtSimTaskState* DtSimTaskState::createTaskState ( DtlObjPtr  mtlStream) [static]

Static functions.

Creates a new task state object, given a pointer to a MÄK Technologies LISP (MTL) stream. It first parses the stream to extract the type of task to create. Then it calls the task factory's create() member function with the given task type. This returns a new instance of the particular task type. The task's getData() member function is then called to retrieve the task parameters from the stream. The pointer to the new task is returned.

static DtSimTaskState* DtSimTaskState::createTaskState ( int  taskStateType) [static]
static void DtSimTaskState::addTaskStateCreatorFcn ( const DtString &  taskName,
int  taskType,
DtSimTaskStateCreatorFcn  fcn 
) [static]

Adds a task creator member function to the task factory.

static void DtSimTaskState::setFactory ( DtSimTaskStateFactory *  factory) [static]
Returns:
A pointer to the static DtReaderWriterFactory. This factory can create instances of DtReaderWriter subclasses that have been registered with it.

Reimplemented from DtReaderWriter.

static bool DtSimTaskState::getTaskStateNameFromTaskStateType ( int  taskStateType,
DtString &  taskStateName 
) [static]
static bool DtSimTaskState::getTaskStateTypeFromTaskStateName ( const DtString &  taskStateName,
int &  taskStateType 
) [static]

Member Data Documentation


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)