sum_ = min_ = max_ = 0;
}
+template <class T>
+prefix_ void senf::StatisticAccumulator<T>::data( StatisticsData &data_) const
+{
+ data_.min = (float) min_;
+ data_.avg = avg();
+ data_.max = (float) max_;
+ data_.stddev = stddev();
+ data_.count = count;
+}
+
///////////////////////////////ct.e////////////////////////////////////////
#undef prefix_
\ingroup senf_statistics
*/
+ struct StatisticsData{
+ float min;
+ float max;
+ float avg;
+ float stddev;
+ boost::uint32_t count;
+ };
+
template <class T>
class StatisticAccumulator
{
boost::uint32_t count() const;
///< Returns count of accumulated values.
/**< This method returns count of accumulated values of the current accumulation.*/
+ void data( StatisticsData & data_) const;
+ ///< Returns the accumulated data as a tuple
+ /**< This method returns the accumulated information as a tuple.*/
private:
T sum_squared_;
typedef StatisticAccumulator<int> StatisticAccumulatorInt;
typedef StatisticAccumulator<float> StatisticAccumulatorFloat;
-
}
///////////////////////////////hh.e////////////////////////////////////////
//#include "StatisticAccumulator.cci"
enter(1, min, avg, max, dev);
}
+prefix_ void senf::Statistics::operator()(StatisticsData const & data)
+{
+ enter(1, data.min, data.avg, data.max, data.stddev);
+}
+
prefix_ void senf::Statistics::operator()(float value, float dev)
{
enter(1, value, value, value, dev);
///< Same as operator() with \a min == \a avg == \a max
/**< Provided so a Statistics instance can be directly used
as a signal target. */
+ void operator()(StatisticsData const & data);
+ ///< Same as operator(), but imports statistics data from a StatisticsData object
+ /**< Provided so a Statistics instance can be directly used
+ as a signal target. */
template <class Value>
void operator()(unsigned n, StatisticAccumulator<Value> & sa);
///< Same as operator() gathers values from StatisticAccumulator