|
LRAUV
revA
|
Wraps a Behavior or Aggregate with mission-specific settings pertaining to that item. More...
#include <MissionItem.h>

Public Member Functions | |
| virtual | ~MissionItem () |
| Destructor. More... | |
| Aggregate * | getAggregate () const |
| Returns the component as a Aggregate. More... | |
| Behavior * | getComponent () 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... | |
| ValueClause * | getBreakClause () |
| ValueClause * | getWhenClause () |
| ValueClause * | getWhileClause () |
| ValueClause * | getPreemptiveClause () |
| 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 Timestamp & | getStartTime () const |
| MissionItem * | getParent () const |
| Parent MissionItem. More... | |
| void | addCall () |
| void | removeCall () |
| DataReader * | findArgReader (const Str &argName) const |
Static Public Member Functions | |
| static MissionItem * | Instance (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) |
| MissionItem * | findItemByRefId (const Str &refId) const |
| void | putDefineBehavior (const Str &name, DefineBehavior *defineBehavior) |
| DefineBehavior * | findDefineBehavior (const Str &name) const |
Protected Attributes | |
| MissionItem * | parentItem_ |
| Parent MissionItem. More... | |
| unsigned int | tablePos_ |
| Position within the Aggregate. More... | |
| Behavior * | component_ |
| 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... | |
| ValueClause * | breakClause_ |
| Boolean BREAK clause. More... | |
| ValueClause * | whenClause_ |
| Boolean WHEN clauses. More... | |
| ValueClause * | whileClause_ |
| Boolean WHILE clause. More... | |
| ValueClause * | preemptiveClause_ |
| 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... | |
| DataReader * | repeatArgReader_ |
| 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... | |
| DataReader * | timeoutArgReader_ |
| Reads timeout argument at timeout init time. More... | |
| MissionItem * | timeoutItem_ |
| 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... | |
| MissionNode * | node_ |
| 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 () |
|
virtual |
Destructor.
References breakClause_, FastMap< S, T >::clear(), component_, defineBehaviors_, preemptiveClause_, timeoutItem_, whenClause_, and whileClause_.
|
protected |
Protected Constructor.
Referenced by Instance().
|
private |
| void MissionItem::addCall | ( | ) |
References Behavior::BEHAVIOR_ACTIVE, Behavior::BEHAVIOR_CALLED, callCount_, component_, Behavior::getBehaviorState(), Timestamp::Now(), Behavior::setBehaviorState(), startTime_, and timedOut_.
Referenced by Aggregate::initialize().
| DataReader * MissionItem::findArgReader | ( | const Str & | argName | ) | const |
References Str::find(), findArgReader(), getAggregate(), getParent(), isAggregate(), Str::NO_POS, and Str::substr().
Referenced by findArgReader(), initializeFromScript(), Assign::Instance(), SendDataComponent::Instance(), SyslogComponent::Instance(), interpretRepeat(), and ValueClause::ReadSide().
|
protected |
References defineBehaviors_, findDefineBehavior(), FastMap< S, T >::get(), and parentItem_.
Referenced by findDefineBehavior(), and initializeFromScript().
|
protected |
References aggregate_, component_, findItemByRefId(), and parentItem_.
Referenced by findItemByRefId(), and initializeFromScript().
|
inline |
Returns the component as a Aggregate.
References aggregate_, and component_.
Referenced by findArgReader(), isPreemptive(), MissionManager::logStack(), MissionManager::run(), and MissionManager::uninitializeMission().
|
inline |
References breakClause_.
|
inline |
Returns the mission component.
References component_.
Referenced by Aggregate::getChild(), Aggregate::getItemByRefId(), Aggregate::initialize(), initializeFromScript(), Instance(), ValueClause::Instance(), ValueClause::ReadReader(), MissionManager::resumeLoadedMission(), MissionManager::run(), Aggregate::run(), run(), MissionStateLogger::SetActive(), OffshoreEnvelope_Test::testRun(), ValueDetect_Test::testRunDelta(), and ValueDetect_Test::testRunNoDelta().
|
inline |
|
inline |
References preemptiveClause_.
|
inline |
|
inline |
|
inline |
References startTime_.
Referenced by ValueClause::evalSide().
|
inline |
References tablePos_.
|
inline |
Returns the position within the Aggregate.
References tablePos_.
Referenced by Aggregate::gotoNextItem().
|
inline |
References whenClause_.
Referenced by Aggregate::initialize().
|
inline |
References whileClause_.
| void MissionItem::initialize | ( | void | ) |
References Behavior::BEHAVIOR_ACTIVE, component_, Units::COUNT, Syslog::CRITICAL, Unit::getBaseUnit(), Behavior::getBehaviorState(), DataReader::getDefaultUnit(), Component::getLogger(), Unit::getName(), Component::initialize(), initialized_, isAggregate(), Logger::logComponentRun(), Timestamp::Now(), DataReader::read(), repeatArgReader_, repeatIndex_, repeatLimit_, Units::SECOND, Behavior::setBehaviorState(), Behavior::setTimeout(), startTime_, Logger::syslog(), timedOut_, and timeoutArgReader_.
Referenced by Aggregate::initialize(), MissionManager::run(), Aggregate::run(), run(), and runIfUnsatisfied().
|
protected |
References Behavior::addArgWriter(), Behavior::addValueClause(), aggregate_, BehaviorRegistryEntry::behaviorCreator_, breakClause_, component_, Syslog::CRITICAL, Syslog::ERROR, ValueClause::eval(), BehaviorRegistry::Find(), findArgReader(), findDefineBehavior(), findItemByRefId(), Behavior::findSettingReader(), MissionManager::FindTopNode(), MissionNode::getAttribute(), ElementURI::getBinaryType(), ElementURI::getBlobType(), getComponent(), ValueClause::getDataValue(), MissionNode::getFirstChild(), MissionNode::getName(), Component::getName(), MissionNode::getNextSibling(), DataAccessor::getOwner(), SettingReader::getSettingURI(), MissionNode::holdNode(), ignoreWhenWhile_, Syslog::INFO, Assign::Instance(), SendDataComponent::Instance(), SyslogComponent::Instance(), Instance(), ReadDataComponent::Instance(), DefineBehavior::Instance(), ValueClause::Instance(), interpretRepeat(), interpretRunIn(), isAggregate(), isParallel(), isSequence(), MissionManager::LoadRootNode(), MissionManager::LogMission(), BehaviorRegistryEntry::module_, MULTIVALUE, Slate::NewWriter(), node_, NOT_BLOB, parallel_, parentItem_, preemptiveClause_, putDefineBehavior(), sequence_, MissionNode::setAttribute(), Timespan::setDuration(), Behavior::setTimeout(), ValueClause::StripPastColon(), ValueClause::StripPastLastDot(), Logger::syslog(), tablePos_, timeoutArgReader_, timeoutItem_, DataValue::toString(), ValueClause::toString(), whenClause_, and whileClause_.
Referenced by Instance().
|
static |
Returns an instance, or NULL if an instance can't be returned.
References component_, Syslog::CRITICAL, getComponent(), Component::getLogger(), initializeFromScript(), MissionItem(), and Logger::syslog().
Referenced by initializeFromScript(), MissionManager::missionFromFile(), OffshoreEnvelope_Test::testRun(), ValueDetect_Test::testRunDelta(), and ValueDetect_Test::testRunNoDelta().
|
protected |
References Syslog::CRITICAL, findArgReader(), MissionNode::getAttribute(), repeatArgReader_, repeatLimit_, and Logger::syslog().
Referenced by initializeFromScript(), and interpretRunIn().
|
protected |
References MissionNode::getFirstChild(), MissionNode::getName(), MissionNode::getNextSibling(), interpretRepeat(), parallel_, and sequence_.
Referenced by initializeFromScript().
| bool MissionItem::isActive | ( | MissionItem * | activeItem | ) |
References Behavior::BEHAVIOR_ACTIVE, breakClause_, callCount_, component_, Behavior::getBehaviorState(), isSequence(), ValueClause::test(), whenClause_, and whileClause_.
Referenced by Aggregate::containsPreemptive(), Aggregate::logStack(), and Aggregate::run().
|
inline |
Indicates if the mission component is an aggreate behavior.
References aggregate_.
Referenced by findArgReader(), initialize(), initializeFromScript(), isCompletable(), MissionManager::resumeLoadedMission(), runIfUnsatisfied(), and satisfied().
|
inline |
Indicates if the mission component is a command.
References isAggregate(), isParallel(), and isSequence().
|
inline |
References initialized_.
Referenced by Aggregate::initialize(), MissionManager::run(), and Aggregate::run().
|
inline |
Indicates if the item runs in parallel.
References parallel_.
Referenced by initializeFromScript(), isCompletable(), and Aggregate::run().
| bool MissionItem::isPreemptive | ( | ) |
References Aggregate::containsPreemptive(), getAggregate(), preemptiveClause_, and ValueClause::test().
Referenced by Aggregate::containsPreemptive(), Aggregate::logStack(), and Aggregate::run().
|
inline |
Indicates if the item runs in sequence.
References sequence_.
Referenced by Aggregate::initialize(), initializeFromScript(), isActive(), isCompletable(), and Aggregate::run().
|
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().
|
protected |
References defineBehaviors_, and FastMap< S, T >::put().
Referenced by initializeFromScript().
| void MissionItem::removeCall | ( | ) |
References Behavior::BEHAVIOR_CALLED, Behavior::BEHAVIOR_INACTIVE, callCount_, component_, Behavior::getBehaviorState(), and Behavior::setBehaviorState().
Referenced by Aggregate::uninitialize().
| void MissionItem::run | ( | void | ) |
References Behavior::BEHAVIOR_ACTIVE, component_, Timestamp::elapsed(), Component::execute(), Behavior::getBehaviorState(), getComponent(), Component::getLogger(), Behavior::getTimeout(), initialize(), Timespan::INVALID_TIMESPAN, Logger::logComponentRun(), preempted_, DataReader::read(), repeatIndex_, run(), Units::SECOND, setTimedOut(), Behavior::setTimeout(), startTime_, timedOut_, timeoutArgReader_, and timeoutItem_.
Referenced by Aggregate::run(), and run().
| bool MissionItem::runIfUnsatisfied | ( | void | ) |
References Behavior::BEHAVIOR_ACTIVE, component_, Timestamp::elapsed(), Component::execute(), Behavior::executeIfUnsatisfied(), Behavior::getBehaviorState(), Behavior::getTimeout(), initialize(), Timespan::INVALID_TIMESPAN, isAggregate(), Behavior::isCompleted(), DataReader::read(), runIfUnsatisfied(), satisfied(), Units::SECOND, setTimedOut(), Behavior::setTimeout(), startTime_, timedOut_, timeoutArgReader_, and timeoutItem_.
Referenced by MissionManager::run(), Aggregate::run(), and runIfUnsatisfied().
| bool MissionItem::satisfied | ( | ) |
References Behavior::BEHAVIOR_ACTIVE, Behavior::BEHAVIOR_CALLED, Behavior::BEHAVIOR_COMPLETED, Behavior::BEHAVIOR_INACTIVE, Behavior::BEHAVIOR_TIMEOUT, component_, Timestamp::elapsed(), Behavior::getBehaviorState(), Behavior::getTimeout(), Timespan::INVALID_TIMESPAN, isAggregate(), satisfied(), Component::satisfied(), setTimedOut(), startTime_, timedOut_, and timeoutItem_.
Referenced by Aggregate::run(), runIfUnsatisfied(), and satisfied().
|
private |
|
inline |
Sets the mission component.
References component_.
Referenced by Assign::Instance(), SyslogComponent::Instance(), SendDataComponent::Instance(), and ReadDataComponent::Instance().
|
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().
|
inline |
Tell the item to run in sequence.
References sequence_.
|
private |
References Behavior::BEHAVIOR_TIMEOUT, component_, Behavior::getBehaviorState(), Component::getLogger(), Syslog::INFO, Behavior::setBehaviorState(), startTime_, Logger::syslog(), timedOut_, and Timestamp::toString().
Referenced by run(), runIfUnsatisfied(), and satisfied().
| void MissionItem::uninitialize | ( | void | ) |
References Behavior::BEHAVIOR_INACTIVE, callCount_, component_, Behavior::getBehaviorState(), Component::getLogger(), initialized_, Logger::logComponentRun(), Behavior::setBehaviorState(), and Component::uninitialize().
Referenced by MissionManager::run(), Aggregate::run(), and MissionManager::uninitializeMission().
|
protected |
Aggregate item?
Referenced by findItemByRefId(), getAggregate(), initializeFromScript(), and isAggregate().
|
protected |
Boolean BREAK clause.
Referenced by getBreakClause(), initializeFromScript(), isActive(), and ~MissionItem().
|
protected |
Number of calls to this item.
Referenced by addCall(), isActive(), removeCall(), and uninitialize().
|
protected |
Single item.
Referenced by addCall(), findItemByRefId(), getAggregate(), getComponent(), initialize(), initializeFromScript(), Instance(), isActive(), preempted(), removeCall(), run(), runIfUnsatisfied(), satisfied(), setComponent(), setRepeatIndex(), setTimedOut(), uninitialize(), and ~MissionItem().
|
protected |
Map of DefineBehavior instances.
Referenced by findDefineBehavior(), putDefineBehavior(), and ~MissionItem().
|
protected |
If true, this is a called item, so the when clause is ignored.
Referenced by initializeFromScript().
|
protected |
Flag used by parent aggregates.
Referenced by initialize(), isInitialized(), and uninitialize().
|
protected |
Used only while reading mission from XML. Do not use later!
Referenced by initializeFromScript().
|
protected |
Indicates if missionComponent should be run all the time.
Referenced by initializeFromScript(), interpretRunIn(), isParallel(), and setParallel().
|
protected |
Parent MissionItem.
Referenced by findDefineBehavior(), findItemByRefId(), getParent(), and initializeFromScript().
|
protected |
True if the item is currently preempted.
Referenced by preempted(), and run().
|
protected |
Indicates that the clause is preemptive.
Referenced by getPreemptiveClause(), initializeFromScript(), isPreemptive(), and ~MissionItem().
|
protected |
Reads timeout argument at timeout init time.
Referenced by initialize(), and interpretRepeat().
|
protected |
Number of Times repeated so far.
Referenced by getRepeatIndex(), initialize(), run(), and setRepeatIndex().
|
protected |
Number of Times to repeat this item.
Referenced by getRepeatLimit(), initialize(), and interpretRepeat().
|
protected |
Indicates if missionComponent should be run sequentially.
Referenced by initializeFromScript(), interpretRunIn(), isSequence(), and setSequence().
|
protected |
Keeps track of how long we've been running.
Referenced by addCall(), getStartTime(), initialize(), run(), runIfUnsatisfied(), satisfied(), and setTimedOut().
|
protected |
Position within the Aggregate.
Referenced by getTablePos(), getTablePosition(), and initializeFromScript().
|
protected |
True if time since startTime exceed timeout.
Referenced by addCall(), initialize(), isTimedOut(), run(), runIfUnsatisfied(), satisfied(), and setTimedOut().
|
protected |
Reads timeout argument at timeout init time.
Referenced by initialize(), initializeFromScript(), run(), and runIfUnsatisfied().
|
protected |
Aggregate commands to execute in the case of a timeout. Can be empty.
Referenced by initializeFromScript(), run(), runIfUnsatisfied(), satisfied(), and ~MissionItem().
|
protected |
Boolean WHEN clauses.
Referenced by getWhenClause(), initializeFromScript(), isActive(), and ~MissionItem().
|
protected |
Boolean WHILE clause.
Referenced by getWhileClause(), initializeFromScript(), isActive(), and ~MissionItem().