1 #ifndef CARMA_MONITOR_SYSTEMFRAME_H
2 #define CARMA_MONITOR_SYSTEMFRAME_H
18 #include "carma/util/PthreadRWLock.h"
24 struct TransportSubsystemFrame;
25 struct SubsystemHeader;
26 struct SubsystemDataPointers;
88 ::std::auto_ptr< SubsystemFrame >
100 ::std::auto_ptr< SubsystemFrame >
111 bool isCurrent (
unsigned short subsystemID)
const ;
321 long ssMaxMonitorPoints,
329 static size_t getSystemHeaderSizeInBytes( );
331 size_t getSystemTotalSizeInBytes( )
const;
334 static const int SUBSYSTEM_FRAME_ABSENT;
342 long maxMonitorPoints,
345 SystemHeader & getSystemFrameDataHoldingWriteLock( );
346 const SystemHeader & getSystemFrameDataHoldingLock( )
const;
348 ::std::auto_ptr< SubsystemFrame >
349 makeSubsystemFrameForIndexHoldingLock(
int index )
const;
352 allocateSubsystemHoldingWriteLock(
unsigned short subsystemID,
353 long ssMaxMonitorPoints,
356 bool checkIsCurrentFrameHoldingLock(
double * mjdDelta )
const;
385 class SsDataPointersManager;
398 getSubsystemFrameStructHoldingLock(
int index )
const;
411 void indexInsertKeyHoldingWriteLock(
unsigned short subsystemID,
423 size_t getNextFreeSubsystemFrameHoldingLock( );
425 static size_t getSystemFrameStorageSizeInBytes(
long maxSubsystems,
426 long maxMonitorPoints,
430 const long maxSubsystems_;
431 const long maxMonitorPoints_;
432 const long maxSamples_;
433 const size_t frameStorageSizeInBytes_;
437 const int * frameDataSsIndexArray_;
438 const size_t * frameDataSsDataOffsetArray_;
441 void * frameStorage_;
443 int * writableFrameDataSsIndexArray_;
444 size_t * writableFrameDataSsDataOffsetArray_;
446 SsDataPointersManager * ssDataPointersManager_;
448 int numCleanSubsystemFrames_;
449 size_t nextFreeSubsystemFrame_;
int getSubsystemIndexHoldingLock(unsigned short subsystemID) const
Given the subsystemID, returns the index of the subsystem in the subsystemFrameOffset array...
void resetNumCleanFrames()
Sets numCleanSubsystemnFrames_ to getNumSubsystemFrames().
long setFrameCount(const long frameCount)
Sets timestamp for SystemHeader as frameCount.
long getFrameCount() const
Returns timestamp for SystemHeader as frameCount.
A simple wrapper class that makes use of ::pthread_rwlock_t easier in a C++ world.
void setRawReadTime(double mjdTimestamp)
Sets the time of the last read from the associated RawCarmaMonitorSystem.
double getCollatorWriteTime() const
Gets the time of the last collator write to the associated system IPQ.
::std::auto_ptr< SubsystemFrame > makeSubsystemFrame(unsigned short subsystemID) const
Returns a SubsystemFrame object wrapped around an internally stored SubsystemHeader structure contain...
SystemFrame(long maxSubsystems, long maxMonitorPoints, long maxSamples)
Constructs a SystemFrame instance.
void setFinalWriteTime(double mjdTimestamp)
Sets the time of the last write to the associated CarmaMonitorSystem.
::std::auto_ptr< SubsystemFrame > makeSubsystemFrameForIndex(int index) const
Returns newly created SubsystemFrame object given the index to the subsystem in the subsystemFrameOff...
long getMaxNumSubsystemFrames() const
Size information - returns maximum number of subsystems this SystemFrame can accommodate.
Contains sample values from all monitor points in a monitor subsystem.
void syncSystemAndSubsystemsToNewFrameDataHoldingWriteLock()
Sets the pointers to the subsystem index array (subsystemIndex) and the subsystem offset array (subsy...
unsigned char getStatusFlags() const
Returns status flags for system frame.
bool isCurrent(unsigned short subsystemID) const
True if subsystem with subsystemID has frameCount == this->getFrameCount().
long getMaxTotalMonitorPoints() const
Size information - returns maximum cumulative number of monitor points across all subsystems that thi...
double getCollatorWriteDelay() const
Returns the delay used by the writer part of the frameCollator to write to the associated IPQ in the ...
double getFinalWriteTime() const
Gets the time of the last write to the associated CarmaMonitorSystem.
double getRawReadTime() const
Gets the time of the last read from the associated RawCarmaMonitorSystem.
virtual ~SystemFrame()
Destructor.
void writeSubsystemFrame(const TransportSubsystemFrame &subsystemFrame)
Writes transported sample values into subsystem frame given all sample values assciated with the subs...
void setNumSubsystemFrames(unsigned short numSubsystems)
Size information - Sets number of allocated subsystems in this SystemFrame.
void setCollatorWriteTime(double mjdTimestamp)
Sets the time of the last collator write to the associated system IPQ.
Frame containing monitor points for all monitor subsystems.
void clearAllTimes()
Clears all times - collator time, raw read time and final write time.
long getMaxTotalSamples() const
Size information - returns cumulative maximum number of monitor samples, across all subsystems...
long getNumSubsystemFrames() const
Size information - returns number of allocated subsystems in this SystemFrame.
bool subsystemFrameIsWritten(unsigned short subsystemID) const
Returns true if subsystem frame corresponding to 'subsystemID' was written to its IPQ even once...
void setStatusFlags(unsigned char flags)
Sets status flags for system frame.
int allocateSubsystemFrame(unsigned short subsystemID, long ssMaxMonitorPoints, long ssMaxSamples)
method to allocate space within the system frame for a subsystem frame, its monitor points and its sa...
bool isCurrentFrame() const
Method returns true if frame's timestamp is current; false otherwise.
bool isComplete() const
True if getNumCleanFrames() == 0.
void setCollatorWriteDelay(double writeDelay)
Writes the value of the delay used by the writer part of the frameCollator * to write to the associat...