LRAUV  revA
Aggregate.h
Go to the documentation of this file.
1 
10 #ifndef MISSIONSTACK_H_
11 #define MISSIONSTACK_H_
12 
14 #include "component/Behavior.h"
15 #include "logger/Logger.h"
17 #include "process/PCaller.h"
18 
19 class Assign;
20 class MissionNode;
21 
27 class Aggregate : public Behavior
28 {
29 public:
30 
32  virtual ~Aggregate();
33 
36  static Aggregate* Instance( const Str& name, MissionNode* node, Logger& logger );
37 
39  virtual void initialize();
40 
42  void preempted();
43 
45  virtual void uninitialize();
46 
48  virtual void execute()
49  {
50  run();
51  };
52 
54  bool containsPreemptive();
55 
57  void logStack( int& priority );
58 
60  virtual void run();
61 
63  void setIndex( const int index )
64  {
65  index_ = index;
66  }
67 
68  MissionItem* getItemByRefId( const Str& refId );
69 
70  void setRef( MissionItem* ref )
71  {
72  ref_ = ref;
73  }
74 
76  {
77  return ref_;
78  }
79 
80  // Set output to true if this is a DefineOutput
81  void defineArg( const Str& argName, DataValue* dataValue, bool output );
82 
83  void redefineArg( const Str& argName, ValueClause* valueClause );
84 
85  void setParallel( bool parallel )
86  {
87  this->parallel_ = parallel;
88  }
89 
90  MissionItem* getChild( const Str& childName );
91 
92  void setResumeItem( MissionItem* resumeItem )
93  {
94  resumeItem_ = resumeItem;
95  }
96 
97 protected:
98 
100  void gotoNextItem();
101 
104 
107 
110 
113 
115  int index_;
116 
118  bool parallel_;
119 
122 
125 
127  DataReader* findArgReader( const Str& argName );
128 
131 
132 private:
133  // Note that the copy constructor below is private and not given a body.
134  // Any attempt to call it will return a compiler error.
135  Aggregate( const Aggregate& old ); // disallow copy constructor
136 
137  friend class MissionItem;
138 
140  Aggregate( const Str& name );
141 
143  void push( MissionItem* item );
144 
145 };
146 
147 #endif /*MISSIONSTACK_H_*/
Client-side interface for injecting log data into the log queue.
Definition: Logger.h:30
void defineArg(const Str &argName, DataValue *dataValue, bool output)
Definition: Aggregate.cpp:315
void preempted()
Called when the mission component becomes preempted.
Definition: Aggregate.cpp:125
int nonParallelChildren_
Number of children that are non-parallel.
Definition: Aggregate.h:121
MissionItem * activeItem_
Currently active item.
Definition: Aggregate.h:109
virtual void uninitialize()
Standard component uninit code.
Definition: Aggregate.cpp:138
Wraps a Behavior or Aggregate with mission-specific settings pertaining to that item.
Definition: MissionItem.h:31
Collections of Behaviors (including other Aggregates) that make up a larger Behavior within a mission...
Definition: Aggregate.h:27
bool containsPreemptive()
Returns true if the aggregate contains an active preemptive clause.
Definition: Aggregate.cpp:157
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: DataReader.h:30
void gotoNextItem()
Update activeItem_ with the next behavior in the aggregate.
Definition: Aggregate.cpp:404
MissionItem * getChild(const Str &childName)
Definition: Aggregate.cpp:388
virtual ~Aggregate()
Destructor.
Definition: Aggregate.cpp:19
Contains the MissionItem class declaration.
Contains the ComponentRegistry class declaration.
Behavior is the abstract base class for components that implement mission behaviors and commands...
Definition: Behavior.h:32
FlexArray< Assign * > * redefines_
List of Assign elements used for redefining Args.
Definition: Aggregate.h:130
A DataValue is an abstract base class for a data value and associated engineering units of the value...
Definition: DataValue.h:35
A ValueClause is a set of boolean conditions that may be specified as conditions for executing (or st...
Definition: ValueClause.h:26
static Aggregate * Instance(const Str &name, MissionNode *node, Logger &logger)
Converts table/function at the indicated node to a Aggregate instance.
bool parallel_
Flag for parallel aggregates.
Definition: Aggregate.h:118
MissionItem * resumeItem_
Item to make active when mission is resumed.
Definition: Aggregate.h:112
Contains the Behavior class definition.
MissionItem * getItemByRefId(const Str &refId)
Definition: Aggregate.cpp:297
void setResumeItem(MissionItem *resumeItem)
Definition: Aggregate.h:92
MissionItem * ref_
Alternate "reference" item.
Definition: Aggregate.h:106
FlexArray< MissionItem * > behaviors_
Behavior list.
Definition: Aggregate.h:103
Wraps a TiXmlNode.
Definition: MissionNode.h:20
Replacement for standard template class string.
Definition: Str.h:12
Behavior that is embedded in scripted code within a mission file.
Definition: Assign.h:24
virtual void execute()
Causes a run with no metrics.
Definition: Aggregate.h:48
Aggregate(const Aggregate &old)
void setParallel(bool parallel)
Definition: Aggregate.h:85
void setRef(MissionItem *ref)
Definition: Aggregate.h:70
Contains the Logger class definition.
DataReader * findArgReader(const Str &argName)
Returns the reader for a defined arg.
Definition: Aggregate.cpp:379
void setIndex(const int index)
Sets the index within parent aggregate.
Definition: Aggregate.h:63
Contains the PCaller class declaration.
virtual void initialize()
Standard component init code.
Definition: Aggregate.cpp:32
virtual void run()
The actual "payload" of the component.
Definition: Aggregate.cpp:174
MissionItem * getRef()
Definition: Aggregate.h:75
void push(MissionItem *item)
Adds a MissionItem to the aggregate.
Definition: Aggregate.cpp:451
FastMap< const Str, DataReader * > * argMap_
List of defined args.
Definition: Aggregate.h:124
int index_
Index within parent aggregate.
Definition: Aggregate.h:115
void redefineArg(const Str &argName, ValueClause *valueClause)
Definition: Aggregate.cpp:361
void logStack(int &priority)
Display the currently running stack to Syslog.
Definition: Aggregate.cpp:83