CARMA C++
carma::monitor::SubsystemFrameBuffer Class Reference

Frame containing monitor points for a monitor subsystem, and mapped to an IPQ - essentially a SubsystemFrameQueue. More...

#include <carma/monitor/SubsystemFrameBuffer.h>

Inheritance diagram for carma::monitor::SubsystemFrameBuffer:
carma::monitor::SubsystemFrame

Public Member Functions

bool isComplete () const
 Returns true if numCleanSamples_ == 0. More...
 
bool isDirty () const
 Returns true if local copy contains data that differs from data in IPQ - in other words, data in local copy has been modifed, and a write to IPQ hasnt happened yet. More...
 
unsigned int read ()
 
bool readNewest ()
 
bool readNewestConditionalCopy ()
 
void write (bool force=false)
 
virtual WriteStatus writeSampleValue (const tagIDType tagID, const MonitorPointSample &value)
 Writes specified sample value 'value' into this subsystem frame as sample with sample number 'iSample' for the monitor point specified by 'tagID'. More...
 
virtual WriteStatus writeSampleValue (const int index, const MonitorPointSample &value)
 Writes specified sample value 'value' into this subsystem frame as sample with sample number 'iSample' for the monitor point at index 'index' in the monitorHeaders array. More...
 
 ~SubsystemFrameBuffer ()
 Destructor. More...
 
- Public Member Functions inherited from carma::monitor::SubsystemFrame
void allocateMonitorPoints (const AllocMpInfo *infos, size_t infosCount, bool markMpsAsModified=true)
 method to allocate space within the subsystem frame for a monitor point and its samples. More...
 
void clearAllTimes ()
 Resets lastWriteTime, scriberWriteTime, publishTime and receiveTime to 0. More...
 
void clearPublished ()
 Clears status flag to indicate that this frame is not published. More...
 
void clearReceived ()
 Clears status flag to indicate that this frame has not been received. More...
 
void consolidateSamples ()
 Consolidates storage in the array of monitor samples. More...
 
long countNumSingleSamplePoints () const
 Counts number of single sample monitor points in this subsystem frame. More...
 
long getFrameCount () const
 Gets the frame's timestamp. More...
 
MonitorPointHeader getHeaderByIndex (int index) const
 Returns maximum number of monitor samples this subsystem frame can accommodate. More...
 
MonitorPointHeader getHeaderByTagID (const tagIDType tagID) const
 Returns MonitorPointHeader object corresponding to the monitor point with the specified tagID. More...
 
unsigned int getHighwaterNumMonitorSamples (MonitorValueType type)
 Get highwater number of monitor samples. More...
 
int getIndex (const tagIDType tagID) const
 Returns index of monitor point header corresponding to the specified tagID, in monitor header array in this subsystem frame. More...
 
double getLastWriterDelay () const
 Returns the delay used by the last client to write to the associated frame scriber publisher process. More...
 
double getLastWriteTime () const
 Gets the time of the last client write to the associated frame scriber publisher process. More...
 
long getMaxNumMonitorPoints () const
 Returns maximum number of monitor points this subsystem frame can accommodate. More...
 
long getMaxNumSamples () const
 Returns maximum number of monitor samples this subsystem frame can accommodate. More...
 
int getNumActualSamples () const
 Returns number of monitor samples for this subsystem frame. More...
 
long getNumMonitorPoints () const
 Returns allocated number of monitor points - in other words, the actual number of monitor points present in this subsystem frame. More...
 
long getNumMonitorPoints (MonitorValueType type) const
 Returns allocated number of monitor points of type == 'type' - in other words, the actual number of monitor points of type 'type' present in this subsystem frame. More...
 
long getNumMonitorSamples (MonitorValueType type) const
 Returns allocated number of monitor samples of type == 'type' - in other words, the actual number of monitor samples of type 'type' present in this subsystem frame. More...
 
long getNumMonitorSamples () const
 Returns total allocated number of monitor samples in this subsystem frame. More...
 
ushort getNumSamplesPerCycle (const tagIDType tagID) const
 Returns number of samples per cycle (0.5*sampling rate) associated with the monitor point with tagID == 'tagID'. More...
 
