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 non-inline template implementation */
29 ///////////////////////////////ct.p////////////////////////////////////////
31 ///////////////////////////////////////////////////////////////////////////
32 // senf::StatisticAccumulator<T>
35 prefix_ senf::StatisticAccumulator<T>::StatisticAccumulator( )
46 //prefix_ senf::StatisticAccumulator<T>::~StatisticAccumulator()
50 prefix_ float senf::StatisticAccumulator<T>::stddev()
56 else if (count_ == 1) {
60 return sqrt( ( float(sum_squared_) / float( count_) ) - (_avg * _avg) );
64 prefix_ void senf::StatisticAccumulator<T>::accumulate( T value)
67 min_ = max_ = sum_ = value;
68 sum_squared_ = value * value;
73 sum_squared_ += value * value;
77 else if (value > max_)
82 prefix_ void senf::StatisticAccumulator<T>::clear()
88 sum_ = min_ = max_ = 0;
93 prefix_ void senf::StatisticAccumulator<T>::data( StatisticsData &data_) const
96 data_.min = data_.avg = data_.max = last_avg_;
101 data_.min = (float) min_;
103 data_.max = (float) max_;
104 data_.stddev = stddev();
105 data_.count = count_;
110 ///////////////////////////////ct.e////////////////////////////////////////