DiSMEC++
dismec::stats::Statistics Class Referenceabstract

TODO maybe we should solve this with a variant which does the dispatch of expected type and tag. More...

#include <stats_base.h>

Inheritance diagram for dismec::stats::Statistics:
dismec::stats::StatImplBase< VectorReductionStat > dismec::stats::StatImplBase< TaggedStat > dismec::stats::StatImplBase< MultiStat > dismec::stats::StatImplBase< BasicStat > dismec::stats::StatImplBase< FullRecordStat > dismec::stats::StatImplBase< CounterStat > anonymous_namespace{collection.cpp}::MockStat dismec::stats::StatImplBase< Derived >

Public Member Functions

virtual ~Statistics ()=default
 
void record (int integer)
 
void record (long integer)
 
void record (real_t real)
 
void record (const DenseRealVector &vector)
 
virtual std::unique_ptr< Statisticsclone () const =0
 
virtual void setup (const StatisticsCollection &source)
 This function has to be called before the Statistics is used to collect data for the first time. More...
 
virtual void merge (const Statistics &other)=0
 Merges this statistics of another one of the same type and settings. More...
 
virtual nlohmann::json to_json () const =0
 Converts the statistics current value into a json object. More...
 

Private Member Functions

virtual void record_int (long integer)
 
virtual void record_real (real_t real)
 
virtual void record_vec (const DenseRealVector &vector)
 

Detailed Description

TODO maybe we should solve this with a variant which does the dispatch of expected type and tag.

Definition at line 65 of file stats_base.h.

Constructor & Destructor Documentation

◆ ~Statistics()

virtual dismec::stats::Statistics::~Statistics ( )
virtualdefault

Member Function Documentation

◆ clone()

◆ merge()

virtual void dismec::stats::Statistics::merge ( const Statistics other)
pure virtual

Merges this statistics of another one of the same type and settings.

This operation is used to perform the reduction of the thread-local statistics into a single global statistics. For this to be possible, the merged statistics need to have not only the same type, but also the same settings (e.g. number of bins in a histogram). This is true for the thread local copies, which are clones of one another.

Parameters
otherThe statistics object to be merged into this. Must be of same type and have the same settings, e.g. a clone of this.

Implemented in dismec::stats::StatImplBase< Derived >, dismec::stats::StatImplBase< VectorReductionStat >, dismec::stats::StatImplBase< TaggedStat >, dismec::stats::StatImplBase< MultiStat >, dismec::stats::StatImplBase< BasicStat >, dismec::stats::StatImplBase< FullRecordStat >, dismec::stats::StatImplBase< CounterStat >, and anonymous_namespace{collection.cpp}::MockStat.

◆ record() [1/4]

void dismec::stats::Statistics::record ( const DenseRealVector vector)
inline

Definition at line 74 of file stats_base.h.

References record_vec().

◆ record() [2/4]

void dismec::stats::Statistics::record ( int  integer)
inline

◆ record() [3/4]

void dismec::stats::Statistics::record ( long  integer)
inline

Definition at line 72 of file stats_base.h.

References record_int().

◆ record() [4/4]

void dismec::stats::Statistics::record ( real_t  real)
inline

Definition at line 73 of file stats_base.h.

References record_real().

◆ record_int()

virtual void dismec::stats::Statistics::record_int ( long  integer)
inlineprivatevirtual

◆ record_real()

virtual void dismec::stats::Statistics::record_real ( real_t  real)
inlineprivatevirtual

◆ record_vec()

◆ setup()

virtual void dismec::stats::Statistics::setup ( const StatisticsCollection source)
inlinevirtual

This function has to be called before the Statistics is used to collect data for the first time.

This will look up any tags that might be used within the statistics in source.

Exceptions
std::runtime_errorif a tag is required by the statistics but cannot be found in source.
Parameters
sourceThe statistics collection from which the tags can be read.

Reimplemented in dismec::stats::MultiStat, and dismec::stats::TaggedStat.

Definition at line 84 of file stats_base.h.

◆ to_json()

virtual nlohmann::json dismec::stats::Statistics::to_json ( ) const
pure virtual

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