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

#include <Engine.hpp>

Inheritance diagram for anna::statistics::Engine:
Inheritance graph
[legend]
Collaboration diagram for anna::statistics::Engine:
Collaboration graph
[legend]

Public Member Functions

 ~Engine ()
 
int addConcept (const std::string &description, const std::string &unit, const bool &integerNatureSample=true)
 
void enable (void)
 
void disable (void)
 
bool enableSampleLog (const int &id=-1, const char *sampleFileName=NULL)
 
bool disableSampleLog (const int &id=-1)
 
bool getConcept (const int &id, std::string &description, std::string &unit, bool &integerNatureSample) const
 
bool enabled (void) const
 
AccumulatorcreateAccumulator (const std::string &name) noexcept(false)
 
AccumulatorgetAccumulator (const std::string &name)
 
std::string asString (void) const
 
anna::xml::NodeasXML (anna::xml::Node *parent, const int &numberOfDecimals=2) const
 

Friends

class anna::Singleton< Engine >
 
class Accumulator
 

Additional Inherited Members

- Static Public Member Functions inherited from anna::Singleton< Engine >
static Engine & instantiate ()
 
static void release ()
 

Detailed Description

Class used to configure general behaviour of statistics processing By default, the engine is disabled and enable must be invoked

Constructor & Destructor Documentation

◆ ~Engine()

anna::statistics::Engine::~Engine ( )

Destructor

Member Function Documentation

◆ addConcept()

int anna::statistics::Engine::addConcept ( const std::string &  description,
const std::string &  unit,
const bool &  integerNatureSample = true 
)

Adds a new statistic concept (for example "Time_between_processA_and_processB", "Database time", etc)

Parameters
descriptionConcept description
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.
Returns
Assigned concept identification number (sequence)

◆ asString()

std::string anna::statistics::Engine::asString ( void  ) const

Class string representation

Returns
String with class content

◆ asXML()

anna::xml::Node* anna::statistics::Engine::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

◆ createAccumulator()

Accumulator* anna::statistics::Engine::createAccumulator ( const std::string &  name)
noexcept

Creates a statistic accumulator

Parameters
nameAccumulator name
Returns
The accumulator created or exception when already exists for the provided name.

◆ disable()

void anna::statistics::Engine::disable ( void  )
inline

Starts statistics engine

97 { a_enabled = false; }

◆ disableSampleLog()

bool anna::statistics::Engine::disableSampleLog ( const int &  id = -1)

Disable sample log for statistics processings

Parameters
idConcept identification. If -1 value is provided, all concepts will be deactivated.
Returns
false if not concept is registered with provided id
Warning
Many systems add concepts dynamically. This method only affects to current concepts registered at statistics engine.

◆ enable()

void anna::statistics::Engine::enable ( void  )
inline

Stops statistics engine

91 { a_enabled = true; }

◆ enabled()

bool anna::statistics::Engine::enabled ( void  ) const
inline

Boolean about engine state (enabled / disabled)

143 { return (a_enabled); }

◆ enableSampleLog()

bool anna::statistics::Engine::enableSampleLog ( const int &  id = -1,
const char *  sampleFileName = NULL 
)

Enable sample log for statistics processings. Engine starts with this feature disabled. When a new concept id is added to the engine, sample log is also disabled for it.

Sample logs are used to dump each processing for a certain concept identification (<unix timestamp>="">,<processed value>="">).

Parameters
idConcept identification. If -1 value is provided, all concepts will be activated.
sampleFileNameAbsolute or relative to execution path, and completed with extension '.<concept id>="">.csv'. Empty string, disables log. Default file name is 'sample'
Returns
false if not concept is registered with provided id
Warning
Many systems add concepts dynamically. This method only affects to current concepts registered at statistics engine.

◆ getAccumulator()

Accumulator* anna::statistics::Engine::getAccumulator ( const std::string &  name)

Returns accumulator instance identified by name.

Parameters
nameAccumulator name
Returns
The accumulator instance identified by name provided, NULL if not found

◆ getConcept()

bool anna::statistics::Engine::getConcept ( const int &  id,
std::string &  description,
std::string &  unit,
bool &  integerNatureSample 
) const

Gets statistic concept information.

Parameters
idConcept identification.
descriptionConcept description returned by reference
unitConcept unit description returned by reference
integerNatureSamplenature returned by reference
Returns
false if not concept is registered with provided id

Friends And Related Function Documentation

◆ Accumulator

friend class Accumulator
friend

◆ anna::Singleton< Engine >

friend class anna::Singleton< Engine >
friend

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