CARMA C++
SubsystemFrameBuffer.h
Go to the documentation of this file.
1 #ifndef CARMA_MONITOR_SUBSYSTEMFRAME_BUFFER_H
2 #define CARMA_MONITOR_SUBSYSTEMFRAME_BUFFER_H
3 
15 #include <memory>
16 
18 
19 namespace carma {
20 namespace monitor {
21 
22 class MonitorPointSample;
23 
24 
25 typedef enum {
26  MONITOR_NOT_WRITTEN = -1,
27  MONITOR_WRITTEN_ONCE = 0,
28  MONITOR_WRITTEN_AGAIN = 1
29 } WriteStatus;
30 
31 
48  public:
49 
50  static const int kDefaultQueueDepth;
51 
56 
57  void write (bool force = false) ; // update to shared memeory
58 
59  unsigned int read( );
60  bool readNewest( );
61  bool readNewestConditionalCopy();
62 
78  static SubsystemFrameBuffer &
79  getSubsystemFrameBuffer( long subsystemID,
80  long maxMonitorPoints,
81  long maxSamples );
82 
92  virtual WriteStatus writeSampleValue
93  (const tagIDType tagID, const MonitorPointSample& value);
94 
105  virtual WriteStatus writeSampleValue
106  (const int index, const MonitorPointSample& value);
107 
115  bool isDirty () const ;
116 
124  bool isComplete () const ;
125 
126  private:
127  // No copying
129  SubsystemFrameBuffer & operator=( const SubsystemFrameBuffer & rhs );
130 
136  void clearFrame( );
137 
145  void decrementCleanSamples( );
146 
166  ushort subsystemID,
167  const ::std::string & fname,
168  long maxMonitorPoints,
169  long maxSamples,
170  bool isCreator,
171  int queueDepth );
172 
173  class InternalIpq;
174 
175  ::std::auto_ptr< InternalIpq > ipq_;
176  bool isDirty_;
177  int numCleanSamples_;
178 };
179 
180 
181 } // namespace carma::monitor
182 } // namespace carma
183 
184 
185 #endif
Frame containing monitor points for a monitor subsystem, and mapped to an IPQ - essentially a Subsyst...
Class representing a data sample for a MonitorPoint.
bool isDirty() const
Returns true if local copy contains data that differs from data in IPQ - in other words...
bool isComplete() const
Returns true if numCleanSamples_ == 0.
static SubsystemFrameBuffer & getSubsystemFrameBuffer(long subsystemID, long maxMonitorPoints, long maxSamples)
Factory method for producing a SubsystemFrameBuffer object.
virtual WriteStatus writeSampleValue(const tagIDType tagID, const MonitorPointSample &value)
Writes specified sample value &#39;value&#39; into this subsystem frame as sample with sample number &#39;iSample...
Class wrapper for monitor subsystem frame structure that manages storage for a monitor subsystem fram...
Frame containing monitor points for a monitor subsystem frame.