LRAUV  revA
DataEntry.h
Go to the documentation of this file.
1 
10 #ifndef DATAENTRY_H_
11 #define DATAENTRY_H_
12 
13 #include "data/DataElement.h"
14 
15 #include "LogEntry.h"
16 
17 class RingBufferVoid;
18 
43 class DataEntry : public LogEntry
44 {
45 public:
46 
48  typedef enum
49  {
50  NOT_BEST = 0x0000, // 0 Timestamp -- start of cycle
51  IS_BEST = 0x0004 // 1 action(2b)&actor(12b), Timespan, Element, Accuracy
52  } Best;
53 
55  static const int BEST_MASK = 0x0004;
56 
58  DataEntry( DataAccessor* dataAccessor, const bool best, const bool changed );
59 
61  DataEntry( const DataEntry* dataEntry );
62 
64  DataEntry( DataAccess* access, DataValue* dataValue, const Timestamp& timestamp, const bool best, const bool changed );
65 
67  virtual ~DataEntry();
68 
70  void* operator new( size_t size );
71 
73  void operator delete( void* p );
74 
75  DataAccess* getDataAccess( void ) const
76  {
77  return dataAccess_;
78  }
79 
80  void setDataAccess( DataAccess* dataAccess )
81  {
82  dataAccess_ = dataAccess;
83  }
84 
85  DataValue* getDataValue( void ) const
86  {
87  return dataValue_;
88  }
89 
90  bool isBest() const
91  {
92  return best_;
93  }
94 
95  bool isDataWrite() const;
96 
102  static DataEntry* Read( Timestamp& timeBase, InStream &inStream, unsigned short firstWord, Logger& logger );
103 
109  virtual unsigned int write( Timestamp& timeBase, OutStream& logStream ) const;
110 
111  virtual Str toString( const Unit* unit = NULL ) const;
112 
113  virtual const Str getDataValueString( const Unit* unit = NULL, bool hideUnits = false ) const;
114 
115 protected:
116 
119  bool best_;
120  bool changed_;
121 
124 
127  {
128  public:
130  };
131 
134 
135 private:
136  // Note that the copy constructor below is private and not given a body.
137  // Any attempt to call it will return a compiler error.
138  DataEntry( const DataEntry& old ); // disallow copy constructor
139 
140 };
141 
142 #endif /*DATAENTRY_H_*/
Client-side interface for injecting log data into the log queue.
Definition: Logger.h:30
~StaticDestructor()
Definition: DataEntry.cpp:22
Serializable representation of DataAccessor object.
Definition: DataAccess.h:30
void setDataAccess(DataAccess *dataAccess)
Definition: DataEntry.h:80
Definition: DataEntry.h:50
Best
Type of event.
Definition: DataEntry.h:48
Definition: DataEntry.h:51
DataAccess * getDataAccess(void) const
Definition: DataEntry.h:75
static DataEntry::StaticDestructor StaticDestructor_
Static instance of StaticDestructor.
Definition: DataEntry.h:133
A DataValue is an abstract base class for a data value and associated engineering units of the value...
Definition: DataValue.h:35
This is a very abstract class that can be implemented by classes that want to receive stream input...
Definition: InStream.h:29
One "entry" in a LogQueue.
Definition: LogEntry.h:33
Contains the DataElement class definition.
bool changed_
Definition: DataEntry.h:120
DataValue * getDataValue(void) const
Definition: DataEntry.h:85
bool isBest() const
Definition: DataEntry.h:90
Contains the LogEntry class definition.
Code unit that represents an atomic unit of data destined for writing in the log file.
Definition: DataEntry.h:43
static DataEntry * Read(Timestamp &timeBase, InStream &inStream, unsigned short firstWord, Logger &logger)
Read new DataEntry from a stream.
Definition: DataEntry.cpp:108
static RingBufferVoid * MallocRing_
Declared as a pointer to avoid including RingBuffer.h header here.
Definition: DataEntry.h:123
Abstact base class of all elements which can write to, or read from the slate.
Definition: DataAccessor.h:29
Replacement for standard template class string.
Definition: Str.h:12
virtual unsigned int write(Timestamp &timeBase, OutStream &logStream) const
Send payload to a stream.
Definition: DataEntry.cpp:241
bool best_
Definition: DataEntry.h:119
This is a very abstract class that can be implemented by classes that want to send stream output...
Definition: OutStream.h:41
static const int BEST_MASK
Mask for Best values.
Definition: DataEntry.h:55
virtual Str toString(const Unit *unit=NULL) const
Convert payload to Str.
Definition: DataEntry.cpp:265
Thread-safe ring buffer for storing void pointers.
Definition: RingBuffer.h:36
DataEntry(DataAccessor *dataAccessor, const bool best, const bool changed)
Constructor.
Definition: DataEntry.cpp:29
Code that represents an engineering unit.
Definition: Unit.h:24
DataAccess * dataAccess_
Definition: DataEntry.h:117
bool isDataWrite() const
Definition: DataEntry.cpp:317
DataValue * dataValue_
Definition: DataEntry.h:118
Represents absolute times.
Definition: Timestamp.h:31
Makes sure that mallocRing_s is deleted on shutdown.
Definition: DataEntry.h:126
virtual const Str getDataValueString(const Unit *unit=NULL, bool hideUnits=false) const
Definition: DataEntry.cpp:303
virtual ~DataEntry()
Destructor.
Definition: DataEntry.cpp:71