Keeps track of the minimum and maximum value we observed. More...
#include <StatCollector.h>
Public Types | |
using | Data_t = T |
type of data we collect More... | |
using | This_t = MinMaxCollector< T > |
this type More... | |
Public Member Functions | |
bool | has_data () const |
Returns whether at least one datum has been added. More... | |
Data_t | min () const |
Returns the accumulated minimum, or a very large number if no values. More... | |
Data_t | max () const |
Returns the accumulated maximum, or a very small number if no values. More... | |
void | clear () |
Removes all statistics and reinitializes the object. More... | |
template<typename Iter > | |
lar::util::MinMaxCollector< T > & | add (Iter begin, Iter end) |
MinMaxCollector ()=default | |
Default constructor: no data collected so far. More... | |
MinMaxCollector (std::initializer_list< Data_t > init) | |
Constructor: starts with parsing the specified data. More... | |
template<typename Iter > | |
MinMaxCollector (Iter begin, Iter end) | |
Include a sequence of values in the statistics. More... | |
Inserters | |
This_t & | add (Data_t value) |
Include a single value in the statistics. More... | |
This_t & | add (std::initializer_list< Data_t > values) |
Include a sequence of values in the statistics. More... | |
template<typename Iter > | |
This_t & | add (Iter begin, Iter end) |
Include a sequence of values in the statistics. More... | |
Protected Attributes | |
Data_t | minimum = std::numeric_limits<Data_t>::max() |
the accumulated minimum More... | |
Data_t | maximum = std::numeric_limits<Data_t>::min() |
the accumulated maximum More... | |
Keeps track of the minimum and maximum value we observed.
T | type of datum |
Implementation note: a similar class with an arbitrary comparison rule would require a careful choice of initial values for minimum and maximum, or a entry count that should be checked at each insertion. We save that slight overhead here.
Definition at line 748 of file StatCollector.h.
using lar::util::MinMaxCollector< T >::Data_t = T |
type of data we collect
Definition at line 750 of file StatCollector.h.
using lar::util::MinMaxCollector< T >::This_t = MinMaxCollector<T> |
this type
Definition at line 751 of file StatCollector.h.
|
default |
Default constructor: no data collected so far.
|
inline |
Constructor: starts with parsing the specified data.
Definition at line 758 of file StatCollector.h.
|
inline |
Include a sequence of values in the statistics.
Iter | type of an iterator on values |
begin | iterator pointing to the first value to be included |
end | iterator pointing to the last value to be included |
Definition at line 768 of file StatCollector.h.
lar::util::MinMaxCollector< T > & lar::util::MinMaxCollector< T >::add | ( | Data_t | value | ) |
Include a single value in the statistics.
value | the value to be added |
Definition at line 1090 of file StatCollector.h.
|
inline |
Include a sequence of values in the statistics.
values | the values to be added |
Definition at line 1100 of file StatCollector.h.
This_t& lar::util::MinMaxCollector< T >::add | ( | Iter | begin, |
Iter | end | ||
) |
Include a sequence of values in the statistics.
Iter | type of an iterator on values |
begin | iterator pointing to the first value to be included |
end | iterator pointing to the last value to be included |
|
inline |
Definition at line 1106 of file StatCollector.h.
|
inline |
Removes all statistics and reinitializes the object.
Definition at line 1114 of file StatCollector.h.
|
inline |
Returns whether at least one datum has been added.
Definition at line 804 of file StatCollector.h.
|
inline |
Returns the accumulated maximum, or a very small number if no values.
Definition at line 810 of file StatCollector.h.
|
inline |
Returns the accumulated minimum, or a very large number if no values.
Definition at line 807 of file StatCollector.h.
|
protected |
the accumulated maximum
Definition at line 821 of file StatCollector.h.
|
protected |
the accumulated minimum
Definition at line 818 of file StatCollector.h.