Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::ClampedIntegralLimits< SourceType, ClampType > Struct Template Reference

A collection of methods for clamping and constraining integer values and ranges to that of a reference integer type. More...

#include <MathUtils.h>

Static Public Member Functions

static constexpr SourceType Min ()
 Returns the maximum value for SourceType as constrained by the numerical range of ClampType.
 
static constexpr SourceType Max ()
 Returns the minimum value for SourceType as constrained by the numerical range of ClampType.
 
template<typename ValueType >
static constexpr AZStd::pair< SourceType, bool > Clamp (ValueType value)
 

Detailed Description

template<typename SourceType, typename ClampType>
struct AZ::ClampedIntegralLimits< SourceType, ClampType >

A collection of methods for clamping and constraining integer values and ranges to that of a reference integer type.

Member Function Documentation

◆ Clamp()

template<typename SourceType , typename ClampType >
template<typename ValueType >
constexpr AZStd::pair< SourceType, bool > AZ::ClampedIntegralLimits< SourceType, ClampType >::Clamp ( ValueType  value)
staticconstexpr

Safely clamps a value of type ValueType to the [Min(), Max()] range as determined by the numerical limit constraint rules described by Min() and Max() given SourceType and ClampType.

Parameters
firstcomponent is the clamped value which may or may not equal the original value.
secondis a Boolean flag signifying whether or not the the value was required to be clamped in order to stay within ClampType's numerical range.

◆ Max()

template<typename SourceType , typename ClampType >
constexpr SourceType AZ::ClampedIntegralLimits< SourceType, ClampType >::Max
staticconstexpr

Returns the minimum value for SourceType as constrained by the numerical range of ClampType.

If SourceType and ClampType are different, returns the lesser value of AZStd::numeric_limits<SourceType>::max() and AZStd::numeric_limits<ClampType>::max(), otherwise returns AZStd::numeric_limits<SourceType>::max().

◆ Min()

template<typename SourceType , typename ClampType >
constexpr SourceType AZ::ClampedIntegralLimits< SourceType, ClampType >::Min
staticconstexpr

Returns the maximum value for SourceType as constrained by the numerical range of ClampType.

If SourceType and ClampType are different, returns the greater value of AZStd::numeric_limits<SourceType>::lowest() and AZStd::numeric_limits<ClampType>::lowest(), otherwise returns AZStd::numeric_limits<SourceType>::lowest().


The documentation for this struct was generated from the following file: