# Frost::s_int_t< T > Class Template Reference

Base type : integer. More...

`#include <frost_utils_int.h>`

List of all members.

## Public Types

enum | Type { INTEGER, INTEGER_INF_PLUS, INTEGER_INF_MINUS, INTEGER_NAN }

## Public Member Functions

| s_int_t ()
| s_int_t (const T &iValue)
| s_int_t (const Type &mType)
| s_int_t (const float &fValue)
| s_int_t (const double &dValue)
template<class N >
| s_int_t (const s_int_t< N > &iValue)
template<class N >
| s_int_t (const s_uint_t< N > &uiValue)
template<class N >
| s_int_t (const s_float_t< N > &fValue)
| s_int_t (const s_bool &bValue)
template<class N >
| s_int_t (const s_str_t< N > &sValue)
const T & | Get () const
| Returns a const reference to the int.
T & | GetR ()
| Returns a reference to the int.
void | Clamp (const s_int_t &iMin, const s_int_t &iMax)
| Adjusts this int's value to be contained into the provided interval.
s_uint_t< typename TypeTraits < T >::UnsignedType > | GetNearestPowerOfTwo () const
| Returns the power of two just above the value (or equal).
Type | GetType () const
| Returns the type of this int.
s_bool | IsInfiniteMinus () const
| Checks if this int is infinite and negative.
s_bool | IsInfinitePlus () const
| Checks if this int is infinite and positive.
s_bool | IsInRange (const s_int_t< T > &iMin, const s_int_t< T > &iMax) const
| Checks if this int is contained into the provided range.
s_bool | IsNaN () const
| Checks if this int is a Not a Number (NaN).
s_bool | IsNull () const
| Checks if this int equals zero.
s_bool | IsValid () const
| Checks if this int is a valid number.
s_bool | IsInfinite () const
| Checks if this int is an infinite number.
void | Pow (const s_uint_t< typename TypeTraits< T >::UnsignedType > &uiPower)
| Elevates this int to a certain power (this^n).
void | Randomize (const s_int_t &iMin=0, const s_int_t &iMax=1)
| Sets the value of the int to a random number.
void | SetInfiniteMinus ()
| Sets this int to infinite (negative).
void | SetInfinitePlus ()
| Sets this int to infinite (positive).
void | SetNaN ()
| Set this int to Not a Number state.
s_int_t | GetSign () const
| Returns the sign of this int (either 1 or -1).
s_int_t & | operator++ ()
s_int_t | operator++ (int)
s_int_t | operator- () const
s_int_t & | operator-- ()
s_int_t | operator-- (int)
s_int_t | operator+ (const s_int_t &iValue) const
s_int_t | operator- (const s_int_t &iValue) const
s_int_t | operator* (const s_int_t &iValue) const
s_int_t | operator/ (const s_int_t &iValue) const
s_int_t | operator% (const s_int_t &iValue) const
void | operator+= (const s_int_t &iValue)
void | operator-= (const s_int_t &iValue)
void | operator*= (const s_int_t &iValue)
void | operator/= (const s_int_t &iValue)
void | operator%= (const s_int_t &iValue)
template<class N >
s_int_t & | operator<< (const s_uint_t< N > &uiValue)
s_int_t & | operator<< (const uint &uiValue)
s_bool | operator== (const s_int_t &iValue) const
s_bool | operator!= (const s_int_t &iValue) const
s_bool | operator< (const s_int_t &iValue) const
s_bool | operator> (const s_int_t &iValue) const
s_bool | operator<= (const s_int_t &iValue) const
s_bool | operator>= (const s_int_t &iValue) const
s_int_t | Sign (const s_int_t &iValue) const
| Returns the sign of the provided int (either 1 or -1).

## Static Public Member Functions

static s_int_t | Min (const s_int_t &iLeft, const s_int_t &iRight)
| Returns the lowest value of the two provided ones.
static s_int_t | Max (const s_int_t &iLeft, const s_int_t &iRight)
| Returns the highest value of the two provided ones.
static s_int_t | Clamp (const s_int_t &iValue, const s_int_t &iMin, const s_int_t &iMax)
| Clamps the provided value into the provided interval.
static s_int_t | Random (const s_int_t &iMin=0, const s_int_t &iMax=1)
| Returns a random int in the provided range.

