iRoCS Toolbox
1.1.0
|
The traits class provides means to query specific information about different data types. More...
#include "libArrayToolbox/TypeTraits.hh"
Public Types | |
typedef DataT | BasicT |
The corresponding basic type to the given type. More... | |
typedef DataT | ComplexT |
The corresponding complex value type to the given type. More... | |
typedef DataT | HighPrecisionT |
The type with highest precision of this kind. More... | |
Static Public Attributes | |
static DataT const | greatest |
Get a representation of the greatest value for this data type. More... | |
static bool const | isComplex |
If this type specifies a complex number type this constant is true. More... | |
static DataT const | one |
Get a representation of the One for this data type. More... | |
static DataT const | saturated |
Get the value that corresponds to the saturation of the sensor. More... | |
static DataT const | smallest |
Get a representation of the smallest value for this data type. More... | |
static DataT const | zero |
Get a representation of the Zero for this data type. More... | |
The traits class provides means to query specific information about different data types.
The traits are helpers to query type traits in a template-context to avoid exhaustive code duplication. This is the slim variant to copy&pasting whole functions or even classes to provide specific behaviour for several data types. When running into code duplication trouble, think of extending this class first.
Definition at line 73 of file TypeTraits.hh.
typedef DataT atb::traits< DataT >::HighPrecisionT |
The type with highest precision of this kind.
If you want to do floating point arithmetics on variables of this data type you can get the most appropriate floating point type using this typedef. For scalars it returns double, for compound types the corresponding equivalent.
Definition at line 86 of file TypeTraits.hh.
typedef DataT atb::traits< DataT >::ComplexT |
The corresponding complex value type to the given type.
The default implementation is DataT which is pointless for probably every type that has not been explicitely instantiated.
Definition at line 96 of file TypeTraits.hh.
typedef DataT atb::traits< DataT >::BasicT |
The corresponding basic type to the given type.
For multi-component types this should return the basic element type, e.g. traits< std::complex<double> >::BasicT = double.
Definition at line 106 of file TypeTraits.hh.
|
static |
Get a representation of the smallest value for this data type.
Definition at line 113 of file TypeTraits.hh.
|
static |
Get a representation of the greatest value for this data type.
Definition at line 120 of file TypeTraits.hh.
|
static |
Get a representation of the Zero for this data type.
Definition at line 127 of file TypeTraits.hh.
|
static |
Get a representation of the One for this data type.
Definition at line 134 of file TypeTraits.hh.
|
static |
Get the value that corresponds to the saturation of the sensor.
This is 255 for an 8Bit sensor, 65535 for a 16Bit sensor, and 1.0 for a floating point type. For unknown types (if the compiler doesn't complain) a representation of 1 of the data type is returned.
Definition at line 144 of file TypeTraits.hh.
|
static |
If this type specifies a complex number type this constant is true.
Definition at line 151 of file TypeTraits.hh.