ANNA Suite  2020b
Multipurpose development suite for Telco applications
Public Member Functions | List of all members
anna::statistics::Accumulator Class Reference

Contains statistical sample information. More...

#include <Accumulator.hpp>

Public Member Functions

 Accumulator (const std::string &name)
 
 ~Accumulator ()
 
void setName (const std::string &name)
 
int addConcept (const std::string &description, const std::string &unit, const bool &integerNatureSample=true, const char *conceptNameFormat="%s [%s]")
 
void process (const int &conceptId, const double &value) noexcept(false)
 
void reset (void)
 
void reset (const int &conceptId) noexcept(false)
 
const Accumulatoroperator= (const Accumulator &accumulator)
 
const std::string & getName () const
 
unsigned long long int sampleSize (const int &conceptId) const noexcept(false)
 
double getValue (const int &conceptId, const Operation::Type &operation) const noexcept(false)
 
std::string asString (const int &numberOfDecimals=2) const
 
anna::xml::NodeasXML (anna::xml::Node *parent, const int &numberOfDecimals=2) const
 

Detailed Description

Contains statistical sample information.

Accumulated data information for statistic sample. It can manage a set of concepts at the same time.

Constructor & Destructor Documentation

◆ Accumulator()

anna::statistics::Accumulator::Accumulator ( const std::string &  name)
inline

Constructor.

Parameters
nameAccumulator name
112 : a_name(name) {};

◆ ~Accumulator()

anna::statistics::Accumulator::~Accumulator ( )
inline

Destructor.

117 {;}

Member Function Documentation

◆ addConcept()

int anna::statistics::Accumulator::addConcept ( const std::string &  description,
const std::string &  unit,
const bool &  integerNatureSample = true,
const char *  conceptNameFormat = "%s [%s]" 
)

Adds a new statistic concept through the accumulator, to ease the concept name creation, which will be a string defined by: concept name + ': ' + accumulator name.

Parameters
descriptionConcept description; e.g.: processing time, messages size, etc.
unitConcept unit description
integerNatureSampleMost of cases we will measure 'time' with the unit which force integer values (is more intuitive 850 msecs than 0,850 secs). Then, it is true by default. This is useful to advice better representation for some indicators like minimum/maximum within integer samples.
conceptNameFormatFormat to register the complete concept name. Will be parsed using (in order) the provided description, and the accumulator name: '<concept description>=""> [<accumulator name>="">]' by default.
Returns
Assigned concept identification number (sequence)

◆ asString()

std::string anna::statistics::Accumulator::asString ( const int &  numberOfDecimals = 2) const

Class string representation

Parameters
numberOfDecimalsNumber of float decimals at representation string. Default is 2.
Returns
String with class content

◆ asXML()

anna::xml::Node* anna::statistics::Accumulator::asXML ( anna::xml::Node parent,
const int &  numberOfDecimals = 2 
) const

Class XML representation

Parameters
numberOfDecimalsNumber of float decimals at XML representation. Default is 2.
Returns
XML with class content

◆ getName()

const std::string& anna::statistics::Accumulator::getName ( void  ) const
inline

Gets the accumulator name

Returns
Accumulator name
191 { return a_name; }

◆ getValue()

double anna::statistics::Accumulator::getValue ( const int &  conceptId,
const Operation::Type operation 
) const
noexcept

Get statistical information

Parameters
conceptIdStatistical concept
operationSolicited operation
Returns
Value for solicited conceptId/operation
See also
sampleSize()
asXML()

◆ operator=()

const Accumulator& anna::statistics::Accumulator::operator= ( const Accumulator accumulator)

Copy operator

Parameters
accumulatorClass instance source of data
Returns
Returns copied reference

◆ process()

void anna::statistics::Accumulator::process ( const int &  conceptId,
const double &  value 
)
noexcept

Process new value for the sample regarding a concept identifier previously registered through the engine.

Parameters
conceptIdstatistical concept processed
valueValue for processed item
See also
reset()

◆ reset() [1/2]

void anna::statistics::Accumulator::reset ( void  )

Reset sample for all concepts

See also
process()

◆ reset() [2/2]

void anna::statistics::Accumulator::reset ( const int &  conceptId)
noexcept

Reset sample for provided concept

Parameters
conceptIdConcept identification to be reset
See also
process()

◆ sampleSize()

unsigned long long int anna::statistics::Accumulator::sampleSize ( const int &  conceptId) const
noexcept

Gets current sample size for any concept id

Parameters
conceptIdConcept identification
Returns
Sample size
See also
getValue()
asXML()

◆ setName()

void anna::statistics::Accumulator::setName ( const std::string &  name)
inline

Sets the accumulator name

Parameters
nameName provided
125 { a_name = name; }

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