latest version v1.9 - last update 10 Apr 2010 |
This class allows to ask some information required in the LTI-Lib for some types. More...
#include <ltiTypeInfo.h>
Public Types | |
typedef T | accumulation_type |
typedef T | square_accumulation_type |
Static Public Member Functions | |
static T | suggestedNorm () throw () |
static bool | isFloatingPointType () throw () |
static const char * | name () throw () |
static T | min () throw () |
This class allows to ask some information required in the LTI-Lib for some types.
Note that the members are static, and you do not need any instance of the class to get the type information.
For more information about a type you can also use the std::numeric_limits type of the Standard Template Library.
Example:
if (typeInfo<double>::isFloatingPointType()) { cout << "double is a floating point type" << endl; } else { cout << "this is a really weird case!" << endl; }
typedef T lti::typeInfo< T >::accumulation_type |
Type suggested for accumulation of current type elements (for example int for ubyte).
typedef T lti::typeInfo< T >::square_accumulation_type |
Type suggested to accumulate the square of values of the current type.
static bool lti::typeInfo< T >::isFloatingPointType | ( | ) | throw () [inline, static] |
return true if the type T is a floating point type.
static T lti::typeInfo< T >::min | ( | ) | throw () [inline, static] |
The difference of this minimum with the std::numeric_limits<T>::min() is that here the minimum value is returned for floating point types and fixed point types.
The STL method returns for floating point values the minimal representable value above zero. For max() you can use the standard version
static const char* lti::typeInfo< T >::name | ( | ) | throw () [inline, static] |
Return a const char* with the name of the type.
static T lti::typeInfo< T >::suggestedNorm | ( | ) | throw () [inline, static] |
suggest a norm for the given type.
Usually 255 is used for ubyte, 127 for byte, 65535 for all other integer types and 1.0 for the floating point types.