ushort getNumSamplesPerCycle (const int index) const
 Returns number of samples per cycle (0.5*sampling rate) associated with the monitor point at index == 'index' in the monitorHeaders array in this subsystem frame. More...
 
long getNumSingleSamplePoints () const
 Returns total allocated number of monitor points with one sample per cycle, a sampling rate of 2 Hz. More...
 
double getPublishTime () const
 Returns the time when this subsystem frame was published to the ACC. More...
 
double getReceiveTime () const
 Returns the time when this subsystem frame was received at the ACC. More...
 
const MonitorPointSample getSampleAverage (const tagIDType tagID) const
 Returns average of all samples in current cycle as a MonitorPointSample object. More...
 
const MonitorPointSample getSampleAverage (const int index) const
 Returns average of all samples in current cycle as a MonitorPointSample object. More...
 
MonitorPointSample getSampleValue (const tagIDType tagID, ushort iSample) const
 Returns requested monitor sample as a MonitorPointSample object. More...
 
MonitorPointSample getSampleValue (const int index, ushort iSample) const
 Returns requested monitor sample as a MonitorPointSample object. More...
 
double getScriberWriteDelay () const
 Returns the delay used by the scriber part of the frameScriberPublisher to write to the associated IPQ in the subsystem. More...
 
double getScriberWriteTime () const
 Gets the time of the last scriber write to the associated subsystem IPQ. More...
 
uchar getStatusFlags () const
 Returns status flags for subsystem frame. More...
 
const SubsystemDataPointers & getSubsystemDataPointers () const
 
const SubsystemHeadergetSubsystemHeader () const
 Returns reference to internal structure. More...
 
ushort getSubsystemID () const
 Returns subsystemID of this subsystem frame. More...
 
tagIDType getTagID (const int index) const
 Returns tagID of the monitor point with header at index "index" in the monitorHeaders array in this subsystem frame. More...
 
MonitorValueType getValueType (const tagIDType tagID) const
 Returns type of sample value associated with the monitor point specified by tagID. More...
 
MonitorValueType getValueType (const int index) const
 Returns type of sample value associated with the monitor point specified by index. More...
 
bool isCurrentFrame () const
 Method returns true if frame's timestamp is current; false otherwise. More...
 
bool isPublished () const
 True if this subsystem frame has been published. More...
 
bool isValid (const tagIDType tagID) const
 True if tagID is that of a valid monitor point within this subsystem frame. More...
 
void markFramePublished ()
 Convenience method that sets the publish time and sets the status flag to indicate that the frame was published. More...
 
void markFrameReceived ()
 Convenience method that sets the recive time and sets the status flag to indicate that the frame was received. More...
 
bool received () const
 True if this subsystem frame has been received by the frame collator (in the ACC). More...
 
long setFrameCount (const long frameCount)
 Sets the frame's timestamp. More...
 
void setLastWriterDelay (double time)
 Sets the delay used by the last client to write to the associated frame scriber publisher process. More...
 
void setLastWriteTime (double mjdTimestamp)
 Sets the time of the last client write to the associated frame scriber publisher process. More...
 
void setLastWriteTime ()
 
void setNumActualSamples (ushort numSamples)
 Sets number of actual monitor samples for this subsystem frame. More...
 
void setNumMonitorPoints (ushort numMonitorPoints)
 Sets number of monitor points for this subsystem frame. More...
 
void setNumMonitorSamples (ushort numSamples)
 Sets number of monitor samples for this subsystem frame. More...
 
void setNumSamplesPerCycle (int index, const ushort samples)
 Sets number of samples per cycle (0.5*sampling rate) associated with the monitor point at index == 'index' in the monitorHeaders array in this subsystem frame. More...
 
void setNumSingleSamplePoints (const long numSingleSamples)
 Sets total allocated number of monitor points with one sample per cycle, a sampling rate of 2 Hz. More...
 
void setPublished ()
 Sets status flag to indicate that this frame is published. More...
 
void setPublishTime (double mjdTimestamp)
 Sets the time when this subsystem frame was published to the ACC. More...
 
void setPublishTime ()
 
void setReceived ()
 Sets status flag to indicate that this frame was received. More...
 
void setReceiveTime (double mjdTimestamp)
 Sets the time when this subsystem frame was received at the ACC. More...
 
