DGtal 1.4.2
|
Aim: The traits class for all models of Cinteger (implementation) More...
#include <DGtal/kernel/NumberTraits.h>
Public Types | |
typedef TagUnknown | IsBounded |
Is the number bounded. | |
typedef TagUnknown | IsUnsigned |
Is the number unsigned. | |
typedef TagUnknown | IsSigned |
Is the number signed. | |
typedef TagUnknown | IsIntegral |
Is the number of integral type. | |
typedef TagFalse | IsSpecialized |
Is that a number type with specific traits. | |
typedef T | SignedVersion |
Alias to the signed version of the number type. | |
typedef T | UnsignedVersion |
Alias to the unsigned version of the number type. | |
typedef T | ReturnType |
Alias to the type that should be used as return type. | |
typedef boost::call_traits< T >::param_type | ParamType |
Defines a type that represents the "best" way to pass a parameter of type T to a function. | |
Static Public Member Functions | |
static ReturnType | zero () |
Return the zero of this integer. | |
static ReturnType | one () |
Return the one of this integer. | |
static ReturnType | min () |
Return the minimum possible value for this type of integer or ONE if not bounded or unknown. | |
static ReturnType | max () |
Return the maximum possible value for this type of integer or ZERO if not bounded or unknown. | |
static unsigned int | digits () |
Return the number of significant binary digits for this integer type, or 0 if unbounded or unknown. | |
static BoundEnum | isBounded () |
Return the bounding type of the number. | |
static SignEnum | isSigned () |
Return the sign type of the number. | |
static DGtal::int64_t | castToInt64_t (const T &aT) |
Cast method to DGtal::int64_t (for I/O or board export uses only). | |
static constexpr DGtal::uint64_t | castToUInt64_t (const T &aT) noexcept |
Cast method to DGtal::uint64_t (for I/O or board export uses only). | |
static double | castToDouble (const T &aT) |
Cast method to double (for I/O or board export uses only). | |
static bool | even (ParamType aT) |
Check the parity of a number. | |
static bool | odd (ParamType aT) |
Check the parity of a number. | |
Static Public Attributes | |
static const T | ZERO = T(0) |
Constant Zero. | |
static const T | ONE = T(1) |
Constant One. | |
Aim: The traits class for all models of Cinteger (implementation)
Description of template class 'NumberTraitsImpl'
Since CInteger describes the concept Integer, this class is used by models of CIinteger to specialize some definitions related to Integer. For instance it defines whether a given Integer is signed or not and what is signed/unsigned version.
This is the fallback declaration for unknown types (IsSpecialized points to TagFalse).
T | Number type. |
Enable | Internal template parameter used for SFINAE. |
Definition at line 81 of file NumberTraits.h.
TagUnknown DGtal::NumberTraitsImpl< T, Enable >::IsBounded |
Is the number bounded.
Definition at line 84 of file NumberTraits.h.
TagUnknown DGtal::NumberTraitsImpl< T, Enable >::IsIntegral |
Is the number of integral type.
Definition at line 87 of file NumberTraits.h.
TagUnknown DGtal::NumberTraitsImpl< T, Enable >::IsSigned |
Is the number signed.
Definition at line 86 of file NumberTraits.h.
TagFalse DGtal::NumberTraitsImpl< T, Enable >::IsSpecialized |
Is that a number type with specific traits.
Definition at line 88 of file NumberTraits.h.
TagUnknown DGtal::NumberTraitsImpl< T, Enable >::IsUnsigned |
Is the number unsigned.
Definition at line 85 of file NumberTraits.h.
boost::call_traits<T>::param_type DGtal::NumberTraitsImpl< T, Enable >::ParamType |
Defines a type that represents the "best" way to pass a parameter of type T to a function.
Definition at line 96 of file NumberTraits.h.
T DGtal::NumberTraitsImpl< T, Enable >::ReturnType |
Alias to the type that should be used as return type.
Definition at line 91 of file NumberTraits.h.
T DGtal::NumberTraitsImpl< T, Enable >::SignedVersion |
Alias to the signed version of the number type.
Definition at line 89 of file NumberTraits.h.
T DGtal::NumberTraitsImpl< T, Enable >::UnsignedVersion |
Alias to the unsigned version of the number type.
Definition at line 90 of file NumberTraits.h.
|
inlinestatic |
Cast method to double (for I/O or board export uses only).
Definition at line 164 of file NumberTraits.h.
|
inlinestatic |
Cast method to DGtal::int64_t (for I/O or board export uses only).
Definition at line 145 of file NumberTraits.h.
|
inlinestaticconstexprnoexcept |
Cast method to DGtal::uint64_t (for I/O or board export uses only).
Definition at line 155 of file NumberTraits.h.
|
static |
Return the number of significant binary digits for this integer type, or 0 if unbounded or unknown.
|
inlinestatic |
Check the parity of a number.
aT | any number. |
Definition at line 173 of file NumberTraits.h.
References DGtal::NumberTraitsImpl< T, Enable >::ONE, and DGtal::NumberTraitsImpl< T, Enable >::ZERO.
|
static |
Return the bounding type of the number.
|
static |
Return the sign type of the number.
|
static |
Return the maximum possible value for this type of integer or ZERO if not bounded or unknown.
|
static |
Return the minimum possible value for this type of integer or ONE if not bounded or unknown.
|
inlinestatic |
Check the parity of a number.
aT | any number. |
Definition at line 183 of file NumberTraits.h.
References DGtal::NumberTraitsImpl< T, Enable >::ONE, and DGtal::NumberTraitsImpl< T, Enable >::ZERO.
|
static |
Return the one of this integer.
|
static |
Return the zero of this integer.
|
static |
Constant One.
Definition at line 103 of file NumberTraits.h.
Referenced by DGtal::NumberTraitsImpl< T, Enable >::even(), DGtal::NumberTraitsImpl< T, Enable >::odd(), and DGtal::NumberTraitsImpl< DGtal::BigInteger, Enable >::one().
|
static |
Constant Zero.
Definition at line 100 of file NumberTraits.h.
Referenced by DGtal::NumberTraitsImpl< T, Enable >::even(), DGtal::NumberTraitsImpl< DGtal::BigInteger, Enable >::max(), DGtal::NumberTraitsImpl< DGtal::BigInteger, Enable >::min(), DGtal::NumberTraitsImpl< T, Enable >::odd(), and DGtal::NumberTraitsImpl< DGtal::BigInteger, Enable >::zero().