iRoCS Toolbox  1.1.0
Public Types | Static Public Attributes
atb::traits< DataT > Class Template Reference

The traits class provides means to query specific information about different data types. More...

#include "libArrayToolbox/TypeTraits.hh"

Collaboration diagram for atb::traits< DataT >:

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...
 

Detailed Description

template<typename DataT>
class atb::traits< DataT >

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.

Member Typedef Documentation

◆ HighPrecisionT

template<typename DataT >
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.

◆ ComplexT

template<typename DataT >
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.

◆ BasicT

template<typename DataT >
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.

Field Documentation

◆ smallest

template<typename DataT >
DataT const atb::traits< DataT >::smallest
static

Get a representation of the smallest value for this data type.

Definition at line 113 of file TypeTraits.hh.

◆ greatest

template<typename DataT >
DataT const atb::traits< DataT >::greatest
static

Get a representation of the greatest value for this data type.

Definition at line 120 of file TypeTraits.hh.

◆ zero

template<typename DataT >
DataT const atb::traits< DataT >::zero
static

Get a representation of the Zero for this data type.

Definition at line 127 of file TypeTraits.hh.

◆ one

template<typename DataT >
DataT const atb::traits< DataT >::one
static

Get a representation of the One for this data type.

Definition at line 134 of file TypeTraits.hh.

◆ saturated

template<typename DataT >
DataT const atb::traits< DataT >::saturated
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.

◆ isComplex

template<typename DataT >
bool const atb::traits< DataT >::isComplex
static

If this type specifies a complex number type this constant is true.

Definition at line 151 of file TypeTraits.hh.


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