5#ifndef AthenaMonitoringKernel_MonitoredScalar_h
6#define AthenaMonitoringKernel_MonitoredScalar_h
36 static_assert(std::is_convertible<T, double>::value or std::is_constructible<std::string, T>::value,
"Conversion of scalar template type to double or string is impossible");
65 Scalar(std::string
name,
const T& defaultValue, std::function<
double(
const T&)> valueTransform) :
98 operator const T&()
const {
return m_value; }
110 virtual double get(
size_t)
const override {
111 if constexpr (std::is_convertible_v<double, T>) {
119 if constexpr (std::is_constructible_v<std::string, T>) {
126 return std::is_constructible<std::string, T>::value;
129 virtual size_t size()
const override {
const std::string & name() const
IMonitoredVariable(std::string name)
friend std::string operator+(const std::string &lhs, const Scalar &rhs)
Scalar(std::string name, std::function< T()> generator)
Scalar with generator function to retrieve the value.
virtual size_t size() const override
gives size of vector representation
Scalar(Scalar &&)=default
std::function< T()> m_valueGenerator
friend std::string operator+(const Scalar &lhs, const std::string &rhs)
std::function< double(const T &)> m_valueTransform
virtual std::string getString(size_t) const override
Scalar(std::string name, const T &defaultValue, std::function< double(const T &)> valueTransform)
Scalar with default value and optional transformation applied before filling.
virtual double get(size_t) const override
Scalar & operator=(Scalar const &)=delete
Scalar(std::string name, const T &defaultValue={})
Scalar with optional default value.
virtual bool hasStringRepresentation() const override
indcates that the stored content can be converted to strings
Scalar(Scalar const &)=delete
Generic monitoring tool for athena components.