LRAUV  revA
SyslogComponent.h
Go to the documentation of this file.
1 
9 #ifndef SYSLOGCOMPONENT_H_
10 #define SYSLOGCOMPONENT_H_
11 
12 #include "component/Behavior.h"
13 #include "logger/Syslog.h"
14 #include "utils/FlexArray.h"
15 
16 class DataReader;
17 class MissionItem;
18 class MissionNode;
19 class Module;
20 
27 {
28 public:
29  static SyslogComponent* Instance( MissionNode* node, const Str& itemName, MissionItem* parent, const Module* module, Logger& logger );
30  virtual ~SyslogComponent();
31  virtual void initialize();
32  virtual void run();
33  virtual bool runIfUnsatisfied();
34  virtual void uninitialize();
35 
36 protected:
37 
39  SyslogComponent( const Str& name, Syslog::Severity severity );
40 
42  {
45  };
46 
47  class SyslogPart
48  {
49  public:
50  SyslogPart( DataReader* dataReaderPart, const Unit* unit )
52  strPart_( NULL ),
53  dataReaderPart_( dataReaderPart ),
54  unit_( unit )
55  {};
56  SyslogPart( Str* strPart )
58  strPart_( strPart ),
59  dataReaderPart_( NULL ),
60  unit_( NULL )
61  {};
63  {
64  if( NULL != strPart_ )
65  {
66  delete strPart_;
67  }
68  //if ( NULL != dataReaderPart_ )
69  //{
70  // delete dataReaderPart_;
71  //}
72  }
74  {
75  return syslogPartType_;
76  }
78  {
79  return strPart_;
80  }
82  {
83  return dataReaderPart_;
84  }
85  const Unit* getUnit()
86  {
87  return unit_;
88  }
89  private:
90  // Note that the copy constructor below is private and not given a body.
91  // Any attempt to call it will return a compiler error.
92  SyslogPart( const SyslogPart& old ); // disallow copy constructor
93 
97  const Unit* unit_;
98  };
99 
100  void addPart( SyslogPart* syslogPart );
101 
104 
106 
107 private:
108  // Note that the copy constructor below is private and not given a body.
109  // Any attempt to call it will return a compiler error.
110  SyslogComponent( const SyslogComponent& old ); // disallow copy constructor
111 };
112 
113 #endif /* SYSLOGCOMPONENT_H_ */
Client-side interface for injecting log data into the log queue.
Definition: Logger.h:30
void addPart(SyslogPart *syslogPart)
Definition: SyslogComponent.cpp:128
Syslog::Severity severity_
Definition: SyslogComponent.h:105
const Unit * getUnit()
Definition: SyslogComponent.h:85
DataReader * dataReaderPart_
Definition: SyslogComponent.h:96
DataReader * getDataReaderPart()
Definition: SyslogComponent.h:81
Wraps a Behavior or Aggregate with mission-specific settings pertaining to that item.
Definition: MissionItem.h:31
virtual void run()
The actual "payload" of the component.
Definition: SyslogComponent.cpp:138
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: DataReader.h:30
SyslogPartType syslogPartType_
Definition: SyslogComponent.h:94
~SyslogPart()
Definition: SyslogComponent.h:62
SyslogPartType
Definition: SyslogComponent.h:41
Behavior is the abstract base class for components that implement mission behaviors and commands...
Definition: Behavior.h:32
Definition: SyslogComponent.h:47
static SyslogComponent * Instance(MissionNode *node, const Str &itemName, MissionItem *parent, const Module *module, Logger &logger)
Definition: SyslogComponent.cpp:16
Behavior that is embedded in scripted code within a mission file.
Definition: SyslogComponent.h:26
Contains the Syslog class definition.
Contains the FlexArrayBase and FlexArray class declarations.
Contains the Behavior class definition.
FlexArray< SyslogPart * > syslogParts_
The contents of the syslog entry;.
Definition: SyslogComponent.h:103
SyslogPart(DataReader *dataReaderPart, const Unit *unit)
Definition: SyslogComponent.h:50
Module is the abstract base class for a collection of Component objects that can be contained in a lo...
Definition: Module.h:45
virtual void initialize()
Provide a space for initialization before being run.
Definition: SyslogComponent.cpp:133
Wraps a TiXmlNode.
Definition: MissionNode.h:20
Replacement for standard template class string.
Definition: Str.h:12
Definition: SyslogComponent.h:43
virtual void uninitialize()
Provide a space for uninitialization.
Definition: SyslogComponent.cpp:177
Str * getStrPart()
Definition: SyslogComponent.h:77
virtual ~SyslogComponent()
Definition: SyslogComponent.cpp:123
SyslogComponent(const Str &name, Syslog::Severity severity)
Protected constructor.
Definition: SyslogComponent.cpp:182
Definition: SyslogComponent.h:44
SyslogPart(Str *strPart)
Definition: SyslogComponent.h:56
const Unit * unit_
Definition: SyslogComponent.h:97
Simple class providing a flexible size array of pointers.
Definition: DataReader.h:19
Severity
An attempt to define different levels of syslog severity.
Definition: Syslog.h:28
virtual bool runIfUnsatisfied()
Combined run and test Called by mission element: behaviorDone_.
Definition: SyslogComponent.cpp:170
Code that represents an engineering unit.
Definition: Unit.h:24
Str * strPart_
Definition: SyslogComponent.h:95
SyslogPartType getSyslogPartType()
Definition: SyslogComponent.h:73