1 #ifndef CARMA_MONITOR_MONITORPOINT_H
2 #define CARMA_MONITOR_MONITORPOINT_H
28 struct ScratchAverages;
29 class MonitorContainer;
30 class MonitorPointThreshold;
165 MAX_BLANKING_FLAGGING
215 void setUnits(
const std::string& units);
428 const std::string & user,
534 virtual std::string
toStringShort(
int sampleIndex = 0)
const;
537 std::string
toString(
bool canonicalName =
false,
bool verbose =
false,
538 bool value =
true,
int sampleIndex = 0,
int indent = 0)
const;
542 bool verbose =
false,
bool value =
true,
int indent = 0)
const;
589 VALIDITY getValidity(
int sampleIndex )
const;
621 static bool isValid(
VALIDITY validity) ;
633 bool isValid(
int sampleIndex )
const;
634 bool isValid( )
const;
762 virtual std::string
dumpSamples(
bool includeAverage =
true,
763 bool includeValidity =
true)
const;
777 void setTagID(tagIDType tagID,
bool assignedOTF);
846 void checkThreshold(
const MonitorPointThreshold & threshold )
const;
850 bool canonical =
false,
851 bool verbose =
false,
855 int levels = -1 )
const;
859 ::std::vector< ::std::string > & hierarchyList,
860 bool canonical =
false,
861 bool verbose =
false,
862 int sampleIndex = 0 )
const;
866 bool canonical =
false,
867 bool verbose =
false,
870 int levels = -1 )
const;
875 int sampleIndex = 0 )
const;
898 char getValueChar(
int sampleIndex )
const;
899 short getValueShort(
int sampleIndex )
const;
900 long getValueLong(
int sampleIndex )
const;
901 bool getValueBoolean(
int sampleIndex )
const;
902 float getValueFloat(
int sampleIndex )
const;
903 double getValueDouble(
int sampleIndex )
const;
904 ::std::complex< float > getValueComplex(
int sampleIndex )
const;
906 MonitorValueStringChunk getValueStringChunk(
int sampleIndex )
const;
908 long getValueSerialNo()
const;
910 void setValue(
char d,
int sampleIndex )
const;
911 void setValue(
short d,
int sampleIndex )
const;
912 void setValue(
long d,
int sampleIndex )
const;
913 void setValue(
bool d,
int sampleIndex )
const;
914 void setValue(
float d,
int sampleIndex )
const;
915 void setValue(
double d,
int sampleIndex )
const;
916 void setValue( const ::std::complex< float > & d,
int sampleIndex )
const;
918 void setValuesStringChunksAndValidities(
919 const MonitorValueStringChunk * chunks,
923 void setValueSerialNo(
long d )
const;
925 char getAveChar()
const;
926 short getAveShort()
const;
927 long getAveLong()
const;
928 bool getAveBoolean()
const;
929 float getAveFloat()
const;
930 double getAveDouble()
const;
931 ::std::complex< float > getAveComplex()
const;
932 long getAveSerialNo()
const;
934 void setAve(
char d )
const;
935 void setAve(
short d )
const;
936 void setAve(
long d )
const;
937 void setAve(
bool d )
const;
938 void setAve(
float d )
const;
939 void setAve(
double d )
const;
940 void setAve( const ::std::complex< float > & d )
const;
942 void setAveSerialNo(
long d )
const;
945 std::string getSnapshotAverageToString()
const;
954 std::string
toString(
bool canonicalName,
959 bool average )
const;
962 struct DefThreshAttrs;
966 mutable short width_;
970 mutable short precision_;
978 CommentAttrs * commentAttrs_;
979 bool snapshotAverage_;
983 DefThreshAttrs * defThreshAttrs_;
1001 return persistent_ ;
1005 inline carma::monitor::tagIDType
1022 return monitorPointType_;
1029 return archivePriority_;
1036 return updateInterval_;
1043 return monitorPointHeader_->getNumSamplesPerCycle();
1049 return snapshotAverage_;
1055 const carma::monitor::tagIDType tagId,
1056 const bool assignedOTF )
1067 carma::monitor::MonitorPoint::getSampleAverage( )
const
1069 return monitorPointHeader_->getSampleAverage();
1076 return ((v >= VALID) && (v < MAX_VALIDITY));
1083 return isValid( getAveValidity() );
1092 getSampleAverage().getBlankingFlags() );
1097 carma::monitor::MonitorPoint::getAveChar( )
const
1099 return getSampleAverage().getMonitorValue().byte;
1104 carma::monitor::MonitorPoint::getAveShort( )
const
1106 return getSampleAverage().getMonitorValue().sh;
1111 carma::monitor::MonitorPoint::getAveLong( )
const
1113 return getSampleAverage().getMonitorValue().lo;
1118 carma::monitor::MonitorPoint::getAveBoolean( )
const
1120 return getSampleAverage().getMonitorValue().bo;
1125 carma::monitor::MonitorPoint::getAveFloat( )
const
1127 return getSampleAverage().getMonitorValue().fl;
1132 carma::monitor::MonitorPoint::getAveDouble( )
const
1134 return getSampleAverage().getMonitorValue().db;
1138 inline ::std::complex< float >
1139 carma::monitor::MonitorPoint::getAveComplex( )
const
1141 const float *
const c = getSampleAverage().getMonitorValue().complex;
1142 return ::std::complex< float >( c[0], c[1] );
1147 carma::monitor::MonitorPoint::getAveSerialNo( )
const
1149 return getSampleAverage().getMonitorValue().sn;
1153 #endif // CARMA_MONITOR_MONITORPOINT_H
bool isSnapshotAverage() const
Returns state of snapshot averaging for this MP.
VALIDITY
Validity states of the data value.
short MonitorValueType
Enumeration of possible types for monitor point values.
std::string getPaddedValueString(int width, int sampleIndex) const
Gets the data value as a string, padded to requested width.
void setPersistent(bool persistent)
Set the persistent state of the data.
ARCHIVE_PRIORITY getArchivePriority() const
Get the archive priority.
virtual std::string getAverageToString() const =0
Abstract method that returns the average value as a string.
virtual VALIDITY getAveValidity() const
Get the validity for the average.
ARCHIVE_PRIORITY
Archiving priority.
int getUpdateInterval() const
Get the basic sampling update interval in frames.
std::string getUnits() const
Get the units string for the monitor point.
bool isTimeSeries() const
Are multiple samples in a frame a time series or an array.
virtual std::string monitorPointTags(bool untagged=false) const
Write list of monitor points and their tagIDs to a string, one monitor point per line.
void setWidth(short width) const
Set the maximum width(length) of the string for interpreting the value to a string.
short getPrecision() const
Get the number of digits to the right of the decimal point when translating the value to a string...
The MonitorComponent class is an interface used to build the monitor hierarchy.
void setBlankingFlagging(BLANKING_FLAGGING flag) const
Set the blanking/flagging flag for the average.
std::string getComment() const
Get a comment for the monitor point.
Class representing a data sample for a MonitorPoint.
std::string archivePriorityToString() const
Get a string for the archive priority for this monitor point.
virtual bool isMonitorPoint() const
Identifies this component as a MonitorPoint or any derivative Should be over-ridden by the MonitorPoi...
std::string toStringAverage(bool canonicalName=false, bool verbose=false, bool value=true, int indent=0) const
Write this monitor component to a string, using frame average values.
std::string getCoreValueAsString(int sampleIndex=0) const
Get value as a string using the underlying basic type representation.
virtual ::std::string hierarchyToStringAverage(bool canonical=false, bool verbose=false, bool value=true, int indent=0, int levels=-1) const
Dump this and all contained monitor components to a string.
void setSnapshotAverage(bool state)
Controls whether averaging is done as a normal true average or if it is just a snapshot of the last v...
MONITOR_POINT_TYPE getMonitorPointType() const
Get the type of the monitor point.
void setAveValidity(VALIDITY validity) const
Set the validity for the average.
std::string valuetypeToString() const
Get a string representation for the datatype of this monitor point.
double getCommentTime() const
Get time last comment was inserted.
BLANKING_FLAGGING getBlankingFlagging() const
Get the blanking/flagging flag for the average.
virtual bool operator<(const MonitorPoint &rhs) const
Compares monitor point for precedence to the one passed.
virtual std::string dumpSamples(bool includeAverage=true, bool includeValidity=true) const
Create a string with sample and average values and validities.
std::string monitorPointTypeToString() const
Get a string representation for the monitor point type of this monitor point.
void setUpdateInterval(int interval)
Set the basic sampling update interval.
BLANKING_FLAGGING
Blanking/flagging status of the data.
void clearAllDefaults()
Clears all default threshold values (makes them zero) and sets thresholdFlags_ to THRESHOLD_NONE_SET...
std::string getPaddedAverageString() const
Gets the average value as a string, padded to internal width.
The data should never be archived.
static bool isValid(VALIDITY validity)
Check for any of the valid states.
MonitorValueType getValuetype() const
Get the datatype of the value.
void setValidity(VALIDITY validity, int sampleIndex=0) const
Set the validity for a single sample.
std::string getCommentUser() const
Get username that generated comment for the monitor point.
int getNumSamples() const
Get the number of samples per frame.
bool errorLowDefaultIsSet() const
Returns true if a default value was set for errorLow for this monitor point.
bool warnHighDefaultIsSet() const
Returns true if a default value was set for warnHigh for this monitor point.
void clearComment()
Clear all comment attributes for the monitor point.
MonitorValue getErrorLowDefault() const
Get the upper error default threshold.
static std::string blankingFlaggingToString(BLANKING_FLAGGING flag)
Get a string representation for a blanking/flagging flag.
bool warnLowDefaultIsSet() const
Returns true if a default value was set for warnLow for this monitor point.
MonitorValue getErrorHighDefault() const
Get the upper error default threshold.
int getNumValidSamples() const
Get the number of valid samples per frame.
void setTagID(tagIDType tagID, bool assignedOTF)
Set tagID.
bool isPersistent() const
Returns the persistent state of the data.
void setErrorHighDefault(const MonitorValue threshold)
Set the upper error default threshold.
void setWarnLowDefault(const MonitorValue threshold)
Set the lower warning default threshold.
MonitorValue getWarnLowDefault() const
Get the lower warning default threshold.
virtual ::std::string hierarchyToString(bool canonical=false, bool verbose=false, bool value=true, int sampleIndex=0, int indent=0, int levels=-1) const
Dump this and all contained monitor components to a string.
bool isAveValid() const
Check to see if the average is valid.
std::string toString(bool canonicalName=false, bool verbose=false, bool value=true, int sampleIndex=0, int indent=0) const
Write this monitor component to a string.
void setPrecision(short precision)
Set the number of digits to the right of the decimal point when translating the value to a string...
virtual std::string toStringShort(int sampleIndex=0) const
Dumps name and value of monitor point as a short string (name=value).
virtual void setTimeSeries(bool timeSeries)
Determines whether data should be interpreted as time series or as an array (spectrum) when there are...
void checkThreshold(const MonitorPointThreshold &threshold) const
Method checks that threshold object corresponds to this monitor point - checks to see that threshold'...
virtual bool operator==(const MonitorComponent &rhs) const
Compares monitor point for equality to the monitor component passed.
void setMonitorPointHeader(MonitorPointHeader header)
Set the monitor point header.
Abstract base class for a monitor point.
virtual std::string getValueToString(int sampleIndex) const =0
Abstract method that returns the data value as a string.
tagIDType getTagID() const
Get the tagID (unique identifier of monitor point).
Class wrapper for monitor point samples stored in a subsystem frame.
virtual void hierarchyToVector(::std::vector< ::std::string > &hierarchyList, bool canonical=false, bool verbose=false, int sampleIndex=0) const
Dump this and all contained monitor component strings into a map hierarchy.
MonitorValue getWarnHighDefault() const
Get the upper warning default threshold.
void setDefaultArchivePriority(ARCHIVE_PRIORITY priority)
Set the default archive priority If the archive priority is set to DEFAULT, it is replaced with the n...
MONITOR_POINT_TYPE
Monitor point type.
void setComment(const std::string &text)
Set a comment for the monitor point.
A composite interface used to build the monitor system hierarchy.
virtual ~MonitorPoint()
Destructor.
type definitions for monitor system
bool errorHighDefaultIsSet() const
Returns true if a default value was set for errorHigh for this monitor point.
void setNoData() const
Recursively mark all data samples as INVALID_NO_DATA.
virtual void updateFrameAverage(ScratchAverages &scratchAvgs)=0
Abstract method that updates the average value/validity for the frame.
void setArchivePriority(ARCHIVE_PRIORITY priority)
Set the archive priority Priority may be used by archiver to control data volume.,.
void setUnits(const std::string &units)
Get the units string for the monitor point.
static std::string validityToString(VALIDITY validity)
Get a string representation for a validity.
void setWarnHighDefault(const MonitorValue threshold)
Set the upper warning default threshold.
bool hasAllData() const
See if all MPs in this component and below have data samples.
MonitorPointSample getMonitorPointSample(int sampleIndex) const
Get the monitor point sample.
virtual void setNumSamples(int nSamples) const
Set the number of samples per frame.
void setAllValidity(VALIDITY validity, bool markMpAsModified=true) const
Set the validity for all samples and the average.
Union of all possible types of monitor sample values.
virtual short getWidth() const
Get the string length to use when interpreting the value to a string.
virtual void evaluateTolerance(const MonitorPointThreshold &threshold)
Set the validity flags for the MonitorPoint using the threshold limits stored in the input MonitorPoi...
void setErrorLowDefault(const MonitorValue threshold)
Set the upper error default threshold.
virtual std::string leafToString(bool verbose=false, bool value=true, int sampleIndex=0) const
Dump all leaf nodes below this component to a string.