prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
Loading...
Searching...
No Matches
Classes | Namespaces | Concepts | Functions
dimval.hpp File Reference

Structural bridge to dimval: the DimensionalValue concept, NormalizedValue, and the normalize() overloads. More...

#include <prom/unit.hpp>
#include <concepts>
#include <type_traits>
Include dependency graph for dimval.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  prom::NormalizedValue
 A plain magnitude paired with the unit it was carrying (empty for raw arithmetic). More...
 

Namespaces

namespace  prom
 

Concepts

concept  prom::DimensionalValue
 Satisfied by a dimval-like value: it exposes a value_t, reports its magnitude through numeric_as_double(), and carries unit metadata through either unit_descriptor() (measures) or descriptor() (units).
 

Functions

template<DimensionalValue V>
NormalizedValue prom::normalize (const V &value)
 Reduce a dimval value to a NormalizedValue.
 
template<class T >
requires std::is_arithmetic_v<T>
NormalizedValue prom::normalize (T value) noexcept
 Pass an arithmetic sample straight through with no unit attached.
 

Detailed Description

Structural bridge to dimval: the DimensionalValue concept, NormalizedValue, and the normalize() overloads.

prom never includes a dimval header. The DimensionalValue concept matches dimval::UnitValue / dimval::MeasureValue purely structurally (duck typing on value_t, numeric_as_double(), and a descriptor accessor), so a consumer can hand prom dimensional values without prom taking a build-time dependency on dimval's concrete types.