void setReceiveTime ()
 
void setScriberWriteDelay (double writeDelay)
 Sets the delay used by the scriber part of the frameScriberPublisher to write to the associated IPQ in the subsystem. More...
 
void setScriberWriteTime (double mjdTimestamp)
 Sets the time of the last scriber write to the associated subsystem IPQ. More...
 
void setScriberWriteTime ()
 
void setStatusFlags (uchar status)
 Sets status flags for subsystem frame. More...
 
void setSubsystemID (ushort subsystemID)
 Sets subsystemID of this subsystem frame. More...
 
 SubsystemFrame (SubsystemHeader &frame, SubsystemDataPointers &dataPointers, bool embeddedInAFullSystem)
 Constructor that constructs around a SubsystemHeader structure. More...
 
void syncSubsystemToNewFrameData ()
 Sets the pointers to the monitor point index array (monitorPointIndex), monitor point header array (monitorHeaders), and the monitor sample array (monitorValues). More...
 
bool validSampleValue (const tagIDType tagID, const MonitorPointSample &value) const
 True if sample is valid - this means that the tagID of the monitor point is valid in this subsystem frame, and the sample index is within the range required by the monitor point's sampling rate. More...
 
void writeFromPointSet (const MonitorSampleValues &samples)
 Takes the sample values from a transported sequence of sample values and fills them into this subsystem frame. More...
 
void writeFromTransportFrame (const TransportSubsystemFrame &transFrame)
 Takes the sample values from a transported subsystem frame and fills them into this subsystem frame. More...
 
void writeToTransport (TransportSubsystemFrame &transFrame)
 Returns a TransportSubsystemFrame filled with monitor sample values from this subsystem frame, ready for transport to the ACC for incorporation into the monitor system object in the ACC. More...
 
virtual ~SubsystemFrame ()
 Destructor. More...
 

Static Public Member Functions

static SubsystemFrameBuffergetSubsystemFrameBuffer (long subsystemID, long maxMonitorPoints, long maxSamples)
 Factory method for producing a SubsystemFrameBuffer object. More...
 
- Static Public Member Functions inherited from carma::monitor::SubsystemFrame
static long computeCurrentFrameTime ()
 Static method used to calculate frame count as number of half-seconds since Januray 1, 2000. More...
 
static long maxNumSamplesIncludingAverages (const long maxMonitorPoints, const long maxSamples)
 Returns number of samples to allocate for the entire subsystem given the maximum number of monitor points and maximum number of monitor samples the subsystem frame has to accommodate. More...
 
static bool mjdIsCurrentFrame (double mjd, double *mjdDelta)
 
static ushort numSamplesToAllocate (const ushort nSamplesPerCycle)
 Returns the number of samples to allocate for a sampling rate specified as number of samples per cycle (a cycle is every half-second). More...
 
static void setFrameSize (SubsystemHeader &frame, SubsystemDataPointers &dataPointers, long maxMonitorPoints, long maxSamples)
 Sets size parameters in the subsystem frame. More...
 
static size_t sizeFrame (long maxMonitorPoints, long maxSamples)
 This method is used to compute the size of a subsystem frame when the the maximum number of monitor points and monitor samples it must accommodate are specified. More...
 
static void syncSubsystemToNewFrameData (SubsystemHeader &frame, SubsystemDataPointers &dataPointers)
 

Static Public Attributes

static const int kDefaultQueueDepth
 
- Static Public Attributes inherited from carma::monitor::SubsystemFrame
static const int MONITOR_POINT_ABSENT = -1
 

Additional Inherited Members

- Protected Member Functions inherited from carma::monitor::SubsystemFrame
ushort allocateSamples (int headerOffset, ushort sampleOffset, ushort nSamplesPerCycle=1)
 Allocates monitor samples in this subsystem frame for a monitor point with header at 'headerOffset', sampleOffset = 'sampleOffset' and samples per cycle == 'nSamplesPerCycle'. More...
 
void clearSamples ()
 Clears all samples in this subsystem frame. More...
 
int findMonitorPoint (const tagIDType tagID) const
 Returns the index to the monitor point header corresponding to specified 'tagID'. More...
 
