Runtime-configurable value limiter with compile-time defaults.
More...
#include <ValueLimiter.hpp>
|
|
| ValueLimiter ()=default |
| | Default constructor using template bounds.
|
| |
| constexpr | ValueLimiter (ValueLimitType runtime_min, ValueLimitType runtime_max) |
| | Construct with runtime-specified bounds.
|
| |
| constexpr ValueLimitType | getMin () const noexcept |
| | Gets the current minimum bound.
|
| |
| constexpr ValueLimitType | getMax () const noexcept |
| | Gets the current maximum bound.
|
| |
| void | setMin (ValueLimitType v) |
| | Sets the minimum bound.
|
| |
| void | setMax (ValueLimitType v) |
| | Sets the maximum bound.
|
| |
| constexpr ValueLimitType | boundValue (ValueLimitType value) const |
| | Clamps a value to the current bounds.
|
| |
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
class ValueLimiter< MIN, MAX >
Runtime-configurable value limiter with compile-time defaults.
- Template Parameters
-
| MIN | Default minimum bound (default 0) |
| MAX | Default maximum bound (default 100) |
◆ ValueLimiter()
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
Construct with runtime-specified bounds.
- Parameters
-
| runtime_min | The minimum bound |
| runtime_max | The maximum bound |
◆ boundValue()
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
| constexpr ValueLimitType ValueLimiter< MIN, MAX >::boundValue |
( |
ValueLimitType |
value | ) |
const |
|
inlineconstexpr |
Clamps a value to the current bounds.
- Parameters
-
- Returns
- The clamped value
◆ getMax()
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
| constexpr ValueLimitType ValueLimiter< MIN, MAX >::getMax |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Gets the current maximum bound.
- Returns
- The maximum bound value
◆ getMin()
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
| constexpr ValueLimitType ValueLimiter< MIN, MAX >::getMin |
( |
| ) |
const |
|
inlineconstexprnoexcept |
Gets the current minimum bound.
- Returns
- The minimum bound value
◆ setMax()
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
Sets the maximum bound.
- Parameters
-
- Note
- Automatically adjusts if new max would be less than current min
◆ setMin()
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
Sets the minimum bound.
- Parameters
-
- Note
- Automatically adjusts if new min would exceed current max
◆ compileMax
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
| constexpr ValueLimitType ValueLimiter< MIN, MAX >::compileMax = MAX |
|
staticconstexpr |
Compile-time maximum bound
◆ compileMin
template<ValueLimitType MIN = 0, ValueLimitType MAX = 100>
| constexpr ValueLimitType ValueLimiter< MIN, MAX >::compileMin = MIN |
|
staticconstexpr |
Compile-time minimum bound
The documentation for this class was generated from the following file: