26 !std::is_arithmetic_v<std::remove_cvref_t<V>> &&
27 requires(
const std::remove_cvref_t<V>& value) {
28 typename std::remove_cvref_t<V>::value_t;
29 { value.numeric_as_double() } -> std::convertible_to<double>;
31 (
requires(
const std::remove_cvref_t<V>& value) { value.unit_descriptor(); } ||
32 requires(
const std::remove_cvref_t<V>& value) { value.descriptor(); });
46template <DimensionalValue V>
49 out.
value =
static_cast<double>(value.numeric_as_double());
50 if constexpr (
requires { value.unit_descriptor(); }) {
51 const auto desc = value.unit_descriptor();
52 out.
unit =
Unit{desc.long_name, desc.
kind, desc.symbol,
true};
54 const auto desc = value.descriptor();
55 out.
unit =
Unit{desc.long_name, desc.
kind, desc.symbol,
true};
62 requires std::is_arithmetic_v<T>
Satisfied by a dimval-like value: it exposes a value_t, reports its magnitude through numeric_as_doub...
Definition dimval.hpp:25
Definition adapter.hpp:24
NormalizedValue normalize(const V &value)
Reduce a dimval value to a NormalizedValue.
Definition dimval.hpp:47
A plain magnitude paired with the unit it was carrying (empty for raw arithmetic).
Definition dimval.hpp:36
double value
Definition dimval.hpp:37
Unit unit
Definition dimval.hpp:38
OpenMetrics unit suffix plus optional dimensional metadata.
Definition unit.hpp:53
std::string_view kind
Dimensional compatibility group (e.g. "time").
Definition unit.hpp:55
Metric kinds (MetricType) and the OpenMetrics Unit descriptor.