## Static Public Attributes

static const s_int_t | NaN = s_int_t<T>(INTEGER_NAN)
static const s_int_t | INFPLUS = s_int_t<T>(INTEGER_INF_PLUS)
static const s_int_t | INFMINUS = s_int_t<T>(INTEGER_INF_MINUS)

## Private Attributes

T | iValue_
Type | mType_

## Detailed Description

### template<class T>
class Frost::s_int_t< T >

Base type : integer.

Frost's base types are made to allow simpler manipulation of numbers, booleans and strings. They simplify conversions (mostly to string), allow easy access to math/string functions and implements new functions that are not present in the standard libraries.
Note : Most of Frost's base types are slower than C++ base types. The difference is negligible for small operations, but if you need to do a lot of calculations (matrices, ...) it can bloat your performances. Use prebuilt types in this case. Note : This class is about 60 times slower than the wrapped POD (20 times in debug, without any compiler optimizations).

Definition at line 22 of file frost_utils_int.h.

## Member Enumeration Documentation

template<class T>

enum Frost::s_int_t::Type

Enumerator:

  INTEGER |
  INTEGER_INF_PLUS |
  INTEGER_INF_MINUS |
  INTEGER_NAN |

Definition at line 26 of file frost_utils_int.h.

## Constructor & Destructor Documentation

template<class T >

Frost::s_int_t< T >::s_int_t | ( |  | ) | `[inline]`

Definition at line 8 of file frost_utils_int_impl.cpp.

template<class T >

Frost::s_int_t< T >::s_int_t | ( | const T & | iValue | ) | `[inline]`

Definition at line 15 of file frost_utils_int_impl.cpp.

template<class T >

Frost::s_int_t< T >::s_int_t | ( | const Type & | mType | ) | `[inline, explicit]`

Definition at line 22 of file frost_utils_int_impl.cpp.

template<class T >

Frost::s_int_t< T >::s_int_t | ( | const float & | fValue | ) | `[inline, explicit]`

Definition at line 29 of file frost_utils_int_impl.cpp.

template<class T >

Frost::s_int_t< T >::s_int_t | ( | const double & | dValue | ) | `[inline, explicit]`

Definition at line 36 of file frost_utils_int_impl.cpp.

template<class T>
template<class N >

Frost::s_int_t< T >::s_int_t | ( | const s_int_t< N > & | iValue | ) | `[inline, explicit]`

Definition at line 45 of file frost_utils_int.h.

template<class T>
template<class N >

Frost::s_int_t< T >::s_int_t | ( | const s_uint_t< N > & | uiValue | ) | `[inline, explicit]`

Definition at line 52 of file frost_utils_int.h.

template<class T>
template<class N >

Frost::s_int_t< T >::s_int_t | ( | const s_float_t< N > & | fValue | ) | `[inline, explicit]`

Definition at line 72 of file frost_utils_int.h.

template<class T >

Frost::s_int_t< T >::s_int_t | ( | const s_bool & | bValue | ) | `[inline, explicit]`

Definition at line 43 of file frost_utils_int_impl.cpp.

template<class T>
template<class N >

Frost::s_int_t< T >::s_int_t | ( | const s_str_t< N > & | sValue | ) | `[inline, explicit]`

Definition at line 99 of file frost_utils_int.h.

## Member Function Documentation

template<class T >

s_int_t< T > Frost::s_int_t< T >::Clamp | ( | const s_int_t< T > & | iValue,
|  | const s_int_t< T > & | iMin,
|  | const s_int_t< T > & | iMax |
| ) |  |  | `[inline, static]`

Clamps the provided value into the provided interval.

Parameters:

  | iValue | The value to clamp
  | iMin | The minimum value
  | iMax | The maximum value

Returns:
  The clamped value

Definition at line 609 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::Clamp | ( | const s_int_t< T > & | iMin,
|  | const s_int_t< T > & | iMax |
| ) |  |  | `[inline]`

