numeric_limits.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_TYPE_TRAITS_NUMERIC_LIMITS_HPP_
13 #define ECL_TYPE_TRAITS_NUMERIC_LIMITS_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include <limits>
20 #include <climits>
22 #include "macros.hpp"
23 
24 /*****************************************************************************
25 ** Namespaces
26 *****************************************************************************/
27 
28 namespace ecl {
29 
30 /*****************************************************************************
31 ** Parent Template
32 *****************************************************************************/
55 template <typename T>
56 class ecl_type_traits_PUBLIC numeric_limits : public std::numeric_limits<T> {
57 public:
58  numeric_limits() {}
59 private:
60 };
61 
62 /*****************************************************************************
63 ** Specialisations
64 *****************************************************************************/
70 template <>
71 class ecl_type_traits_PUBLIC numeric_limits<char> : public std::numeric_limits<char> {
72 public:
73  static const char one = 1;
74  static const uint16 bits = ECL_SIZE_OF_CHAR*8;
75  static const uint16 bytes = ECL_SIZE_OF_CHAR;
76  static const char minimum = CHAR_MIN;
77  static const char maximum = CHAR_MAX;
78 
79  typedef float Precision;
80  static const Precision dummy_precision;
81 };
82 
88 template <>
89 class ecl_type_traits_PUBLIC numeric_limits<unsigned char> : public std::numeric_limits<unsigned char> {
90 public:
91  static const unsigned char one = 1U;
92  static const uint16 bits = ECL_SIZE_OF_CHAR*8;
93  static const uint16 bytes = ECL_SIZE_OF_CHAR;
94  static const unsigned char minimum = 0U;
95  static const unsigned char maximum = UCHAR_MAX;
96 
97  typedef float Precision;
98  static const Precision dummy_precision;
99 };
100 
106 template <>
107 class ecl_type_traits_PUBLIC numeric_limits<short> : public std::numeric_limits<short> {
108 public:
109  static const short one = 1;
110  static const uint16 bits = ECL_SIZE_OF_SHORT*8;
111  static const uint16 bytes = ECL_SIZE_OF_SHORT;
112  static const short minimum = SHRT_MIN;
113  static const short maximum = SHRT_MAX;
114 
115  typedef float Precision;
116  static const Precision dummy_precision;
117 };
118 
124 template <>
125 class ecl_type_traits_PUBLIC numeric_limits<unsigned short> : public std::numeric_limits<unsigned short> {
126 public:
127  static const unsigned short one = 1U;
128  static const uint16 bits = ECL_SIZE_OF_SHORT*8;
129  static const uint16 bytes = ECL_SIZE_OF_SHORT;
130  static const unsigned short minimum = 0U;
131  static const unsigned short maximum = USHRT_MAX;
132 
133  typedef float Precision;
134  static const Precision dummy_precision;
135 };
136 
142 template <>
143 class ecl_type_traits_PUBLIC numeric_limits<int> : public std::numeric_limits<int> {
144 public:
145  static const int one = 1;
146  static const uint16 bits = ECL_SIZE_OF_INT*8;
147  static const uint16 bytes = ECL_SIZE_OF_INT;
148  static const int minimum = INT_MIN;
149  static const int maximum = INT_MAX;
150 
151  typedef float Precision;
152  static const Precision dummy_precision;
153 };
154 
160 template <>
161 class ecl_type_traits_PUBLIC numeric_limits<unsigned int> : public std::numeric_limits<unsigned int> {
162 public:
163  static const unsigned int one = 1U;
164  static const uint16 bits = ECL_SIZE_OF_INT*8;
165  static const uint16 bytes = ECL_SIZE_OF_INT;
166  static const unsigned int minimum = 0U;
167  static const unsigned int maximum = UINT_MAX;
168 
169  typedef float Precision;
170  static const Precision dummy_precision;
171 };
172 
173 
179 template <>
180 class ecl_type_traits_PUBLIC numeric_limits<long> : public std::numeric_limits<long> {
181 public:
182  static const long one = 1L;
183  static const uint16 bits = ECL_SIZE_OF_LONG*8;
184  static const uint16 bytes = ECL_SIZE_OF_LONG;
185  static const long minimum = LONG_MIN;
186  static const long maximum = LONG_MAX;
187 
188  typedef float Precision;
189  static const Precision dummy_precision;
190 };
191 
197 template <>
198 class ecl_type_traits_PUBLIC numeric_limits<unsigned long> : public std::numeric_limits<unsigned long> {
199 public:
200  static const unsigned long one = 1UL;
201  static const uint16 bits = ECL_SIZE_OF_LONG*8;
202  static const uint16 bytes = ECL_SIZE_OF_LONG;
203  static const unsigned long minimum = 0UL;
204  static const unsigned long maximum = ULONG_MAX;
205 
206  typedef float Precision;
207  static const Precision dummy_precision;
208 };
209 
215 template <>
216 class ecl_type_traits_PUBLIC numeric_limits<long long> : public std::numeric_limits<long long> {
217 public:
218  static const long long one = 1LL;
219  static const uint16 bits = ECL_SIZE_OF_LONG_LONG*8;
220  static const uint16 bytes = ECL_SIZE_OF_LONG_LONG;
221  static const long long minimum = LLONG_MIN;
222  static const long long maximum = LLONG_MAX;
223 
224  typedef float Precision;
225  static const Precision dummy_precision;
226 };
227 
233 template <>
234 class ecl_type_traits_PUBLIC numeric_limits<unsigned long long> : public std::numeric_limits<unsigned long long> {
235 public:
236  static const unsigned long long one = 1ULL;
237  static const uint16 bits = ECL_SIZE_OF_LONG_LONG*8;
238  static const uint16 bytes = ECL_SIZE_OF_LONG_LONG;
239  static const unsigned long long minimum = 0ULL;
240  static const unsigned long long maximum = ULLONG_MAX;
241 
242  typedef float Precision;
243  static const Precision dummy_precision;
244 };
245 
251 template <>
252 class ecl_type_traits_PUBLIC numeric_limits<float> : public std::numeric_limits<float> {
253 public:
254  static const uint16 bits = ECL_SIZE_OF_FLOAT*8;
255  static const uint16 bytes = ECL_SIZE_OF_FLOAT;
256 
257  typedef float Precision;
258  static const float dummy_precision;
260  static const float minimum;
261  static const float maximum;
262 };
263 
269 template <>
270 class ecl_type_traits_PUBLIC numeric_limits<double> : public std::numeric_limits<double> {
271 public:
272  static const uint16 bits = ECL_SIZE_OF_DOUBLE*8;
273  static const uint16 bytes = ECL_SIZE_OF_DOUBLE;
274 
275  typedef double Precision;
276  static const double dummy_precision;
278  static const double minimum;
279  static const double maximum;
280 };
281 
287 template <>
288 class ecl_type_traits_PUBLIC numeric_limits<long double> : public std::numeric_limits<long double> {
289 public:
290  static const uint16 bits = ECL_SIZE_OF_LONG_DOUBLE*8;
291  static const uint16 bytes = ECL_SIZE_OF_LONG_DOUBLE;
292 
293  typedef long double Precision;
294  static const long double dummy_precision;
296  static const long double minimum;
297  static const long double maximum;
298 };
299 
300 
301 } // namespace ecl
302 
303 #endif /* ECL_TYPE_TRAITS_NUMERIC_LIMITS_HPP_ */
ECL_SIZE_OF_LONG
#define ECL_SIZE_OF_LONG
portable_types.hpp
ecl::numeric_limits< unsigned int >::Precision
float Precision
Definition: numeric_limits.hpp:175
ECL_SIZE_OF_INT
#define ECL_SIZE_OF_INT
ecl::numeric_limits< unsigned long >::Precision
float Precision
Definition: numeric_limits.hpp:212
ecl::numeric_limits< long >::Precision
float Precision
Definition: numeric_limits.hpp:194
ECL_SIZE_OF_LONG_DOUBLE
#define ECL_SIZE_OF_LONG_DOUBLE
ECL_SIZE_OF_DOUBLE
#define ECL_SIZE_OF_DOUBLE
ECL_SIZE_OF_CHAR
#define ECL_SIZE_OF_CHAR
ecl_type_traits_PUBLIC
#define ecl_type_traits_PUBLIC
Definition: macros.hpp:35
ecl::numeric_limits< long long >::Precision
float Precision
Definition: numeric_limits.hpp:230
macros.hpp
Macros for windows dlls.
ecl::numeric_limits< char >::Precision
float Precision
Definition: numeric_limits.hpp:87
ecl::numeric_limits< float >::Precision
float Precision
Type used to specify precisions.
Definition: numeric_limits.hpp:263
ecl::numeric_limits< unsigned short >::Precision
float Precision
Definition: numeric_limits.hpp:139
ECL_SIZE_OF_SHORT
#define ECL_SIZE_OF_SHORT
ECL_SIZE_OF_LONG_LONG
#define ECL_SIZE_OF_LONG_LONG
ecl::numeric_limits
Expands the std numeric_limits class.
Definition: numeric_limits.hpp:62
ecl::numeric_limits< double >::Precision
double Precision
Type used to specify precisions.
Definition: numeric_limits.hpp:281
ecl::numeric_limits< int >::Precision
float Precision
Definition: numeric_limits.hpp:157
ecl::numeric_limits< unsigned char >::Precision
float Precision
Definition: numeric_limits.hpp:103
ecl::numeric_limits< short >::Precision
float Precision
Definition: numeric_limits.hpp:121
ECL_SIZE_OF_FLOAT
#define ECL_SIZE_OF_FLOAT
ecl
ecl::numeric_limits< unsigned long long >::Precision
float Precision
Definition: numeric_limits.hpp:248


ecl_type_traits
Author(s): Daniel Stonier
autogenerated on Sun Aug 2 2020 03:12:07