last update 20 Sep 2009 |
#include <cvrTypeInfo.h>
Public Types | |
typedef T | value_type |
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 () |
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<dreal>::isFloatingPointType()) { cout << "dreal is a floating point type" << endl; } else { cout << "this is a really weird case!" << endl; }
typedef T cvr::typeInfo< T >::accumulation_type |
Type suggested for accumulation of current type elements (for example int for ubyte).
typedef T cvr::typeInfo< T >::square_accumulation_type |
Type suggested to accumulate the square of values of the current type.
typedef T cvr::typeInfo< T >::value_type |
Alias for contained type.
For usual C++ types (int, float, etc.), this is exactly as T, but for compound type (complex<T>, point<T>, etc.) this corresponds to the type of the components
static bool cvr::typeInfo< T >::isFloatingPointType | ( | ) | throw () [inline, static] |
Return true if the type T is a floating point type.
static T cvr::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* cvr::typeInfo< T >::name | ( | ) | throw () [inline, static] |
Return a const char* with the name of the type.
static T cvr::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.