6 #ifndef CARMA_MONITOR_TYPED_AVERAGE_ACCUMULATORT_H
7 #define CARMA_MONITOR_TYPED_AVERAGE_ACCUMULATORT_H
20 #include "carma/corba/corba.h"
22 #include "carma/monitor/monitorframe.h"
45 setSeq( const ::std::vector< MonitorPoint * > & mpVec ) = 0;
55 template <
typename T,
typename U >
96 void dumpInstAveragesToDBFile(
long frameCount,
100 void dumpInstAveragesToDBFile(
long frameCount,
101 carma::dbms::dbFFIO & file )
const;
104 void dumpLongAveragesToDBFile(
const char * frameCountText,
109 void setSeq( const ::std::vector< MonitorPoint * > & mpVec );
111 typedef ::std::vector< MonitorPointAccumulatorT< T, U > > AccumVec;
113 typedef typename AccumVec::iterator IteratorType;
114 typedef typename AccumVec::const_iterator ConstIteratorType;
126 carma::monitor::AverageAccumulatorBase::AverageAccumulatorBase( )
132 carma::monitor::AverageAccumulatorBase::~AverageAccumulatorBase( )
137 template <
typename T,
typename U >
147 setMonSys( monitorSystem, priority );
151 template <
typename T,
typename U >
157 template <
typename T,
typename U >
160 const ::std::vector< MonitorPoint * > & mpVec )
162 const ::std::vector< MonitorPoint * >::const_iterator iEnd = mpVec.end();
164 ::std::vector< MonitorPoint * >::const_iterator i = mpVec.begin();
168 for ( ; i != iEnd; ++i ) {
169 if ( dynamic_cast< T * >( *i ) != 0 )
173 seq_.reserve( count );
177 for ( ; i != iEnd; ++i ) {
178 T *
const typedPoint =
dynamic_cast< T *
>( *i );
180 if ( typedPoint != 0 ) {
181 seq_.push_back( MonitorPointAccumulatorT< T, U >( *typedPoint ) );
187 template <
typename T,
typename U >
191 IteratorType i = seq_.begin();
192 const IteratorType iEnd = seq_.end();
194 for ( ; i != iEnd; ++i )
195 i->accumulateAverage();
199 template <
typename T,
typename U >
203 IteratorType i = seq_.begin();
204 const IteratorType iEnd = seq_.end();
206 for ( ; i != iEnd; ++i )
207 i->resetAccumulator();
211 template <
typename T,
typename U >
214 const long frameCount,
217 ConstIteratorType i = seq_.begin();
218 const ConstIteratorType iEnd = seq_.end();
220 for ( ; i != iEnd; ++i )
221 i->dumpInstAveragesToFile( frameCount, file );
224 template <
typename T,
typename U >
227 const long frameCount,
228 carma::dbms::dbFFIO & file )
const
230 ConstIteratorType i = seq_.begin();
231 const ConstIteratorType iEnd = seq_.end();
233 for ( ; i != iEnd; ++i )
234 i->dumpInstAveragesToFile( frameCount, file );
238 template <
typename T,
typename U >
241 const char *
const frameCountText,
244 ConstIteratorType i = seq_.begin();
245 const ConstIteratorType iEnd = seq_.end();
247 for ( ; i != iEnd; ++i )
248 i->dumpLongAveragesToFile( frameCountText, file );
ARCHIVE_PRIORITY
Archiving priority.
The monitor system base class.
~TypedAverageAccumulatorT()
Destructor - destroys all strcutures built up during construction.
void resetAccumulator()
Resets values in all typed accumulators so that a new average computation can begin.
void accumulate()
Accumulates values for each monitor point accumulator in this typed average accumulator.
Class(es) to read & write dbms flat file information in ASCII or binary.
Monitor system base class.
TypedAverageAccumulatorT(const MonitorSystem &monSys, MonitorComponent::ARCHIVE_PRIORITY priority)
Constructor Binds itself to monitor system monSys.
Common base class for TypedAverageAccumulatorT< T, U > classes.