$treeview $search $mathjax $extrastylesheet
artdaq_utilities
v1_04_10
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef ARTDAQ_UTILITIES_PLUGINS_METRICDATA_HH 00002 #define ARTDAQ_UTILITIES_PLUGINS_METRICDATA_HH 00003 00004 #include "fhiclcpp/fwd.h" 00005 #include "messagefacility/MessageLogger/MessageLogger.h" 00006 00007 #include <sstream> 00008 #include <list> 00009 #include <condition_variable> 00010 #include <atomic> 00011 00012 namespace artdaq 00013 { 00017 enum class MetricType 00018 { 00019 InvalidMetric, 00020 StringMetric, 00021 IntMetric, 00022 DoubleMetric, 00023 FloatMetric, 00024 UnsignedMetric 00025 }; 00026 00030 enum class MetricMode 00031 { 00032 LastPoint, 00033 Accumulate, 00034 Average, 00035 Rate, 00036 AccumulateAndRate, 00037 }; 00038 00042 struct MetricData 00043 { 00048 MetricData(const MetricData& r) = default; 00049 00054 MetricData(MetricData&& r) noexcept = default; 00055 00061 MetricData& operator=(const MetricData& r) = default; 00062 00068 MetricData& operator=(MetricData&& r) noexcept = default; 00069 00073 std::string Name; 00077 std::string StringValue; 00078 00082 union 00083 { 00084 int IntValue; 00085 double DoubleValue; 00086 float FloatValue; 00087 long unsigned int UnsignedValue; 00088 }; 00089 00093 MetricType Type; 00097 std::string Unit; 00101 int Level; 00105 MetricMode Mode; 00109 std::string MetricPrefix; 00113 bool UseNameOverride; 00117 size_t DataPointCount; 00118 00129 MetricData(std::string const& name, std::string const& value, std::string const& unit, int level, MetricMode mode, std::string const& metricPrefix, bool useNameOverride) 00130 : Name(name) 00131 , StringValue(value) 00132 , Type(MetricType::StringMetric) 00133 , Unit(unit) 00134 , Level(level) 00135 , Mode(mode) 00136 , MetricPrefix(metricPrefix) 00137 , UseNameOverride(useNameOverride) 00138 , DataPointCount(1) 00139 {} 00140 00151 MetricData(std::string const& name, int const& value, std::string const& unit, int level, MetricMode mode, std::string const& metricPrefix, bool useNameOverride) 00152 : Name(name) 00153 , IntValue(value) 00154 , Type(MetricType::IntMetric) 00155 , Unit(unit) 00156 , Level(level) 00157 , Mode(mode) 00158 , MetricPrefix(metricPrefix) 00159 , UseNameOverride(useNameOverride) 00160 , DataPointCount(1) 00161 {} 00162 00173 MetricData(std::string const& name, double const& value, std::string const& unit, int level, MetricMode mode, std::string const& metricPrefix, bool useNameOverride) 00174 : Name(name) 00175 , DoubleValue(value) 00176 , Type(MetricType::DoubleMetric) 00177 , Unit(unit) 00178 , Level(level) 00179 , Mode(mode) 00180 , MetricPrefix(metricPrefix) 00181 , UseNameOverride(useNameOverride) 00182 , DataPointCount(1) 00183 {} 00184 00195 MetricData(std::string const& name, float const& value, std::string const& unit, int level, MetricMode mode, std::string const& metricPrefix, bool useNameOverride) 00196 : Name(name) 00197 , FloatValue(value) 00198 , Type(MetricType::FloatMetric) 00199 , Unit(unit) 00200 , Level(level) 00201 , Mode(mode) 00202 , MetricPrefix(metricPrefix) 00203 , UseNameOverride(useNameOverride) 00204 , DataPointCount(1) 00205 {} 00206 00217 MetricData(std::string const& name, long unsigned int const& value, std::string const& unit, int level, MetricMode mode, std::string const& metricPrefix, bool useNameOverride) 00218 : Name(name) 00219 , UnsignedValue(value) 00220 , Type(MetricType::UnsignedMetric) 00221 , Unit(unit) 00222 , Level(level) 00223 , Mode(mode) 00224 , MetricPrefix(metricPrefix) 00225 , UseNameOverride(useNameOverride) 00226 , DataPointCount(1) 00227 {} 00228 00232 MetricData() : Name("") 00233 , Type(MetricType::InvalidMetric), DataPointCount(0) {} 00234 }; 00235 } 00236 00237 #endif /* ARTDAQ_UTILITIES_PLUGINS_METRICDATA_HH */