const MonitorHeader & getMonitorHeaderRefByIndex (int index) const
 
int getNumAllocatedSamples () const
 Returns the number of allocated samples. More...
 
MonitorSampleValuegetSamples () const
 Returns pointer to beginning of monitor sample array in this subsystem frame. More...
 
MonitorHeader & getWritableMonitorHeaderRefByIndex (int index) const
 
void setMonitorPointSet (MonitorPointSet *set)
 Used when subsystem frame is generated from a MonitorPointSet object using the MonitorPointSet::getSubsystemFrame() method. More...
 
 SubsystemFrame (ushort subsystemID, unsigned short numMonitorPoints, unsigned short numSamples, bool leakStorage)
 Constructor that constructs a SubsystemHeader of the appropriate size and then constructs and initializes the SubsystemFrame object. More...
 
void writeSampleValue (const int index, const MonitorSampleValue &value, ushort iSample)
 Writes specified sample value 'value' into this subsystem frame as sample with sample number 'iSample' for the monitor point at index 'index' in the monitorHeaders array. More...
 
- Protected Attributes inherited from carma::monitor::SubsystemFrame
SubsystemDataPointers & dataPointers_
 
SubsystemHeaderframe_
 

Detailed Description

Frame containing monitor points for a monitor subsystem, and mapped to an IPQ - essentially a SubsystemFrameQueue.

A monitor subsystem queue is an IPQ implementation for a shared queue of SubsystemFrames. The depth of the queue is determined by the constant "kDefaultQueueDepth".

read method.

See Also
carma::monitor::SubsystemFrame
carma::util::IPQwriter
carma/monitor/monitorframe.idl
http://www.mmarray.org/project/WP/Monitoring/monitoringDesign.pdf

Definition at line 47 of file SubsystemFrameBuffer.h.

Constructor & Destructor Documentation

carma::monitor::SubsystemFrameBuffer::~SubsystemFrameBuffer ( )

Destructor.

Member Function Documentation

static SubsystemFrameBuffer& carma::monitor::SubsystemFrameBuffer::getSubsystemFrameBuffer ( long  subsystemID,
long  maxMonitorPoints,
long  maxSamples 
)
static

Factory method for producing a SubsystemFrameBuffer object.

Memory is allocated on the heap, so caller is responsible for deleting the returned object after use. All SubsystemFrameBuffer objects with the same subsystemID attach to the same piece of shred memory, and so the last one to write wins.

Parameters
subsystemIDlong numerical ID of monitor subsystem
maxMonitorPointslong maximum # of monitor points the system has to accommodate.
maxSampleslong maximum # of monitor samples the system has to accommodate.
Returns
SubsystemFrameBuffer& reference to SubsystemFrameBuffer created on the heap. Caller has to delete after use.
bool carma::monitor::SubsystemFrameBuffer::isComplete ( ) const

Returns true if numCleanSamples_ == 0.

This means there are no samples with modified values that need to be reflected in the IPQ.

Returns
bool true if no modified values in this frame need to go into shared memory.
bool carma::monitor::SubsystemFrameBuffer::isDirty ( ) const

Returns true if local copy contains data that differs from data in IPQ - in other words, data in local copy has been modifed, and a write to IPQ hasnt happened yet.

Returns
bool true if write is required to synchronize with IPQ.
virtual WriteStatus carma::monitor::SubsystemFrameBuffer::writeSampleValue ( const tagIDType  tagID,
const MonitorPointSample value 
)
virtual

Writes specified sample value 'value' into this subsystem frame as sample with sample number 'iSample' for the monitor point specified by 'tagID'.

Parameters
tagIDconst tagIDType identifier of monitor point
valueconst MonitorPointSample& value to be written
Returns
WriteStatus status of write
virtual WriteStatus carma::monitor::SubsystemFrameBuffer::writeSampleValue ( const int  index,
const MonitorPointSample value 
)
virtual

Writes specified sample value 'value' into this subsystem frame as sample with sample number 'iSample' for the monitor point at index 'index' in the monitorHeaders array.

Parameters
indexconst int index of monitor point header in monitorHeader array in this subsystem frame
valueconst MonitorPointSample& value to be written
Returns
WriteStatus status of write

The documentation for this class was generated from the following file: