CARMA C++
MonitorPointNumeric.h
Go to the documentation of this file.
1 #ifndef CARMA_MONITOR_MONITORPOINTNUMERIC_H
2 #define CARMA_MONITOR_MONITORPOINTNUMERIC_H
3 
4 
19 
20 namespace carma {
21 namespace monitor {
22 
23 
24 typedef MonitorPointAverageT< double > MonitorPointAverageNumeric;
25 
33 public:
34 
35 
39  virtual ~MonitorPointNumeric() ;
40 
48  void setTimeSeries(bool timeSeries);
49 
50  // Override base class
51  bool operator==(const MonitorComponent& component) const;
52 
59  virtual void resetAccumulator(MonitorPointAverageNumeric& average) const ;
60 
71  (MonitorPointAverageNumeric& average, int index) const ;
72 
80  virtual void accumulate (MonitorPointAverageNumeric& average) const ;
81 
90  virtual void accumulateAverage (MonitorPointAverageNumeric& accumulator) ;
91 
100  (const MonitorPointAverageNumeric& average) const;
101 
109  double getMaxValueDouble (const MonitorPointAverageNumeric& average) const;
110 
118  double getMinValueDouble (const MonitorPointAverageNumeric& average) const;
119 
124  virtual double getValueNumeric( int sampleIndex ) const = 0;
125 
129  virtual double getAveNumeric( ) const = 0;
130 
131 protected:
132 
133  MonitorPointNumeric( const ::std::string & name,
134  MonitorValueType valuetype,
135  MONITOR_POINT_TYPE monitorPointType = MONITOR );
136 
137  // Also stores numValidSamples and aveValidity
138  double computeFrameAverage( MonitorPointAverageNumeric & scratchAvg );
139 
140  VALIDITY getAveValidityNumeric( ) const;
141 
142  BLANKING_FLAGGING getBlankingFlaggingNumeric( ) const;
143 
144 private:
146 
147  double sum_;
148  int nValidSamples_;
149  VALIDITY aveValidity_;
150  BLANKING_FLAGGING aveBlankingFlagging_;
151 };
152 
153 
154 } // namespace carma::monitor
155 } // namespace carma
156 
157 
158 inline void
160 {
161  timeSeries_ = timeSeries;
162 }
163 
164 
165 inline double
167  const MonitorPointAverageNumeric & avg ) const
168 {
169  return ((avg.getNumValidSamples() > 0) ? avg.getMaxValue() : 0.0);
170 }
171 
172 
173 inline double
175  const MonitorPointAverageNumeric & avg ) const
176 {
177  return ((avg.getNumValidSamples() > 0) ? avg.getMinValue() : 0.0);
178 }
179 
180 
182 carma::monitor::MonitorPointNumeric::getAveValidityNumeric( ) const
183 {
184  return aveValidity_;
185 }
186 
187 
189 carma::monitor::MonitorPointNumeric::getBlankingFlaggingNumeric( ) const
190 {
191  return aveBlankingFlagging_;
192 }
193 
194 
195 #endif
VALIDITY
Validity states of the data value.
Definition: MonitorPoint.h:132
short MonitorValueType
Enumeration of possible types for monitor point values.
double getMaxValueDouble(const MonitorPointAverageNumeric &average) const
Returns maximum value from accumulated data in MonitorPointAverageNumeric object. ...
Abstract base class for all monitor points.
BLANKING_FLAGGING
Blanking/flagging status of the data.
Definition: MonitorPoint.h:159
U getMinValue() const
Get minimum value across all accumulated samples.
virtual void accumulate(MonitorPointAverageNumeric &average) const
Accumulates data from monitor point samples belonging this monitor point.
U getMaxValue() const
Get maximum of sample values.
double getAccumulatedAverageDouble(const MonitorPointAverageNumeric &average) const
Computes average from accumulated data in MonitorPointAverageNumeric object.
Abstract base class for a monitor point.
Definition: MonitorPoint.h:68
double getMinValueDouble(const MonitorPointAverageNumeric &average) const
Returns minimum value from accumulated data in MonitorPointAverageNumeric object. ...
bool operator==(const MonitorComponent &component) const
Compares monitor point for equality to the monitor component passed.
virtual double getValueNumeric(int sampleIndex) const =0
Returns sample value as a double.
virtual double getAveNumeric() const =0
Returns average sample value as a double.
MONITOR_POINT_TYPE
Monitor point type.
Definition: MonitorPoint.h:171
void setTimeSeries(bool timeSeries)
Determines whether data should be interpreted as time series or as an array (spectrum) when there are...
A composite interface used to build the monitor system hierarchy.
virtual ~MonitorPointNumeric()
Destructor.
virtual void accumulateAverage(MonitorPointAverageNumeric &accumulator)
Accumulates pre-calculated average value from current monitor point for computing averages...
virtual enum MonitorPoint::VALIDITY accumulateSample(MonitorPointAverageNumeric &average, int index) const
Accumulates data from one monitor point sample (sample index == index) belonging this monitor point...
virtual void resetAccumulator(MonitorPointAverageNumeric &average) const
Resets accumulators and sample count for computing averages.
Abstract base class for a numeric monitor point.