22#include "util/Assert.hpp"
23#include "util/prometheus/Gauge.hpp"
28namespace util::prometheus {
32 { a.set(0) } -> std::same_as<void>;
33 { a.value() } -> std::same_as<int64_t>;
40template <SomeBoolImpl ImplType>
42 std::reference_wrapper<ImplType> impl_;
50 explicit AnyBool(ImplType& impl) : impl_(impl)
63 impl_.get().set(value ? 1 : 0);
74 auto const value = impl_.get().value();
75 ASSERT(value == 0 || value == 1,
"Invalid value for bool: {}", value);
83using Bool = AnyBool<GaugeInt>;
A wrapped to provide bool interface for a Prometheus metric.
Definition Bool.hpp:41
AnyBool(ImplType &impl)
Construct a bool metric.
Definition Bool.hpp:50
AnyBool & operator=(bool value)
Set the value of the bool metric.
Definition Bool.hpp:61