LRAUV  revA
MissionItem Class Reference

Wraps a Behavior or Aggregate with mission-specific settings pertaining to that item. More...

#include <MissionItem.h>

Collaboration diagram for MissionItem:

Public Member Functions

virtual ~MissionItem ()
 Destructor. More...
 
AggregategetAggregate () const
 Returns the component as a Aggregate. More...
 
BehaviorgetComponent () const
 Returns the mission component. More...
 
void setComponent (Behavior *component)
 Sets the mission component. More...
 
bool isParallel ()
 Indicates if the item runs in parallel. More...
 
void setParallel (bool parallel)
 Tell the item to run in parallel. More...
 
bool isSequence ()
 Indicates if the item runs in sequence. More...
 
void setSequence (bool sequence)
 Tell the item to run in sequence. More...
 
bool isAggregate () const
 Indicates if the mission component is an aggreate behavior. More...
 
bool isCompletable ()
 Indicates if the mission component is a command. More...
 
unsigned int getTablePosition ()
 Returns the position within the Aggregate. More...
 
ValueClausegetBreakClause ()
 
ValueClausegetWhenClause ()
 
ValueClausegetWhileClause ()
 
ValueClausegetPreemptiveClause ()
 
bool isPreemptive ()
 
void setRepeatIndex (int repeatIndex)
 resets the repeat index More...
 
int getRepeatIndex ()
 returns the repeat index More...
 
int getRepeatLimit ()
 returns the repeat limit More...
 
unsigned int getTablePos ()
 
bool isActive (MissionItem *activeItem)
 
void initialize ()
 
void run ()
 
bool runIfUnsatisfied ()
 
bool satisfied ()
 
void preempted ()
 Called when the mission component becomes preempted. More...
 
void uninitialize ()
 
bool isTimedOut ()
 True if this is timed out. More...
 
bool isInitialized ()
 
const TimestampgetStartTime () const
 
MissionItemgetParent () const
 Parent MissionItem. More...
 
void addCall ()
 
void removeCall ()
 
DataReaderfindArgReader (const Str &argName) const
 

Static Public Member Functions

static MissionItemInstance (MissionItem *parent, MissionNode *node, unsigned int tablePos, Logger &logger)
 Returns an instance, or NULL if an instance can't be returned. More...
 

Protected Member Functions

 MissionItem (MissionItem *parent, unsigned int tablePos)
 Protected Constructor. More...
 
void initializeFromScript (MissionNode *node, Logger &logger)
 
void interpretRepeat (MissionNode *node, const Str &name, Logger &logger)
 
void interpretRunIn (MissionNode *node, const Str &name, Logger &logger)
 
MissionItemfindItemByRefId (const Str &refId) const
 
void putDefineBehavior (const Str &name, DefineBehavior *defineBehavior)
 
DefineBehaviorfindDefineBehavior (const Str &name) const
 

Protected Attributes

MissionItemparentItem_
 Parent MissionItem. More...
 
unsigned int tablePos_
 Position within the Aggregate. More...
 
Behaviorcomponent_
 Single item. More...
 
bool sequence_
 Indicates if missionComponent should be run sequentially. More...
 
bool parallel_
 Indicates if missionComponent should be run all the time. More...
 
bool aggregate_
 Aggregate item? More...
 
ValueClausebreakClause_
 Boolean BREAK clause. More...
 
ValueClausewhenClause_
 Boolean WHEN clauses. More...
 
ValueClausewhileClause_
 Boolean WHILE clause. More...
 
ValueClausepreemptiveClause_
 Indicates that the clause is preemptive. More...
 
int callCount_
 Number of calls to this item. More...
 
int repeatIndex_
 Number of Times repeated so far. More...
 
int repeatLimit_
 Number of Times to repeat this item. More...
 
DataReaderrepeatArgReader_
 Reads timeout argument at timeout init time. More...
 
Timestamp startTime_
 Keeps track of how long we've been running. More...
 
bool timedOut_
 True if time since startTime exceed timeout. More...
 
DataReadertimeoutArgReader_
 Reads timeout argument at timeout init time. More...
 
