Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Stats Class Reference

Public Types

using FloatType = double
 
using ValueType = int32_t
 

Public Member Functions

void clear ()
 
void add (ValueType value)
 Appends a data point to the statistics.
 
FloatType favg ()
 
int32_t avg ()
 
FloatType stddev ()
 
std::string debug_string ()
 Creates a half-a-line printout of this stats object for debug purposes.
 

Private Attributes

uint32_t count_
 Number of samples added.
 
ValueType max_
 Maximum value found since the last clear.
 
int64_t sum_
 Sum of sample values added.
 
FloatType qsum_
 Sum of squares of sample values added.
 

Detailed Description

Definition at line 43 of file Stats.hxx.

Member Typedef Documentation

◆ FloatType

using Stats::FloatType = double

Definition at line 46 of file Stats.hxx.

◆ ValueType

using Stats::ValueType = int32_t

Definition at line 47 of file Stats.hxx.

Constructor & Destructor Documentation

◆ Stats()

Stats::Stats ( )
inline

Definition at line 49 of file Stats.hxx.

Member Function Documentation

◆ add()

void Stats::add ( ValueType  value)
inline

Appends a data point to the statistics.

Parameters
valuethe data point.

Definition at line 65 of file Stats.hxx.

◆ avg()

int32_t Stats::avg ( )
inline
Returns
the average (rounded down to nearest integer).

Definition at line 84 of file Stats.hxx.

◆ clear()

void Stats::clear ( )
inline

Definition at line 55 of file Stats.hxx.

◆ debug_string()

std::string Stats::debug_string ( )

Creates a half-a-line printout of this stats object for debug purposes.

Definition at line 39 of file Stats.cxx.

◆ favg()

FloatType Stats::favg ( )
inline
Returns
the average

Definition at line 78 of file Stats.hxx.

◆ stddev()

FloatType Stats::stddev ( )
inline
Returns
the sample standard deviation (uncorrected).

Definition at line 90 of file Stats.hxx.

Member Data Documentation

◆ count_

uint32_t Stats::count_
private

Number of samples added.

Definition at line 102 of file Stats.hxx.

◆ max_

ValueType Stats::max_
private

Maximum value found since the last clear.

Definition at line 104 of file Stats.hxx.

◆ qsum_

FloatType Stats::qsum_
private

Sum of squares of sample values added.

Definition at line 108 of file Stats.hxx.

◆ sum_

int64_t Stats::sum_
private

Sum of sample values added.

Definition at line 106 of file Stats.hxx.


The documentation for this class was generated from the following files: