00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00035
00036
00037
00038
00039
00040
00041 #ifndef OPENMESH_UTILS_NUMLIMITS_HH
00042 #define OPENMESH_UTILS_NUMLIMITS_HH
00043
00044
00045
00046
00047 #include "Config.hh"
00048 #include <limits.h>
00049 #include <float.h>
00050
00051
00052
00053
00054 namespace OpenMesh {
00055 namespace Utils {
00056
00057
00058
00059
00060
00077 template <typename Scalar>
00078 class NumLimitsT
00079 {
00080 public:
00082 static inline Scalar min() { return 0; }
00084 static inline Scalar max() { return 0; }
00085
00086 static inline bool is_float() { return false; }
00087 static inline bool is_integer() { return !NumLimitsT<Scalar>::is_float(); }
00088 static inline bool is_signed() { return true; }
00089 };
00090
00091
00092
00093 template<>
00094 inline bool NumLimitsT<float>::is_float() { return true; }
00095
00096 template<>
00097 inline bool NumLimitsT<double>::is_float() { return true; }
00098
00099 template<>
00100 inline bool NumLimitsT<long double>::is_float() { return true; }
00101
00102
00103
00104 template<>
00105 inline bool NumLimitsT<unsigned char>::is_signed() { return false; }
00106
00107 template<>
00108 inline bool NumLimitsT<unsigned short>::is_signed() { return false; }
00109
00110 template<>
00111 inline bool NumLimitsT<unsigned int>::is_signed() { return false; }
00112
00113 template<>
00114 inline bool NumLimitsT<unsigned long>::is_signed() { return false; }
00115
00116 template<>
00117 inline bool NumLimitsT<unsigned long long>::is_signed() { return false; }
00118
00119
00120 template<> inline int NumLimitsT<int>::min() { return INT_MIN; }
00121 template<> inline int NumLimitsT<int>::max() { return INT_MAX; }
00122
00123 template<> inline float NumLimitsT<float>::min() { return FLT_MIN; }
00124 template<> inline float NumLimitsT<float>::max() { return FLT_MAX; }
00125
00126 template<> inline double NumLimitsT<double>::min() { return DBL_MIN; }
00127 template<> inline double NumLimitsT<double>::max() { return DBL_MAX; }
00128
00129
00130
00131 }
00132 }
00133
00134 #endif // OPENMESH_NUMLIMITS_HH defined
00135
00136