MissionItemtimeoutItem_
 Aggregate commands to execute in the case of a timeout. Can be empty. More...
 
FastMap< const Str, DefineBehavior * > * defineBehaviors_
 Map of DefineBehavior instances. More...
 
bool preempted_
 True if the item is currently preempted. More...
 
bool initialized_
 Flag used by parent aggregates. More...
 
MissionNodenode_
 Used only while reading mission from XML. Do not use later! More...
 
bool ignoreWhenWhile_
 If true, this is a called item, so the when clause is ignored. More...
 

Private Member Functions

 MissionItem (const MissionItem &old)
 
void setCompleted ()
 
void setTimedOut ()
 

Detailed Description

Wraps a Behavior or Aggregate with mission-specific settings pertaining to that item.

Constructor & Destructor Documentation

MissionItem::~MissionItem ( )
virtual
MissionItem::MissionItem ( MissionItem parent,
unsigned int  tablePos 
)
protected

Protected Constructor.

Referenced by Instance().

MissionItem::MissionItem ( const MissionItem old)
private

Member Function Documentation

DefineBehavior * MissionItem::findDefineBehavior ( const Str name) const
protected
MissionItem * MissionItem::findItemByRefId ( const Str refId) const
protected
Aggregate* MissionItem::getAggregate ( ) const
inline
ValueClause* MissionItem::getBreakClause ( )
inline

References breakClause_.

MissionItem* MissionItem::getParent ( ) const
inline

Parent MissionItem.

References parentItem_.

Referenced by findArgReader().

ValueClause* MissionItem::getPreemptiveClause ( )
inline

References preemptiveClause_.

int MissionItem::getRepeatIndex ( )
inline

returns the repeat index

References repeatIndex_.

Referenced by Aggregate::run().

int MissionItem::getRepeatLimit ( )
inline

returns the repeat limit

References repeatLimit_.

Referenced by Aggregate::run().

const Timestamp& MissionItem::getStartTime ( ) const
inline

References startTime_.

Referenced by ValueClause::evalSide().

unsigned int MissionItem::getTablePos ( )
inline

References tablePos_.

unsigned int MissionItem::getTablePosition ( )
inline

Returns the position within the Aggregate.

References tablePos_.

Referenced by Aggregate::gotoNextItem().

ValueClause* MissionItem::getWhenClause ( )
inline

References whenClause_.

Referenced by Aggregate::initialize().

ValueClause* MissionItem::getWhileClause ( )
inline

References whileClause_.

void MissionItem::initializeFromScript ( MissionNode node,
Logger logger 
)
protected
MissionItem * MissionItem::Instance ( MissionItem parent,
MissionNode node,
unsigned int  tablePos,
Logger logger 
)
static
void MissionItem::interpretRepeat ( MissionNode node,
const Str name,
Logger logger 
)
protected
void MissionItem::interpretRunIn ( MissionNode node,
const Str name,
Logger logger 
)
protected
bool MissionItem::isAggregate ( ) const
inline

Indicates if the mission component is an aggreate behavior.

References aggregate_.

Referenced by findArgReader(), initialize(), initializeFromScript(), isCompletable(), MissionManager::resumeLoadedMission(), runIfUnsatisfied(), and satisfied().

bool MissionItem::isCompletable ( )
inline

Indicates if the mission component is a command.

References isAggregate(), isParallel(), and isSequence().

bool MissionItem::isInitialized ( )
inline
bool MissionItem::isParallel ( )
inline

Indicates if the item runs in parallel.

References parallel_.

Referenced by initializeFromScript(), isCompletable(), and Aggregate::run().

bool MissionItem::isSequence ( )
inline

Indicates if the item runs in sequence.

References sequence_.

Referenced by Aggregate::initialize(), initializeFromScript(), isActive(), isCompletable(), and Aggregate::run().

bool MissionItem::isTimedOut ( )
inline

True if this is timed out.

References timedOut_.

void MissionItem::preempted ( )

Called when the mission component becomes preempted.

References component_, Component::getLogger(), Logger::logComponentRun(), Behavior::preempted(), and preempted_.

Referenced by Aggregate::preempted(), and Aggregate::run().

