numeric_limits.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef ECL_TYPE_TRAITS_NUMERIC_LIMITS_HPP_
00013 #define ECL_TYPE_TRAITS_NUMERIC_LIMITS_HPP_
00014 
00015 /*****************************************************************************
00016 ** Includes
00017 *****************************************************************************/
00018 
00019 #include <limits>
00020 #include <climits>
00021 #include <ecl/config/portable_types.hpp>
00022 #include "macros.hpp"
00023 
00024 /*****************************************************************************
00025 ** Namespaces
00026 *****************************************************************************/
00027 
00028 namespace ecl {
00029 
00030 /*****************************************************************************
00031 ** Parent Template
00032 *****************************************************************************/
00055 template <typename T>
00056 class ecl_type_traits_PUBLIC numeric_limits : public std::numeric_limits<T> {
00057 public:
00058         numeric_limits() {}
00059 private:
00060 };
00061 
00062 /*****************************************************************************
00063 ** Specialisations
00064 *****************************************************************************/
00070 template <>
00071 class ecl_type_traits_PUBLIC numeric_limits<char> : public std::numeric_limits<char> {
00072 public:
00073         static const char one = 1;
00074         static const uint16 bits = ECL_SIZE_OF_CHAR*8;
00075         static const uint16 bytes = ECL_SIZE_OF_CHAR;
00076         static const char minimum = CHAR_MIN;
00077         static const char maximum = CHAR_MAX;
00078 
00079         typedef float Precision;
00080         static const Precision dummy_precision;
00081 };
00082 
00088 template <>
00089 class ecl_type_traits_PUBLIC numeric_limits<unsigned char> : public std::numeric_limits<unsigned char> {
00090 public:
00091         static const unsigned char one = 1U;
00092         static const uint16 bits = ECL_SIZE_OF_CHAR*8;
00093         static const uint16 bytes = ECL_SIZE_OF_CHAR;
00094         static const unsigned char minimum = 0U;
00095         static const unsigned char maximum = UCHAR_MAX;
00096 
00097         typedef float Precision;
00098         static const Precision dummy_precision;
00099 };
00100 
00106 template <>
00107 class ecl_type_traits_PUBLIC numeric_limits<short> : public std::numeric_limits<short> {
00108 public:
00109         static const short one = 1;
00110         static const uint16 bits = ECL_SIZE_OF_SHORT*8;
00111         static const uint16 bytes = ECL_SIZE_OF_SHORT;
00112         static const short minimum = SHRT_MIN;
00113         static const short maximum = SHRT_MAX;
00114 
00115         typedef float Precision;
00116         static const Precision dummy_precision;
00117 };
00118 
00124 template <>
00125 class ecl_type_traits_PUBLIC numeric_limits<unsigned short> : public std::numeric_limits<unsigned short> {
00126 public:
00127         static const unsigned short one = 1U;
00128         static const uint16 bits = ECL_SIZE_OF_SHORT*8;
00129         static const uint16 bytes = ECL_SIZE_OF_SHORT;
00130         static const unsigned short minimum = 0U;
00131         static const unsigned short maximum = USHRT_MAX;
00132 
00133         typedef float Precision;
00134         static const Precision dummy_precision;
00135 };
00136 
00142 template <>
00143 class ecl_type_traits_PUBLIC numeric_limits<int> : public std::numeric_limits<int> {
00144 public:
00145         static const int one = 1;
00146         static const uint16 bits = ECL_SIZE_OF_INT*8;
00147         static const uint16 bytes = ECL_SIZE_OF_INT;
00148         static const int minimum = INT_MIN;
00149         static const int maximum = INT_MAX;
00150 
00151         typedef float Precision;
00152         static const Precision dummy_precision;
00153 };
00154 
00160 template <>
00161 class ecl_type_traits_PUBLIC numeric_limits<unsigned int> : public std::numeric_limits<unsigned int> {
00162 public:
00163         static const unsigned int one = 1U;
00164         static const uint16 bits = ECL_SIZE_OF_INT*8;
00165         static const uint16 bytes = ECL_SIZE_OF_INT;
00166         static const unsigned int minimum = 0U;
00167         static const unsigned int maximum = UINT_MAX;
00168 
00169         typedef float Precision;
00170         static const Precision dummy_precision;
00171 };
00172 
00173 
00179 template <>
00180 class ecl_type_traits_PUBLIC numeric_limits<long> : public std::numeric_limits<long> {
00181 public:
00182         static const long one = 1L;
00183         static const uint16 bits = ECL_SIZE_OF_LONG*8;
00184         static const uint16 bytes = ECL_SIZE_OF_LONG;
00185         static const long minimum = LONG_MIN;
00186         static const long maximum = LONG_MAX;
00187 
00188         typedef float Precision;
00189         static const Precision dummy_precision;
00190 };
00191 
00197 template <>
00198 class ecl_type_traits_PUBLIC numeric_limits<unsigned long> : public std::numeric_limits<unsigned long> {
00199 public:
00200         static const unsigned long one = 1UL;
00201         static const uint16 bits = ECL_SIZE_OF_LONG*8;
00202         static const uint16 bytes = ECL_SIZE_OF_LONG;
00203         static const unsigned long minimum = 0UL;
00204         static const unsigned long maximum = ULONG_MAX;
00205 
00206         typedef float Precision;
00207         static const Precision dummy_precision;
00208 };
00209 
00215 template <>
00216 class ecl_type_traits_PUBLIC numeric_limits<long long> : public std::numeric_limits<long long> {
00217 public:
00218         static const long long one = 1LL;
00219         static const uint16 bits = ECL_SIZE_OF_LONG_LONG*8;
00220         static const uint16 bytes = ECL_SIZE_OF_LONG_LONG;
00221         static const long long minimum = LLONG_MIN;
00222         static const long long maximum = LLONG_MAX;
00223 
00224         typedef float Precision;
00225         static const Precision dummy_precision;
00226 };
00227 
00233 template <>
00234 class ecl_type_traits_PUBLIC numeric_limits<unsigned long long> : public std::numeric_limits<unsigned long long> {
00235 public:
00236         static const unsigned long long one = 1ULL;
00237         static const uint16 bits = ECL_SIZE_OF_LONG_LONG*8;
00238         static const uint16 bytes = ECL_SIZE_OF_LONG_LONG;
00239         static const unsigned long long minimum = 0ULL;
00240         static const unsigned long long maximum = ULLONG_MAX;
00241 
00242         typedef float Precision;
00243         static const Precision dummy_precision;
00244 };
00245 
00251 template <>
00252 class ecl_type_traits_PUBLIC numeric_limits<float> : public std::numeric_limits<float> {
00253 public:
00254         static const uint16 bits = ECL_SIZE_OF_FLOAT*8;
00255         static const uint16 bytes = ECL_SIZE_OF_FLOAT;
00256 
00257         typedef float Precision; 
00258         static const float dummy_precision; 
00260         static const float minimum;
00261         static const float maximum;
00262 };
00263 
00269 template <>
00270 class ecl_type_traits_PUBLIC numeric_limits<double> : public std::numeric_limits<double> {
00271 public:
00272         static const uint16 bits = ECL_SIZE_OF_DOUBLE*8;
00273         static const uint16 bytes = ECL_SIZE_OF_DOUBLE;
00274 
00275         typedef double Precision; 
00276         static const double dummy_precision; 
00278         static const double minimum;
00279         static const double maximum;
00280 };
00281 
00287 template <>
00288 class ecl_type_traits_PUBLIC numeric_limits<long double> : public std::numeric_limits<long double> {
00289 public:
00290         static const uint16 bits = ECL_SIZE_OF_LONG_DOUBLE*8;
00291         static const uint16 bytes = ECL_SIZE_OF_LONG_DOUBLE;
00292 
00293         typedef long double Precision; 
00294         static const long double dummy_precision; 
00296         static const long double minimum;
00297         static const long double maximum;
00298 };
00299 
00300 
00301 } // namespace ecl
00302 
00303 #endif /* ECL_TYPE_TRAITS_NUMERIC_LIMITS_HPP_ */


ecl_type_traits
Author(s): Daniel Stonier
autogenerated on Wed Aug 26 2015 11:27:08