MetroCollect  2.3.4
MetroCollect::MetricsStatsArray< T > Class Template Reference

Class to store metric statistics, and the indexes of those requested. More...

#include <MetricsStatsArray.h>

Inheritance diagram for MetroCollect::MetricsStatsArray< T >:
Collaboration diagram for MetroCollect::MetricsStatsArray< T >:

Classes

struct  IndexedValue
 Small struct to store an index of a value in a container and a reference to its value. More...
 

Public Member Functions

 MetricsStatsArray () noexcept
 Construct a new Metrics Stats Array object. More...
 
const std::chrono::system_clock::time_point & startTime () const noexcept
 Get time of earlier metrics. More...
 
const std::chrono::system_clock::time_point & endTime () const noexcept
 Get time of latest metrics. More...
 
void setStartTime (std::chrono::system_clock::time_point startTime) noexcept
 Set the time of earlier metrics used to compute statistics. More...
 
void setEndTime (std::chrono::system_clock::time_point endTime) noexcept
 Set the time of latest metrics used to compute statistics. More...
 
const std::set< size_t > & indexes () const noexcept
 Returns set of requested metrics. More...
 
void setIndexes (std::set< size_t > indexes) noexcept
 Set which indexes are requested. More...
 
size_t indexCount () const noexcept
 Returns the number of requested metrics. More...
 
const std::vector< IndexedValue > & indexedValues () const noexcept
 Returns the requested metric indexes and values. More...
 
- Public Member Functions inherited from MetroCollect::MetricsArray< T >
 MetricsArray () noexcept
 Construct a new Metrics Array object. More...
 
 MetricsArray (MetricsSource::SourceInterests sourceInterests) noexcept
 Construct a new Metrics Array object. More...
 
 MetricsArray (const MetricsArray &other) noexcept
 Copy constructor. More...
 
MetricsArrayoperator= (const MetricsArray &other) noexcept
 Assignment operator. More...
 
MetricsSource::SourceInterests sourceInterests () const noexcept
 Returns the source interests. More...
 
void setSourcesInterests (MetricsSource::SourceInterests sourceInterests) noexcept
 Set the source interests. More...
 
const std::chrono::system_clock::time_point & timestamp () const noexcept
 Returns the timestamp of stored metrics. More...
 
size_t fieldCount () const noexcept
 Returns the total number of available metrics. More...
 
const std::vector< size_t > indexesOfFieldName (const MetricsSource::FieldName &fieldName, bool setInterest=true) const noexcept
 Finds indexes of a field from its name across sources. More...
 
const MetricsSource::FieldInfo fieldInfoAtIndex (size_t index) const noexcept
 Get details about a specific metric field. More...
 
const std::vector< MetricsSource::FieldInfoallFieldsInfo () const noexcept
 Get details about all fields. More...
 
size_t size () const noexcept
 Returns the size of the underlying array. More...
 
T & at (size_t index)
 Access specified element. More...
 
const T & at (size_t index) const
 Access specified element. More...
 
T & operator[] (size_t index)
 Access specified element. More...
 
const T & operator[] (size_t index) const
 Access specified element. More...
 
std::pair< Iterator, IteratormetricsSliceForSource (size_t sourceIndex)
 Returns the iterator pair associated with a source. More...
 
Iterator begin () noexcept
 Returns an iterator to the first element of the container. More...
 
const ConstIterator begin () const noexcept
 Returns an iterator to the first element of the container. More...
 
Iterator end () noexcept
 Returns an iterator to the element following the last element of the container. More...
 
const ConstIterator end () const noexcept
 Returns an iterator to the element following the last element of the container. More...
 

Protected Attributes

std::set< size_t > indexes_
 Set of requested metrics. More...
 
std::vector< IndexedValuevalues_
 Array of requested metrics. More...
 
std::chrono::system_clock::time_point startTime_
 Time of the earlier metric. More...
 
- Protected Attributes inherited from MetroCollect::MetricsArray< T >
MetricsSource::SourceInterests sourceInterests_
 Boolean arrays to store source interests. More...
 
std::chrono::system_clock::time_point timestamp_
 Time at which metrics were collected. More...
 
std::vector< T > data_
 Underlying data storage. More...
 
MetricsSource::MetricsSourceArray sources_
 Array of sources to fetch data from. More...
 
std::array< std::pair< Iterator, Iterator >, MetricsSource::MetricsSourceArray::countsourceIterators_
 Iterators pairs associating metrics to a source. More...
 
friend MetricsDiffArray
 To allow internal access by subclass. More...
 

Additional Inherited Members

- Public Types inherited from MetroCollect::MetricsArray< T >
using ValueType = T
 Type of stored metrics on the container. More...
 
using Iterator = typename std::vector< T >::iterator
 Iterator type. More...
 
using ConstIterator = typename std::vector< T >::const_iterator
 Const iterator type. More...
 
- Protected Member Functions inherited from MetroCollect::MetricsArray< T >
void setSize () noexcept
 Resize the underlying container to fit the total number of metrics. More...
 
void setIterators () noexcept
 Update internal iterators pairs. More...
 

Detailed Description

template<typename T>
class MetroCollect::MetricsStatsArray< T >

Class to store metric statistics, and the indexes of those requested.

Template Parameters
TType of stored metrics on the container

Definition at line 36 of file MetricsStatsArray.h.

Constructor & Destructor Documentation

◆ MetricsStatsArray()

template<typename T >
MetroCollect::MetricsStatsArray< T >::MetricsStatsArray ( )
noexcept

Construct a new Metrics Stats Array object.

Definition at line 26 of file MetricsStatsArray.cc.

Member Function Documentation

◆ endTime()

template<typename T >
const std::chrono::system_clock::time_point & MetroCollect::MetricsStatsArray< T >::endTime ( ) const
noexcept

Get time of latest metrics.

Returns
Time of latest metrics

Definition at line 35 of file MetricsStatsArray.cc.

Here is the caller graph for this function:

◆ indexCount()

template<typename T >
size_t MetroCollect::MetricsStatsArray< T >::indexCount ( ) const
noexcept

Returns the number of requested metrics.

Returns
the number of requested metrics

Definition at line 67 of file MetricsStatsArray.cc.

◆ indexedValues()

template<typename T >
const std::vector< typename MetricsStatsArray< T >::IndexedValue > & MetroCollect::MetricsStatsArray< T >::indexedValues ( ) const
noexcept

Returns the requested metric indexes and values.

Returns
Array of requested metric indexes and values

Definition at line 73 of file MetricsStatsArray.cc.

Here is the caller graph for this function:

◆ indexes()

template<typename T >
const std::set< size_t > & MetroCollect::MetricsStatsArray< T >::indexes ( ) const
noexcept

Returns set of requested metrics.

Returns
The set of requested metrics

Definition at line 52 of file MetricsStatsArray.cc.

◆ setEndTime()

template<typename T >
void MetroCollect::MetricsStatsArray< T >::setEndTime ( std::chrono::system_clock::time_point  endTime)
noexcept

Set the time of latest metrics used to compute statistics.

Parameters
endTimethe time of latest metrics

Definition at line 46 of file MetricsStatsArray.cc.

◆ setIndexes()

template<typename T >
void MetroCollect::MetricsStatsArray< T >::setIndexes ( std::set< size_t >  indexes)
noexcept

Set which indexes are requested.

Parameters
indexesSet of requested metrics

Definition at line 57 of file MetricsStatsArray.cc.

◆ setStartTime()

template<typename T >
void MetroCollect::MetricsStatsArray< T >::setStartTime ( std::chrono::system_clock::time_point  startTime)
noexcept

Set the time of earlier metrics used to compute statistics.

Parameters
startTimethe time of earlier metrics

Definition at line 41 of file MetricsStatsArray.cc.

◆ startTime()

template<typename T >
const std::chrono::system_clock::time_point & MetroCollect::MetricsStatsArray< T >::startTime ( ) const
noexcept

Get time of earlier metrics.

Returns
Time of earlier metrics

Definition at line 30 of file MetricsStatsArray.cc.

Member Data Documentation

◆ indexes_

template<typename T>
std::set<size_t> MetroCollect::MetricsStatsArray< T >::indexes_
protected

Set of requested metrics.

Definition at line 55 of file MetricsStatsArray.h.

◆ startTime_

template<typename T>
std::chrono::system_clock::time_point MetroCollect::MetricsStatsArray< T >::startTime_
protected

Time of the earlier metric.

Definition at line 58 of file MetricsStatsArray.h.

◆ values_

template<typename T>
std::vector<IndexedValue> MetroCollect::MetricsStatsArray< T >::values_
protected

Array of requested metrics.

Definition at line 56 of file MetricsStatsArray.h.


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