4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Thorsten Horstmann <thorsten.horstmann@fokus.fraunhofer.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief StatisticAccumulator public header */
26 #ifndef HH_SENF_Utils_StatisticAccumulator_
27 #define HH_SENF_Utils_StatisticAccumulator_ 1
31 #include <boost/cstdint.hpp>
32 ///////////////////////////////hh.p////////////////////////////////////////
34 /** \brief Accumulate measurement values
36 The accumulator mainly do the prelimenary work for the senf::Statistic class.
37 It accumulates certain values with in an interval to be used by senf::Statistics
39 \li the senf::Statistics class
40 \li statistics sources
42 This class provides the average, standard deviation, min, max values over one
43 interval, means until clear() is called. It rather directly calculates the results
44 then collection all single values provided by calling accumulate().
45 \see senf::Statistics to process accumulated values
46 \ingroup senf_statistics
50 class StatisticAccumulator
53 StatisticAccumulator( T defaultvalue = 0);
54 // virtual ~StatisticAccumulator();
57 ///< Reset accumulated values.
58 /**< This member reset all avg/min/max values to the given \a
59 defaultvalue and the count to zero. */
60 void accumulate(T value);
61 ///< Gather value to be accumulated.
62 /**< This method accumulate a value.
63 \param[in] value to be accumulated value*/
67 ///< Returns current minimal value.
68 /**< This method returns the minimal value of the current accumulation.*/
70 ///< Returns current maximal value.
71 /**< This method returns the maximal value of the current accumulation.*/
73 ///< Returns average value.
74 /**< This method returns the average value of the current accumulation.*/
75 float last_avg() const;
76 ///< Returns former average value.
77 /**< This method returns the average value of the former accumulation period.*/
79 ///< Returns standard deviation value.
80 /**< This method returns the standard deviation value of the current accumulation.*/
81 boost::uint32_t count() const;
82 ///< Returns count of accumulated values.
83 /**< This method returns count of accumulated values of the current accumulation.*/
92 boost::uint32_t count_;
98 typedef StatisticAccumulator<int> StatisticAccumulatorInt;
99 typedef StatisticAccumulator<float> StatisticAccumulatorFloat;
103 ///////////////////////////////hh.e////////////////////////////////////////
104 //#include "StatisticAccumulator.cci"
105 #include "StatisticAccumulator.ct"
106 #include "StatisticAccumulator.cti"