32 class MetricsDiffArray;
43 using Iterator =
typename std::vector<T>::iterator;
109 const
std::chrono::system_clock::time_point&
timestamp() const noexcept;
136 const MetricsSource::FieldInfo
fieldInfoAtIndex(
size_t index) const noexcept;
153 size_t size() const noexcept;
169 const T&
at(
size_t index) const;
177 inline T& operator[](
size_t index) {
return this->data_[index]; }
185 inline const T&
operator[](
size_t index)
const {
return this->data_[index]; }
MetricsSource::SourceInterests sourceInterests() const noexcept
Returns the source interests.
MetricsSource::SourceInterests sourceInterests_
Boolean arrays to store source interests.
static constexpr size_t count
Number of sources.
std::pair< Iterator, Iterator > metricsSliceForSource(size_t sourceIndex)
Returns the iterator pair associated with a source.
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.
std::chrono::system_clock::time_point timestamp_
Time at which metrics were collected.
std::shared_ptr< std::vector< MetricsSource::Interests > > SourceInterests
Type used to store and share interests of multiple sources.
std::vector< std::string > FieldName
Type used for field names (an array of strings)
Iterator begin() noexcept
Returns an iterator to the first element of the container.
void setIterators() noexcept
Update internal iterators pairs.
T & at(size_t index)
Access specified element.
Simple struct to hold references to each source singleton.
Generic class to store and manage metrics.
friend MetricsDiffArray
To allow internal access by subclass.
void setSourcesInterests(MetricsSource::SourceInterests sourceInterests) noexcept
Set the source interests.
std::vector< T > data_
Underlying data storage.
const MetricsSource::FieldInfo fieldInfoAtIndex(size_t index) const noexcept
Get details about a specific metric field.
typename std::vector< DataValueType >::iterator Iterator
Iterator type.
const std::vector< MetricsSource::FieldInfo > allFieldsInfo() const noexcept
Get details about all fields.
std::array< std::pair< Iterator, Iterator >, MetricsSource::MetricsSourceArray::count > sourceIterators_
Iterators pairs associating metrics to a source.
DataValueType ValueType
Type of stored metrics on the container.
Iterator end() noexcept
Returns an iterator to the element following the last element of the container.
typename std::vector< DataValueType >::const_iterator ConstIterator
Const iterator type.
size_t fieldCount() const noexcept
Returns the total number of available metrics.
const std::chrono::system_clock::time_point & timestamp() const noexcept
Returns the timestamp of stored metrics.
MetricsSource::MetricsSourceArray sources_
Array of sources to fetch data from.
const T & operator[](size_t index) const
Access specified element.
size_t size() const noexcept
Returns the size of the underlying array.
void setSize() noexcept
Resize the underlying container to fit the total number of metrics.