CCIMXDesktop
 
Loading...
Searching...
No Matches
ValueLimitUtils Namespace Reference

Utility functions for working with value limits. More...

Classes

class  StaticLimiter
 Compile-time value limiter with fixed bounds. More...
 

Functions

constexpr int minFromPair (ValueLimitSimplePair p) noexcept
 Gets the minimum value from a pair.
 
constexpr int maxFromPair (ValueLimitSimplePair p) noexcept
 Gets the maximum value from a pair.
 
constexpr bool inBound (ValueLimitType value, ValueLimitSimplePair p)
 Checks if a value is within bounds.
 
constexpr ValueLimitType boundWithPair (const ValueLimitType value, const ValueLimitSimplePair vp)
 Clamps a value to the specified bounds.
 

Detailed Description

Utility functions for working with value limits.

Function Documentation

◆ boundWithPair()

constexpr ValueLimitType ValueLimitUtils::boundWithPair ( const ValueLimitType  value,
const ValueLimitSimplePair  vp 
)
constexpr

Clamps a value to the specified bounds.

Parameters
valueThe value to clamp
vpThe min/max bounds pair
Returns
The clamped value
Exceptions
std::logic_errorif min > max in the bounds pair

◆ inBound()

constexpr bool ValueLimitUtils::inBound ( ValueLimitType  value,
ValueLimitSimplePair  p 
)
constexpr

Checks if a value is within bounds.

Parameters
valueThe value to check
pThe min/max bounds pair
Returns
true if value is within bounds, false otherwise

◆ maxFromPair()

constexpr int ValueLimitUtils::maxFromPair ( ValueLimitSimplePair  p)
constexprnoexcept

Gets the maximum value from a pair.

Parameters
pThe min/max pair
Returns
The second element (maximum) of the pair

◆ minFromPair()

constexpr int ValueLimitUtils::minFromPair ( ValueLimitSimplePair  p)
constexprnoexcept

Gets the minimum value from a pair.

Parameters
pThe min/max pair
Returns
The first element (minimum) of the pair