DiSMEC++
dismec::stats::TaggedStat Class Referencefinal

#include <statistics.h>

Inheritance diagram for dismec::stats::TaggedStat:
dismec::stats::StatImplBase< TaggedStat > dismec::stats::Statistics

Public Member Functions

 TaggedStat (std::string tag, int max_tag, std::string transform_name={}, std::function< double(double)> transform={})
 
 ~TaggedStat () override=default
 
void record_int (long value) override
 
void record_real (real_t value) override
 
std::unique_ptr< Statisticsclone () const override
 
void merge_imp (const TaggedStat &other)
 
nlohmann::json to_json () const override
 Converts the statistics current value into a json object. More...
 
void setup (const StatisticsCollection &source) override
 This function has to be called before the Statistics is used to collect data for the first time. More...
 
- Public Member Functions inherited from dismec::stats::StatImplBase< TaggedStat >
void merge (const Statistics &other) override
 Merges this statistics of another one of the same type and settings. More...
 
void record_vec (const DenseRealVector &vector) override
 
- Public Member Functions inherited from dismec::stats::Statistics
virtual ~Statistics ()=default
 
void record (int integer)
 
void record (long integer)
 
void record (real_t real)
 
void record (const DenseRealVector &vector)
 

Private Attributes

std::vector< long > m_Counters
 
std::vector< double > m_Sums
 
std::vector< double > m_SumsSquared
 
TagContainer m_Tag
 
int m_MaxTag = -1
 
std::function< double(double)> m_Transform
 
std::string m_TransformName
 

Detailed Description

Definition at line 42 of file statistics.h.

Constructor & Destructor Documentation

◆ TaggedStat()

TaggedStat::TaggedStat ( std::string  tag,
int  max_tag,
std::string  transform_name = {},
std::function< double(double)>  transform = {} 
)

Definition at line 54 of file statistics.cpp.

◆ ~TaggedStat()

dismec::stats::TaggedStat::~TaggedStat ( )
overridedefault

Member Function Documentation

◆ clone()

std::unique_ptr< Statistics > TaggedStat::clone ( ) const
overridevirtual

◆ merge_imp()

void TaggedStat::merge_imp ( const TaggedStat other)

Definition at line 90 of file statistics.cpp.

References m_Counters, m_Sums, m_SumsSquared, and dismec::ssize().

◆ record_int()

void TaggedStat::record_int ( long  value)
overridevirtual

Reimplemented from dismec::stats::Statistics.

Definition at line 62 of file statistics.cpp.

References dismec::stats::Statistics::record().

◆ record_real()

void TaggedStat::record_real ( real_t  value)
overridevirtual

◆ setup()

void TaggedStat::setup ( const StatisticsCollection source)
overridevirtual

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 from dismec::stats::Statistics.

Definition at line 110 of file statistics.cpp.

References dismec::stats::TagContainer::get_name(), dismec::stats::StatisticsCollection::get_tag_by_name(), and m_Tag.

◆ to_json()

nlohmann::json TaggedStat::to_json ( ) const
overridevirtual

Converts the statistics current value into a json object.

Implements dismec::stats::Statistics.

Definition at line 105 of file statistics.cpp.

References m_Counters, m_Sums, m_SumsSquared, and m_TransformName.

Member Data Documentation

◆ m_Counters

std::vector<long> dismec::stats::TaggedStat::m_Counters
private

Definition at line 55 of file statistics.h.

Referenced by merge_imp(), record_real(), and to_json().

◆ m_MaxTag

int dismec::stats::TaggedStat::m_MaxTag = -1
private

Definition at line 60 of file statistics.h.

Referenced by clone(), and record_real().

◆ m_Sums

std::vector<double> dismec::stats::TaggedStat::m_Sums
private

Definition at line 56 of file statistics.h.

Referenced by merge_imp(), record_real(), and to_json().

◆ m_SumsSquared

std::vector<double> dismec::stats::TaggedStat::m_SumsSquared
private

Definition at line 57 of file statistics.h.

Referenced by merge_imp(), record_real(), and to_json().

◆ m_Tag

TagContainer dismec::stats::TaggedStat::m_Tag
private

Definition at line 59 of file statistics.h.

Referenced by clone(), record_real(), and setup().

◆ m_Transform

std::function<double(double)> dismec::stats::TaggedStat::m_Transform
private

Definition at line 62 of file statistics.h.

Referenced by clone(), and record_real().

◆ m_TransformName

std::string dismec::stats::TaggedStat::m_TransformName
private

Definition at line 63 of file statistics.h.

Referenced by clone(), and to_json().


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