X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FStatisticAccumulator.hh;h=08ba3447f0d6c21cbda70a32e85a22809270d621;hb=5b2e9a63a43027c71ac470ac9bdecb72e8974951;hp=6c08c41097deae6bf0986ba495274bd8084cca7d;hpb=2ed56fbec2aa25bf4a8b13e6a06ec90e9dcc1fec;p=senf.git diff --git a/senf/Utils/StatisticAccumulator.hh b/senf/Utils/StatisticAccumulator.hh index 6c08c41..08ba344 100644 --- a/senf/Utils/StatisticAccumulator.hh +++ b/senf/Utils/StatisticAccumulator.hh @@ -31,32 +31,40 @@ #include ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - /** \brief Accumulate measurement values - - The accumulator mainly do the prelimenary work for the senf::Statistic class. - It accumulates certain values with in an interval to be used by senf::Statistics - - \li the senf::Statistics class - \li statistics sources - - This class provides the average, standard deviation, min, max values over one - interval, means until clear() is called. It rather directly calculates the results - then collection all single values provided by calling accumulate(). - \see senf::Statistics to process accumulated values - \ingroup senf_statistics - */ + struct StatisticsData + { + float min; + float max; + float avg; + float stddev; + boost::uint32_t count; + }; + + /** \brief Accumulate measurement values + + The accumulator mainly do the prelimenary work for the senf::Statistic class. + It accumulates certain values with in an interval to be used by senf::Statistics + + \li the senf::Statistics class + \li statistics sources + + This class provides the average, standard deviation, min, max values over one + interval, means until clear() is called. It rather directly calculates the results + then collection all single values provided by calling accumulate(). + \see senf::Statistics to process accumulated values + \ingroup senf_statistics + */ template class StatisticAccumulator { public: - StatisticAccumulator( T defaultvalue = 0); + StatisticAccumulator(); // virtual ~StatisticAccumulator(); void clear(); ///< Reset accumulated values. - /**< This member reset all avg/min/max values to the given \a - defaultvalue and the count to zero. */ + /**< This member reset all values. */ void accumulate(T value); ///< Gather value to be accumulated. /**< This method accumulate a value. @@ -81,9 +89,11 @@ namespace senf { 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 defaultvalue_; T sum_squared_; T sum_; T min_; @@ -98,7 +108,6 @@ namespace senf { typedef StatisticAccumulator StatisticAccumulatorInt; typedef StatisticAccumulator StatisticAccumulatorFloat; - } ///////////////////////////////hh.e//////////////////////////////////////// //#include "StatisticAccumulator.cci"