Adjusts this int's value to be contained into the provided interval.

Parameters:

  | iMin | The minimum value
  | iMax | The maximum value

Definition at line 53 of file frost_utils_int_impl.cpp.

template<class T>

const T& Frost::s_int_t< T >::Get | ( |  | ) | const`[inline]`

Returns a const reference to the int.

Returns:
  A const reference to the int

Definition at line 108 of file frost_utils_int.h.

template<class T >

s_uint_t< typename TypeTraits< T >::UnsignedType > Frost::s_int_t< T >::GetNearestPowerOfTwo | ( |  | ) | const`[inline]`

Returns the power of two just above the value (or equal).

Returns:
  The associated power of two (2^n) (superior of equal)

Definition at line 59 of file frost_utils_int_impl.cpp.

template<class T>

T& Frost::s_int_t< T >::GetR | ( |  | ) | `[inline]`

Returns a reference to the int.

Returns:
  A reference to the int

Definition at line 113 of file frost_utils_int.h.

template<class T >

s_int_t< T > Frost::s_int_t< T >::GetSign | ( |  | ) | const`[inline]`

Returns the sign of this int (either 1 or -1).

Returns:
  The sign of this int (either 1 or -1)

Definition at line 170 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T >::Type Frost::s_int_t< T >::GetType | ( |  | ) | const`[inline]`

Returns the type of this int.

Returns:
  The type of this int (infinite, NaN, ...)

Definition at line 74 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::IsInfinite | ( |  | ) | const`[inline]`

Checks if this int is an infinite number.

Returns:
  'true' if this int is an infinite number

Definition at line 127 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::IsInfiniteMinus | ( |  | ) | const`[inline]`

Checks if this int is infinite and negative.

Returns:
  'true' if this int is infinite and negative

Definition at line 80 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::IsInfinitePlus | ( |  | ) | const`[inline]`

Checks if this int is infinite and positive.

Returns:
  'true' if this int is infinite and positive

Definition at line 86 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::IsInRange | ( | const s_int_t< T > & | iMin,
|  | const s_int_t< T > & | iMax |
| ) |  |  | const`[inline]`

Checks if this int is contained into the provided range.

Definition at line 103 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::IsNaN | ( |  | ) | const`[inline]`

Checks if this int is a Not a Number (NaN).

Returns:
  'true' if this int is NaN

Definition at line 109 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::IsNull | ( |  | ) | const`[inline]`

Checks if this int equals zero.

Returns:
  'true' if this int equals zero

Definition at line 115 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::IsValid | ( |  | ) | const`[inline]`

Checks if this int is a valid number.

Returns:
  'true' if this int is not infinite and a number

Definition at line 121 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::Max | ( | const s_int_t< T > & | iLeft,
|  | const s_int_t< T > & | iRight |
| ) |  |  | `[inline, static]`

Returns the highest value of the two provided ones.

Parameters:

  | iLeft | The first value
  | iRight | The second value

Returns:
  The highest value of the two provided ones

Definition at line 603 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::Min | ( | const s_int_t< T > & | iLeft,
|  | const s_int_t< T > & | iRight |
| ) |  |  | `[inline, static]`

Returns the lowest value of the two provided ones.

Parameters:

  | iLeft | The first value
  | iRight | The second value

Returns:
  The lowest value of the two provided ones

Definition at line 597 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::operator!= | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 487 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::operator% | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 410 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::operator%= | ( | const s_int_t< T > & | iValue | ) | `[inline]`

Definition at line 457 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::operator* | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 311 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::operator*= | ( | const s_int_t< T > & | iValue | ) | `[inline]`

Definition at line 445 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::operator+ | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 239 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::operator++ | ( | int |  | ) | `[inline]`

Definition at line 191 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > & Frost::s_int_t< T >::operator++ | ( |  | ) | `[inline]`

Definition at line 181 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::operator+= | ( | const s_int_t< T > & | iValue | ) | `[inline]`

Definition at line 433 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::operator- | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 275 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::operator- | ( |  | ) | const`[inline]`

