From: mtk Date: Sun, 17 Apr 2011 11:58:37 +0000 (+0000) Subject: added a setLastAvg() method to report a 'substitute' min/avg/max if no real data... X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=bc566051d5a894c8ba0f9a70f3552306bc33e1a1;p=senf.git added a setLastAvg() method to report a 'substitute' min/avg/max if no real data was seen. not a pretty solution :( git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1783 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Utils/StatisticAccumulator.ct b/senf/Utils/StatisticAccumulator.ct index 9e5d106..282d6e9 100644 --- a/senf/Utils/StatisticAccumulator.ct +++ b/senf/Utils/StatisticAccumulator.ct @@ -61,6 +61,12 @@ prefix_ float senf::StatisticAccumulator::stddev() } template +prefix_ void senf::StatisticAccumulator::setLastAvg( T value) +{ + last_avg_ = value; +} + +template prefix_ void senf::StatisticAccumulator::accumulate( T value) { if (count_ == 0) { diff --git a/senf/Utils/StatisticAccumulator.hh b/senf/Utils/StatisticAccumulator.hh index 08ba344..f3b4946 100644 --- a/senf/Utils/StatisticAccumulator.hh +++ b/senf/Utils/StatisticAccumulator.hh @@ -67,8 +67,12 @@ namespace senf { /**< This member reset all values. */ void accumulate(T value); ///< Gather value to be accumulated. - /**< This method accumulate a value. + /**< This method accumulates a value. \param[in] value to be accumulated value*/ + void setLastAvg(T value); + ///< If no real data was collected, this method specifies the min/avg/max value to be returned. + /**< This method specifies the the min/avg/max value to be returned if no real data was colelcted + \param[in] value to be returned*/ public: T min() const;