49 this->timestamp_ = other.timestamp_;
50 this->data_ = other.data_;
58 return this->sourceInterests_;
63 this->sourceInterests_ = sourceInterests;
69 return this->timestamp_;
77 this->sources_.forEach([&](
auto& source,
size_t ) {
78 size += source.fieldCount();
86 std::vector<size_t> indexes;
89 this->sources_.forEach([&](
auto& source,
size_t sourceIndex) {
90 if (fieldName.front() == source.fieldNameSourcePrefix()) {
92 indexes = source.indexesOfFieldName(fieldName, interests);
93 for (
auto& i : indexes)
96 baseIndex += std::distance(this->sourceIterators_[sourceIndex].first, this->sourceIterators_[sourceIndex].second);
107 this->sources_.forEach([&](
auto& source,
size_t sourceIndex) {
110 if (index < source.fieldCount()) {
111 info = source.fieldInfoAtIndex(index);
115 index -= std::distance(this->sourceIterators_[sourceIndex].first, this->sourceIterators_[sourceIndex].second);
123 std::vector<MetricsSource::FieldInfo> allInfo;
125 this->sources_.forEach([&](
auto& source,
size_t ) {
126 std::vector<MetricsSource::FieldInfo> info = source.allFieldsInfo();
127 std::move(info.begin(), info.end(), std::back_inserter(allInfo));
136 return this->data_.
size();
141 return this->data_.
at(index);
146 return this->data_.
at(index);
152 return this->sourceIterators_[sourceIndex];
158 return this->data_.
begin();
163 return this->data_.
begin();
168 return this->data_.
end();
173 return this->data_.
end();
179 size_t size = this->fieldCount();
180 this->data_.resize(size);
181 this->setIterators();
186 auto itr = this->data_.
begin();
187 this->sources_.forEach([&](
auto& source,
size_t sourceIndex) {
188 this->sourceIterators_[sourceIndex].first = itr;
189 itr += source.fieldCount();
190 this->sourceIterators_[sourceIndex].second = itr;
Object used to describe a field (or metric)
MetricsSource::SourceInterests sourceInterests_
Boolean arrays to store source interests.
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.
T & at(size_t index)
Access specified element.
Generic class to store and manage metrics.
SourceInterests makeSourceInterests(bool value)
Construct a new shared pointer to a SourceInterests object.
Boolean array to keep track of which fields a source has to fetch metrics for.
typename std::vector< T >::iterator Iterator
Iterator type.
Iterator end() noexcept
Returns an iterator to the element following the last element of the container.
typename std::vector< T >::const_iterator ConstIterator
Const iterator type.
std::vector< DataValueType >::iterator Iterator
Iterator type of MetricsDataArray.
size_t size() const noexcept
Returns the size of the underlying array.