Definition at line 202 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::operator-- | ( | int |  | ) | `[inline]`

Definition at line 228 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > & Frost::s_int_t< T >::operator-- | ( |  | ) | `[inline]`

Definition at line 218 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::operator-= | ( | const s_int_t< T > & | iValue | ) | `[inline]`

Definition at line 439 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::operator/ | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 374 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::operator/= | ( | const s_int_t< T > & | iValue | ) | `[inline]`

Definition at line 451 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::operator< | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 501 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > & Frost::s_int_t< T >::operator<< | ( | const uint & | uiValue | ) | `[inline]`

Definition at line 463 of file frost_utils_int_impl.cpp.

template<class T>
template<class N >

s_int_t& Frost::s_int_t< T >::operator<< | ( | const s_uint_t< N > & | uiValue | ) | `[inline]`

Definition at line 220 of file frost_utils_int.h.

template<class T >

s_bool Frost::s_int_t< T >::operator<= | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 549 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::operator== | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 473 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::operator> | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 525 of file frost_utils_int_impl.cpp.

template<class T >

s_bool Frost::s_int_t< T >::operator>= | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Definition at line 573 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::Pow | ( | const s_uint_t< typename TypeTraits< T >::UnsignedType > & | uiPower | ) | `[inline]`

Elevates this int to a certain power (this^n).

Parameters:

  | uiPower | The power

Definition at line 92 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::Random | ( | const s_int_t< T > & | iMin = `0`,
|  | const s_int_t< T > & | iMax = `1` |
| ) |  |  | `[inline, static]`

Returns a random int in the provided range.

Parameters:

  | iMin | The lower bound (minimum)
  | iMax | The upper bound (maximum)

Returns:
  A random int in the provided range

Definition at line 615 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::Randomize | ( | const s_int_t< T > & | iMin = `0`,
|  | const s_int_t< T > & | iMax = `1` |
| ) |  |  | `[inline]`

Sets the value of the int to a random number.

Parameters:

  | iMin | The lower bound (minimum)
  | iMax | The upper bound (maximum)

Definition at line 133 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::SetInfiniteMinus | ( |  | ) | `[inline]`

Sets this int to infinite (negative).

Definition at line 149 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::SetInfinitePlus | ( |  | ) | `[inline]`

Sets this int to infinite (positive).

Definition at line 156 of file frost_utils_int_impl.cpp.

template<class T >

void Frost::s_int_t< T >::SetNaN | ( |  | ) | `[inline]`

Set this int to Not a Number state.

Definition at line 163 of file frost_utils_int_impl.cpp.

template<class T >

s_int_t< T > Frost::s_int_t< T >::Sign | ( | const s_int_t< T > & | iValue | ) | const`[inline]`

Returns the sign of the provided int (either 1 or -1).

Returns:
  The sign of the provided int (either 1 or -1)

Definition at line 632 of file frost_utils_int_impl.cpp.

## Member Data Documentation

template<class T>

const s_int_t< T > Frost::s_int_t< T >::INFMINUS = s_int_t<T>(INTEGER_INF_MINUS)`[inline, static]`

Definition at line 245 of file frost_utils_int.h.

template<class T>

const s_int_t< T > Frost::s_int_t< T >::INFPLUS = s_int_t<T>(INTEGER_INF_PLUS)`[inline, static]`

Definition at line 244 of file frost_utils_int.h.

template<class T>

T Frost::s_int_t< T >::iValue_`[private]`

Definition at line 283 of file frost_utils_int.h.

template<class T>

Type Frost::s_int_t< T >::mType_`[private]`

Definition at line 285 of file frost_utils_int.h.

template<class T>

const s_int_t< T > Frost::s_int_t< T >::NaN = s_int_t<T>(INTEGER_NAN)`[inline, static]`

Definition at line 243 of file frost_utils_int.h.

The documentation for this class was generated from the following files:

- D:/Programmation/Sources/Tensor2/Utils/include/frost_utils_int.h
- D:/Programmation/Sources/Tensor2/Utils/src/frost_utils_int_impl.cpp