18 #ifndef CARMA_MONITOR_POINT_THRESHOLD_H
19 #define CARMA_MONITOR_POINT_THRESHOLD_H
36 struct ThresholdStruct {
40 MonitorValue thresholdRange[THRESHOLD_NUM_VALUES];
55 class MonitorPointThreshold {
58 explicit MonitorPointThreshold( ThresholdStruct & thresholdStruct );
60 ~MonitorPointThreshold( );
65 tagIDType getTagID( )
const;
78 bool errorLowIsSet( )
const;
81 bool warnLowIsSet( )
const;
84 bool errorHighIsSet( )
const;
87 bool warnHighIsSet( )
const;
89 void setRangeValue( ThresholdValueEnum lowHigh, MonitorValue value );
90 void setRangeValue( ThresholdValueEnum lowHigh,
char value );
91 void setRangeValue( ThresholdValueEnum lowHigh,
short value );
92 void setRangeValue( ThresholdValueEnum lowHigh,
long value );
93 void setRangeValue( ThresholdValueEnum lowHigh,
bool value );
94 void setRangeValue( ThresholdValueEnum lowHigh,
float value );
95 void setRangeValue( ThresholdValueEnum lowHigh,
double value );
96 void setRangeValue( ThresholdValueEnum lowHigh, const ::std::string & value );
97 void setRangeValue( ThresholdValueEnum lowHigh, ::std::complex< float > value );
98 void setRangeValueSerialNo( ThresholdValueEnum lowHigh,
long value );
100 const MonitorValue& getThresholdValue( ThresholdValueEnum lowHigh )
const;
101 char getByteThresholdValue( ThresholdValueEnum lowHigh )
const;
102 short getShortThresholdValue( ThresholdValueEnum lowHigh )
const;
103 long getLongThresholdValue( ThresholdValueEnum lowHigh )
const;
104 bool getBoolThresholdValue( ThresholdValueEnum lowHigh )
const;
105 float getFloatThresholdValue( ThresholdValueEnum lowHigh )
const;
106 double getDoubleThresholdValue( ThresholdValueEnum lowHigh )
const;
107 const ::std::string getStringThresholdValue( ThresholdValueEnum lowHigh )
const;
108 const ::std::complex< float > getComplexThresholdValue( ThresholdValueEnum lowHigh )
const;
109 long getSerialNoThresholdValue( ThresholdValueEnum lowHigh )
const;
120 void setThresholdValuesFromDefaults(
const MonitorPoint & mp );
123 void unset( ThresholdValueEnum lowhigh );
126 ThresholdStruct & thresholds_;
141 InvalidThresholdException( const ::std::string & message,
142 const char * fileName,
147 ~InvalidThresholdException( ) throw( );
156 carma::monitor::MonitorPointThreshold::MonitorPointThreshold(
157 ThresholdStruct & threshold ) :
158 thresholds_( threshold )
164 carma::monitor::MonitorPointThreshold::~MonitorPointThreshold( )
170 carma::monitor::MonitorPointThreshold::getTagID( )
const
172 return thresholds_.tagID;
177 carma::monitor::MonitorPointThreshold::getValueType( )
const
179 return thresholds_.type;
184 carma::monitor::MonitorPointThreshold::isSet( )
const
186 return (thresholds_.flags != THRESHOLD_NONE_SET);
191 carma::monitor::MonitorPointThreshold::errorLowIsSet( )
const
193 return ((thresholds_.flags & THRESHOLD_ERROR_LOW_SET)
194 == THRESHOLD_ERROR_LOW_SET);
199 carma::monitor::MonitorPointThreshold::warnLowIsSet( )
const
201 return ((thresholds_.flags & THRESHOLD_WARN_LOW_SET)
202 == THRESHOLD_WARN_LOW_SET);
207 carma::monitor::MonitorPointThreshold::errorHighIsSet( )
const
209 return ((thresholds_.flags & THRESHOLD_ERROR_HIGH_SET)
210 == THRESHOLD_ERROR_HIGH_SET);
215 carma::monitor::MonitorPointThreshold::warnHighIsSet( )
const
217 return ((thresholds_.flags & THRESHOLD_WARN_HIGH_SET)
218 == THRESHOLD_WARN_HIGH_SET);
223 carma::monitor::MonitorPointThreshold::getThresholdValue(
224 const ThresholdValueEnum lowHigh )
const
226 return thresholds_.thresholdRange[ lowHigh ];
231 carma::monitor::MonitorPointThreshold::getByteThresholdValue(
232 const ThresholdValueEnum lowHigh )
const
234 return getThresholdValue( lowHigh ).byte;
239 carma::monitor::MonitorPointThreshold::getShortThresholdValue(
240 const ThresholdValueEnum lowHigh )
const
242 return getThresholdValue( lowHigh ).sh;
247 carma::monitor::MonitorPointThreshold::getLongThresholdValue(
248 const ThresholdValueEnum lowHigh )
const
250 return getThresholdValue( lowHigh ).lo;
255 carma::monitor::MonitorPointThreshold::getBoolThresholdValue(
256 const ThresholdValueEnum lowHigh )
const
258 return getThresholdValue( lowHigh ).bo;
263 carma::monitor::MonitorPointThreshold::getFloatThresholdValue(
264 const ThresholdValueEnum lowHigh )
const
266 return getThresholdValue( lowHigh ).fl;
271 carma::monitor::MonitorPointThreshold::getDoubleThresholdValue(
272 const ThresholdValueEnum lowHigh )
const
274 return getThresholdValue( lowHigh ).db;
278 inline const ::std::string
279 carma::monitor::MonitorPointThreshold::getStringThresholdValue(
280 const ThresholdValueEnum lowHigh )
const
282 return ::std::string( getThresholdValue( lowHigh ).str );
286 inline const ::std::complex< float >
287 carma::monitor::MonitorPointThreshold::getComplexThresholdValue(
288 const ThresholdValueEnum lowHigh )
const
290 return ::std::complex< float >( getThresholdValue( lowHigh ).complex[0],
291 getThresholdValue( lowHigh ).complex[1] );
296 carma::monitor::MonitorPointThreshold::getSerialNoThresholdValue(
297 const ThresholdValueEnum lowHigh )
const
299 return getThresholdValue( lowHigh ).sn;
304 carma::monitor::InvalidThresholdException::InvalidThresholdException(
305 const ::std::string & message,
306 const char *
const fileName,
314 carma::monitor::InvalidThresholdException::~InvalidThresholdException( )
short MonitorValueType
Enumeration of possible types for monitor point values.
Exception class for errors.
Class wrapper for monitor point samples stored in a subsystem frame.
Exception class for errors The exception comes with a text string that can be printed or logged...
ErrorException(const std::string &msg, const char *filename, int lineNo)
Constructor.
type definitions for monitor system
Union of all possible types of monitor sample values.