23#include <spdlog/spdlog.h>
33template<
typename T,
int MIN,
int MAX>
41 auto get() const -> T {
return _val; }
48 spdlog::warn(
"BoundedValue: value {} is below minimum {}, clamping", val,
min);
55 spdlog::warn(
"BoundedValue: value {} is above maximum {}, clamping", val,
max);
64 static constexpr auto min =
static_cast<T
>(MIN);
67 static constexpr auto max =
static_cast<T
>(MAX);
73template<
int MIN,
int MAX>
76template<
int MIN,
int MAX>
Represents a value that is bounded by a minimum and maximum.
Definition BoundedValue.h:35
BoundedValue(T val={})
Set the initial value.
Definition BoundedValue.h:38
static constexpr auto min
Minimum value.
Definition BoundedValue.h:64
auto get() const -> T
Get the value stored in this object.
Definition BoundedValue.h:41
void set(T val)
Set a new value, clamping to min/max if necessary.
Definition BoundedValue.h:44
static constexpr auto max
Maximum value.
Definition BoundedValue.h:67