X-Git-Url: http://g0dil.de/git?p=senf.git;a=blobdiff_plain;f=senf%2FUtils%2FStatisticAccumulator.ct;fp=senf%2FUtils%2FStatisticAccumulator.ct;h=c720d3fea54ed5c9813923c240edb7e93d72db26;hp=b0fc9b250cc8cf371773baab40a48e3180305a74;hb=55b4c5a3afcf821031cef2ca7089fbdfd77d513a;hpb=b2fff1b50e0010fdad28cb638987cbf88032e30e diff --git a/senf/Utils/StatisticAccumulator.ct b/senf/Utils/StatisticAccumulator.ct index b0fc9b2..c720d3f 100644 --- a/senf/Utils/StatisticAccumulator.ct +++ b/senf/Utils/StatisticAccumulator.ct @@ -23,7 +23,9 @@ // All Rights Reserved. // // Contributor(s): -// Thorsten Horstmann +// Mathias Kretschmer +// Jens Moedeker + /** \file \brief StatisticAccumulator non-inline template implementation */ @@ -36,19 +38,9 @@ // senf::StatisticAccumulator template -prefix_ senf::StatisticAccumulator::StatisticAccumulator( ) - : sum_squared_(0), - sum_(0), - min_(0), - max_(0), - last_avg_(0), - count_(0) -{ -} - -//template -//prefix_ senf::StatisticAccumulator::~StatisticAccumulator() -//{ } +prefix_ senf::StatisticAccumulator::StatisticAccumulator() + : sum_squared_(0), sum_(0), min_(0), max_(0), last_avg_(0), count_(0) +{ } template prefix_ float senf::StatisticAccumulator::stddev() @@ -91,29 +83,28 @@ prefix_ void senf::StatisticAccumulator::accumulate( T value) template prefix_ void senf::StatisticAccumulator::clear() { - if( count_ > 0){ - last_avg_ = avg(); - count_ = 0; - sum_squared_ = 0; - sum_ = min_ = max_ = 0; + if (count_ > 0) { + last_avg_ = avg(); + count_ = 0; + sum_squared_ = 0; + sum_ = min_ = max_ = 0; } } template prefix_ void senf::StatisticAccumulator::data( StatisticsData &data_) const { - if( count_ == 0){ - data_.min = data_.avg = data_.max = last_avg_; - data_.stddev = 0.0; - data_.count = 0; + if (count_ == 0) { + data_.min = data_.avg = data_.max = last_avg_; + data_.stddev = 0.0; + data_.count = 0; + } else { + data_.min = (float) min_; + data_.avg = avg(); + data_.max = (float) max_; + data_.stddev = stddev(); + data_.count = count_; } - else{ - data_.min = (float) min_; - data_.avg = avg(); - data_.max = (float) max_; - data_.stddev = stddev(); - data_.count = count_; - } }