5#ifndef AthenaMonitoringKernel_MonitoredCollection_h
6#define AthenaMonitoringKernel_MonitoredCollection_h
97 ObjectsCollection<T, double>
110 ObjectsCollection<T, std::string>
137 Collection(std::string name,
const std::reference_wrapper<T>& collection,
143 ObjectsRefCollection<T, double>
144 Collection(std::string name,
const std::reference_wrapper<T>&& collection,
149 Collection(std::string name,
const std::reference_wrapper<T>& collection,
155 ObjectsRefCollection<T, std::string>
156 Collection(std::string name,
const std::reference_wrapper<T>&& collection,
183 static_assert(std::is_convertible<value_type, double>::value or std::is_constructible<std::string, value_type>::value,
"Conversion of collection values to double or string is impossible");
191 virtual double get([[maybe_unused]]
size_t i)
const override {
192 if constexpr (std::is_convertible_v<value_type, double>)
198 virtual std::string
getString([[maybe_unused]]
size_t i)
const override {
199 if constexpr (std::is_constructible_v<std::string, value_type>)
206 return std::is_constructible<std::string, value_type>::value;
209 virtual size_t size()
const override {
234 static_assert(std::is_convertible<value_type, double>::value or std::is_constructible<std::string, value_type>::value,
"Conversion of collection values to double or string is impossible");
242 virtual double get([[maybe_unused]]
size_t i)
const override {
243 if constexpr (std::is_convertible_v<value_type, double>)
249 virtual std::string
getString([[maybe_unused]]
size_t i)
const override {
250 if constexpr (std::is_constructible_v<std::string, value_type>)
257 return std::is_constructible<std::string, value_type>::value;
260 virtual size_t size()
const override {
289 static_assert(std::is_convertible<R, double>::value or std::is_constructible<std::string, R>::value,
"Conversion from type returned by the converter/accessor to double or string is impossible");
302 virtual double get([[maybe_unused]]
size_t i)
const override {
303 if constexpr (std::is_convertible_v<R, double>)
309 virtual std::string
getString([[maybe_unused]]
size_t i)
const override {
310 if constexpr (std::is_constructible_v<std::string, R>)
317 return std::is_constructible<std::string, R>::value;
319 virtual size_t size()
const override {
352 static_assert(std::is_convertible<R, double>::value or std::is_constructible<std::string, R>::value,
"Conversion from type returned by the converter/accessor to double or string is impossible");
365 virtual double get([[maybe_unused]]
size_t i)
const override {
366 if constexpr (std::is_convertible_v<R, double>)
372 virtual std::string
getString([[maybe_unused]]
size_t i)
const override {
373 if constexpr (std::is_constructible_v<std::string, R>)
380 return std::is_constructible<std::string, R>::value;
382 virtual size_t size()
const override {
const std::string & name() const
IMonitoredVariable(std::string name)
Monitoring of object collections (internal)
typename detail::make_pointer_const< value_type >::type const_value_type
virtual bool hasStringRepresentation() const override
indcates that the stored content can be converted to strings
ObjectsCollection(std::string name, const T &collection, std::function< R(const const_value_type &)> converterToR)
virtual double get(size_t i) const override
friend ObjectsCollection< U, double > Collection(std::string name, const U &collection, std::function< double(const typename ObjectsCollection< U, double >::const_value_type &)> accessor)
friend ObjectsCollection< U, std::string > Collection(std::string name, const U &collection, std::function< std::string(const typename ObjectsCollection< U, std::string >::const_value_type &)> converterToString)
virtual std::string getString(size_t i) const override
ObjectsCollection(ObjectsCollection &&)=default
ObjectsCollection & operator=(ObjectsCollection const &)=delete
ObjectsCollection(ObjectsCollection const &)=delete
virtual size_t size() const override
gives size of vector representation
typename detail::get_value_type< T >::value_type value_type
Type of the collection elements.
std::function< R(const const_value_type &)> m_converterToR
Monitoring of object collection references (internal)
ObjectsRefCollection & operator=(ObjectsRefCollection const &)=delete
virtual std::string getString(size_t i) const override
std::function< R(const const_value_type &)> m_converterToR
virtual bool hasStringRepresentation() const override
indcates that the stored content can be converted to strings
const std::reference_wrapper< T > & m_collection
virtual size_t size() const override
gives size of vector representation
ObjectsRefCollection(ObjectsRefCollection &&)=default
ObjectsRefCollection(ObjectsRefCollection const &)=delete
friend ObjectsRefCollection< U, std::string > Collection(std::string name, const std::reference_wrapper< U > &collection, std::function< std::string(const typename ObjectsRefCollection< U, std::string >::const_value_type &)> converterToString)
friend ObjectsRefCollection< U, double > Collection(std::string name, const std::reference_wrapper< U > &collection, std::function< double(const typename ObjectsRefCollection< U, double >::const_value_type &)> accessor)
typename detail::get_value_type< T >::value_type value_type
Type of the collection elements.
typename detail::make_pointer_const< value_type >::type const_value_type
virtual double get(size_t i) const override
ObjectsRefCollection(std::string name, const std::reference_wrapper< T > &collection, std::function< R(const const_value_type &)> converterToR)
Internal class not to be used by end user.
virtual double get(size_t i) const override
ValuesCollection & operator=(ValuesCollection const &)=delete
virtual std::string getString(size_t i) const override
typename detail::get_value_type< T >::value_type value_type
Type of the collection elements.
ValuesCollection(std::string vname, const T &collection)
virtual bool hasStringRepresentation() const override
indcates that the stored content can be converted to strings
ValuesCollection(ValuesCollection const &)=delete
virtual size_t size() const override
gives size of vector representation
friend ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
ValuesCollection(ValuesCollection &&)=default
Internal class not to be used by end user.
ValuesRefCollection(ValuesRefCollection const &)=delete
ValuesRefCollection(ValuesRefCollection &&)=default
friend ValuesRefCollection< T > Collection(std::string name, const std::reference_wrapper< T > &collection)
Declare a monitored (double-convertible) collection reference.
const std::reference_wrapper< T > & m_collection
virtual std::string getString(size_t i) const override
virtual bool hasStringRepresentation() const override
indcates that the stored content can be converted to strings
typename detail::get_value_type< T >::value_type value_type
Type of the collection elements.
ValuesRefCollection & operator=(ValuesRefCollection const &)=delete
virtual double get(size_t i) const override
virtual size_t size() const override
gives size of vector representation
ValuesRefCollection(std::string vname, const std::reference_wrapper< T > &collection)
Generic monitoring tool for athena components.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Get element type for containers.