void MissionItem::putDefineBehavior ( const Str name,
DefineBehavior defineBehavior 
)
protected
void MissionItem::setCompleted ( )
private
void MissionItem::setComponent ( Behavior component)
inline
void MissionItem::setParallel ( bool  parallel)
inline

Tell the item to run in parallel.

References parallel_.

void MissionItem::setRepeatIndex ( int  repeatIndex)

resets the repeat index

sets the repeat index

References component_, Component::getName(), repeatIndex_, and MissionStateLogger::SetRepeatIndex().

Referenced by MissionManager::resumeLoadedMission(), and Aggregate::run().

void MissionItem::setSequence ( bool  sequence)
inline

Tell the item to run in sequence.

References sequence_.

Member Data Documentation

bool MissionItem::aggregate_
protected
ValueClause* MissionItem::breakClause_
protected

Boolean BREAK clause.

Referenced by getBreakClause(), initializeFromScript(), isActive(), and ~MissionItem().

int MissionItem::callCount_
protected

Number of calls to this item.

Referenced by addCall(), isActive(), removeCall(), and uninitialize().

FastMap<const Str, DefineBehavior*>* MissionItem::defineBehaviors_
protected
bool MissionItem::ignoreWhenWhile_
protected

If true, this is a called item, so the when clause is ignored.

Referenced by initializeFromScript().

bool MissionItem::initialized_
protected

Flag used by parent aggregates.

Referenced by initialize(), isInitialized(), and uninitialize().

MissionNode* MissionItem::node_
protected

Used only while reading mission from XML. Do not use later!

Referenced by initializeFromScript().

bool MissionItem::parallel_
protected

Indicates if missionComponent should be run all the time.

Referenced by initializeFromScript(), interpretRunIn(), isParallel(), and setParallel().

MissionItem* MissionItem::parentItem_
protected
bool MissionItem::preempted_
protected

True if the item is currently preempted.

Referenced by preempted(), and run().

ValueClause* MissionItem::preemptiveClause_
protected

Indicates that the clause is preemptive.

Referenced by getPreemptiveClause(), initializeFromScript(), isPreemptive(), and ~MissionItem().

DataReader* MissionItem::repeatArgReader_
protected

Reads timeout argument at timeout init time.

Referenced by initialize(), and interpretRepeat().

int MissionItem::repeatIndex_
protected

Number of Times repeated so far.

Referenced by getRepeatIndex(), initialize(), run(), and setRepeatIndex().

int MissionItem::repeatLimit_
protected

Number of Times to repeat this item.

Referenced by getRepeatLimit(), initialize(), and interpretRepeat().

bool MissionItem::sequence_
protected

Indicates if missionComponent should be run sequentially.

Referenced by initializeFromScript(), interpretRunIn(), isSequence(), and setSequence().

Timestamp MissionItem::startTime_
protected

Keeps track of how long we've been running.

Referenced by addCall(), getStartTime(), initialize(), run(), runIfUnsatisfied(), satisfied(), and setTimedOut().

unsigned int MissionItem::tablePos_
protected

Position within the Aggregate.

Referenced by getTablePos(), getTablePosition(), and initializeFromScript().

bool MissionItem::timedOut_
protected

True if time since startTime exceed timeout.

Referenced by addCall(), initialize(), isTimedOut(), run(), runIfUnsatisfied(), satisfied(), and setTimedOut().

DataReader* MissionItem::timeoutArgReader_
protected

Reads timeout argument at timeout init time.

Referenced by initialize(), initializeFromScript(), run(), and runIfUnsatisfied().

MissionItem* MissionItem::timeoutItem_
protected

Aggregate commands to execute in the case of a timeout. Can be empty.

Referenced by initializeFromScript(), run(), runIfUnsatisfied(), satisfied(), and ~MissionItem().

ValueClause* MissionItem::whenClause_
protected

Boolean WHEN clauses.

Referenced by getWhenClause(), initializeFromScript(), isActive(), and ~MissionItem().

ValueClause* MissionItem::whileClause_
protected

Boolean WHILE clause.

Referenced by getWhileClause(), initializeFromScript(), isActive(), and ~MissionItem().


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