StatisticAccumulator.cci
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief StatisticAccumulator inline non-template implementation */
16 
17 // Custom includes
18 
19 #define prefix_ inline
20 //-/////////////////////////////////////////////////////////////////////////////////////////////////
21 
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 // senf::StatisticsData
24 
25 prefix_ senf::StatisticsData::StatisticsData()
26  : min(NAN), avg(NAN), max(NAN), stddev(NAN), cnt(0)
27 {}
28 
29 prefix_ senf::StatisticsData::StatisticsData(float min_, float avg_, float max_, float stddev_, unsigned cnt_)
30  : min(min_), avg(avg_), max(max_), stddev(stddev_), cnt(cnt_)
31 {}
32 
33 prefix_ senf::StatisticsData::StatisticsData(float singleValue)
34  : min(singleValue), avg(singleValue), max(singleValue), stddev(0.0f), cnt(1)
35 {}
36 
37 prefix_ senf::StatisticsData::operator bool()
38  const
39 {
40  return cnt > 0;
41 }
42 
43 prefix_ bool senf::StatisticsData::operator<(senf::StatisticsData const & other)
44  const
45 {
46  return avg < other.avg;
47 }
48 
49 
50 //-/////////////////////////////////////////////////////////////////////////////////////////////////
51 #undef prefix_
52 
53 
54 // Local Variables:
55 // mode: c++
56 // fill-column: 100
57 // comment-column: 40
58 // c-file-style: "senf"
59 // indent-tabs-mode: nil
60 // ispell-local-dictionary: "american"
61 // compile-command: "scons -u test"
62 // End: