LRAUV  revA
SyncComponent.h
Go to the documentation of this file.
1 
9 #ifndef SYNCCOMPONENT_H_
10 #define SYNCCOMPONENT_H_
11 
12 #include "Component.h"
13 
22 class SyncComponent: public Component
23 {
24 public:
25 
26  friend class ScriptSyncComponent;
27  friend class SyncStarterComponent;
28  friend class SyncSimulatorComponent;
29  friend class SyncSensorComponent;
33  friend class SyncMissionComponent;
34  friend class SyncControlComponent;
36  friend class SyncServoComponent;
37  friend class SyncTestComponent;
38  friend class SyncReporterComponent;
39  friend class SyncLoggerComponent;
40 
42  class CycleOrder
43  {
44  public:
45  CycleOrder( int orderPreference ) :
46  orderPreference_( orderPreference )
47  {
48  }
49  operator int() const
50  {
51  return orderPreference_;
52  }
53  bool operator ==( const CycleOrder& otherPreference ) const
54  {
55  return orderPreference_ == otherPreference.orderPreference_;
56  }
57  bool operator !=( const CycleOrder& otherPreference ) const
58  {
59  return orderPreference_ != otherPreference.orderPreference_;
60  }
61  bool operator <( const CycleOrder& otherPreference ) const
62  {
63  return orderPreference_ < otherPreference.orderPreference_;
64  }
65  private:
67  };
68 
69  static const int CYCLE_INCREMENT;
70  static const int CYCLE_REPEAT_OFFSET;
71 
72  static const CycleOrder CYCLE_STARTER;
74  static const CycleOrder CYCLE_SENSOR;
79  static const CycleOrder CYCLE_MISSION;
80  static const CycleOrder CYCLE_CONTROL;
81  static const CycleOrder CYCLE_SERVO;
82  static const CycleOrder CYCLE_TEST;
83  static const CycleOrder CYCLE_REPORTER;
84  static const CycleOrder CYCLE_LOGGER;
85 
88  {
89  return cycleOrder_;
90  }
91 
92  void setRepeating( bool repeating )
93  {
94  repeating_ = repeating;
95  }
96 
97  int getDivisor( ) const
98  {
99  return divisor_;
100  }
101 
102  int getModulo( ) const
103  {
104  return modulo_;
105  }
106 
107 private:
108 
110  SyncComponent( const Str& name, const Module* module, CycleOrder cycleOrder,
111  int divisor = 1, int modulo = 0 )
112  : Component( name, COMPONENT_SYNC, module ),
113  cycleOrder_( cycleOrder ),
114  repeater_( false ),
115  repeating_( false ),
116  divisor_( divisor ),
117  modulo_( modulo )
118  {}
119 
121  bool repeater_;
123 
124  int divisor_;
125  int modulo_;
126 
127 protected:
128  void setRepeater( bool repeater )
129  {
130  repeater_ = repeater;
131  }
132 
133 public:
134  bool isRepeater()
135  {
136  return repeater_;
137  }
138 
139  bool isRepeating()
140  {
141  return repeating_;
142  }
143 
144 };
145 
150 {
151 protected:
152  SyncStarterComponent( const Str& name, const Module* module )
153  : SyncComponent( name, module, CYCLE_STARTER )
154  {}
155 };
156 
161 {
162 protected:
163  SyncSimulatorComponent( const Str& name, const Module* module,
164  int divisor = 1, int modulo = 0 )
165  : SyncComponent( name, module, CYCLE_SIMULATOR, divisor, modulo )
166  {}
167 };
168 
173 {
174 protected:
175  SyncSensorComponent( const Str& name, const Module* module,
176  int divisor = 1, int modulo = 0 )
177  : SyncComponent( name, module, CYCLE_SENSOR, divisor, modulo )
178  {}
179 };
180 
185 {
186 protected:
187  SyncDerivationComponent( const Str& name, const Module* module,
188  int divisor = 1, int modulo = 0 )
189  : SyncComponent( name, module, CYCLE_DERIVATION, divisor, modulo )
190  {}
191 };
192 
196 {
197 protected:
198  SyncNavigationComponent( const Str& name, const Module* module,
199  int divisor = 1, int modulo = 0 )
200  : SyncComponent( name, module, CYCLE_NAVIGATION, divisor, modulo )
201  {}
202 };
203 
207 {
208 protected:
209  SyncEstimationComponent( const Str& name, const Module* module,
210  int divisor = 1, int modulo = 0 )
211  : SyncComponent( name, module, CYCLE_ESTIMATION, divisor, modulo )
212  {}
213 };
214 
218 {
219 protected:
220  SyncMissionComponent( const Str& name, const Module* module )
221  : SyncComponent( name, module, CYCLE_MISSION )
222  {}
223 };
224 
229 {
230 protected:
231  SyncControlComponent( const Str& name, const Module* module,
232  int divisor = 1, int modulo = 0 )
233  : SyncComponent( name, module, CYCLE_CONTROL, divisor, modulo )
234  {}
235 };
236 
241 {
242 protected:
243  SyncMaintainerComponent( const Str& name, const Module* module,
244  CycleOrder cycleOrder, int divisor = 1, int modulo = 0 )
245  : SyncComponent( name, module, cycleOrder, divisor, modulo )
246  {}
247 };
248 
253 {
254 protected:
255  SyncServoComponent( const Str& name, const Module* module,
256  int divisor = 1, int modulo = 0 )
257  : SyncComponent( name, module, CYCLE_SERVO, divisor, modulo )
258  {}
259 };
260 
265 {
266 protected:
267  SyncTestComponent( const Str& name, const Module* module,
268  int divisor = 1, int modulo = 0 )
269  : SyncComponent( name, module, CYCLE_TEST, divisor, modulo )
270  {}
271 };
272 
277 {
278 protected:
279  SyncReporterComponent( const Str& name, const Module* module,
280  int divisor = 1, int modulo = 0 )
281  : SyncComponent( name, module, CYCLE_REPORTER, divisor, modulo )
282  {}
283 };
284 
289 {
290 protected:
291  SyncLoggerComponent( const Str& name, const Module* module )
292  : SyncComponent( name, module, CYCLE_LOGGER )
293  {}
294 };
295 
299 
300 
301 #endif /* SYNCCOMPONENT_H_ */
CycleOrder(int orderPreference)
Definition: SyncComponent.h:45
static const CycleOrder CYCLE_MISSION_MANAGER
Definition: SyncComponent.h:78
static const CycleOrder CYCLE_REPORTER
Definition: SyncComponent.h:83
SyncTestComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:267
Abstract Base class for components that run in the end of the computation cycle, doing logging...
Definition: SyncComponent.h:288
void setRepeating(bool repeating)
Definition: SyncComponent.h:92
bool operator==(const CycleOrder &otherPreference) const
Definition: SyncComponent.h:53
Abstract Base class for components that collect data for use later in the computation cycle...
Definition: SyncComponent.h:172
static const CycleOrder CYCLE_SENSOR
Definition: SyncComponent.h:74
static const CycleOrder CYCLE_MISSION
Definition: SyncComponent.h:79
SyncLoggerComponent(const Str &name, const Module *module)
Definition: SyncComponent.h:291
Abstract Base class for components that run in the start of the computation cycle.
Definition: SyncComponent.h:149
Abstract Base class for components that run towards the start of the computation cycle, simulating sensor inputs since the last cycle.
Definition: SyncComponent.h:160
static const int CYCLE_INCREMENT
Definition: SyncComponent.h:69
static const CycleOrder CYCLE_LOGGER
Definition: SyncComponent.h:84
Scripted software components that run in the computation cycle.
Definition: ScriptComponent.h:151
FlexArray< SyncComponent * > ListOfSyncComponents
Define a type for a "list of component pointers".
Definition: SyncComponent.h:298
void setRepeater(bool repeater)
Definition: SyncComponent.h:128
SyncComponent(const Str &name, const Module *module, CycleOrder cycleOrder, int divisor=1, int modulo=0)
Private constructor available only to Friend classes.
Definition: SyncComponent.h:110
SyncSimulatorComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:163
Contains the Component class definition.
static const CycleOrder CYCLE_SIMULATOR
Definition: SyncComponent.h:73
bool repeating_
Definition: SyncComponent.h:122
static const CycleOrder CYCLE_TEST
Definition: SyncComponent.h:82
int orderPreference_
Definition: SyncComponent.h:66
int modulo_
Definition: SyncComponent.h:125
bool repeater_
Definition: SyncComponent.h:121
SyncEstimationComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:209
bool isRepeating()
Definition: SyncComponent.h:139
SyncMissionComponent(const Str &name, const Module *module)
Definition: SyncComponent.h:220
int getDivisor() const
Definition: SyncComponent.h:97
SyncReporterComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:279
bool isRepeater()
Definition: SyncComponent.h:134
SyncControlComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:231
Abstract Base class for software components that run in the computation cycle.
Definition: SyncComponent.h:22
These are enumerated to simplify sorting and ordering.
Definition: SyncComponent.h:42
Abstract Base class for components that run towards the end of the computation cycle, evaluating how well everything performed.
Definition: SyncComponent.h:264
Module is the abstract base class for a collection of Component objects that can be contained in a lo...
Definition: Module.h:45
SyncSensorComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:175
Replacement for standard template class string.
Definition: Str.h:12
SyncStarterComponent(const Str &name, const Module *module)
Definition: SyncComponent.h:152
static const CycleOrder CYCLE_CONTROL
Definition: SyncComponent.h:80
Abstract Base class for components that generate navigation estimates.
Definition: SyncComponent.h:195
Abstract Base class for software components.
Definition: Component.h:53
static const CycleOrder CYCLE_SERVO
Definition: SyncComponent.h:81
static const CycleOrder CYCLE_DERIVATION
Definition: SyncComponent.h:75
static const CycleOrder CYCLE_ESTIMATION
Definition: SyncComponent.h:76
Abstract Base class for components that run after sensors, deriving other measurements.
Definition: SyncComponent.h:184
Definition: Component.h:112
SyncDerivationComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:187
Abstract Base class for components that run before the servos allowing command-line overrides of guid...
Definition: SyncComponent.h:240
Abstract Base class for components that manage mission components.
Definition: SyncComponent.h:217
Abstract Base class for components that compute settings to be communicated to SyncServoComponent ins...
Definition: SyncComponent.h:228
static const CycleOrder CYCLE_STARTER
Definition: SyncComponent.h:72
bool operator<(const CycleOrder &otherPreference) const
Definition: SyncComponent.h:61
Abstract Base class for components that run towards the end of the computation cycle, communicating with controllers.
Definition: SyncComponent.h:252
SyncServoComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:255
CycleOrder cycleOrder_
Definition: SyncComponent.h:120
int getModulo() const
Definition: SyncComponent.h:102
static const int CYCLE_REPEAT_OFFSET
Definition: SyncComponent.h:70
int divisor_
Definition: SyncComponent.h:124
SyncMaintainerComponent(const Str &name, const Module *module, CycleOrder cycleOrder, int divisor=1, int modulo=0)
Definition: SyncComponent.h:243
static const CycleOrder CYCLE_NAVIGATION
Definition: SyncComponent.h:77
Abstract Base class for components that generate other estimates.
Definition: SyncComponent.h:206
SyncNavigationComponent(const Str &name, const Module *module, int divisor=1, int modulo=0)
Definition: SyncComponent.h:198
Abstract Base class for components that run in the end of the computation cycle, doing logging...
Definition: SyncComponent.h:276
CycleOrder getCycleOrder(void)
Getter function for controlThreadOrderPreference.
Definition: SyncComponent.h:87
bool operator!=(const CycleOrder &otherPreference) const
Definition: SyncComponent.h:57