All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Nimble::RangeT< T > Class Template Reference

Numeric range representation. More...

#include <Nimble/Range.hpp>

Public Member Functions

clamp (const T &v) const
 Clamps the argument value to be between the low and high limits. More...
 
bool contains (const T &v) const
 Checks if the argument value fits into this range. More...
 
void expand (const T &v)
 Expands the range to include the given value.
 
void expand (const RangeT &that)
 Expands the range to include the given range.
 
high () const
 The upper limit of the range.
 
bool isEmpty () const
 Check ifthe range is empty. More...
 
low () const
 The lower limit of the range.
 
bool operator!= (const RangeT &that) const
 Compares two RangeT objects. More...
 
bool operator== (const RangeT &that) const
 Compares two RangeT objects. More...
 
 RangeT (const T &low, const T &high)
 Create a new range with low and high values. More...
 
void reset (const T &v)
 Sets the low-, and high values to given value.
 
span () const
 The difference between the upper and lower limit.
 
spanAbs () const
 Absolute value of the span.
 

Detailed Description

template<class T>
class Nimble::RangeT< T >

Numeric range representation.

By default the low, and high values are set to zero.

Constructor & Destructor Documentation

template<class T >
Nimble::RangeT< T >::RangeT ( const T &  low,
const T &  high 
)
inline

Create a new range with low and high values.

Parameters
lowInitial low value
highInitial high value

Member Function Documentation

template<class T >
T Nimble::RangeT< T >::clamp ( const T &  v) const
inline

Clamps the argument value to be between the low and high limits.

Parameters
vValue to clamp
Returns
Clamped value
template<class T >
bool Nimble::RangeT< T >::contains ( const T &  v) const
inline

Checks if the argument value fits into this range.

Parameters
vValue to check
Returns
True if range contains this value
template<class T >
bool Nimble::RangeT< T >::isEmpty ( ) const
inline

Check ifthe range is empty.

Returns
This function returns true if the low value is equal to, or exceeds the high value.
template<class T >
bool Nimble::RangeT< T >::operator!= ( const RangeT< T > &  that) const
inline

Compares two RangeT objects.

Parameters
thatOther range to compare to
Returns
This function returns true if the two ranges are different.
template<class T >
bool Nimble::RangeT< T >::operator== ( const RangeT< T > &  that) const
inline

Compares two RangeT objects.

Parameters
thatOther range to compare to
Returns
This function returns true if the two ranges are absolutely identical.