DGtal  0.9.4beta
NumberTraits.h
1 
17 #pragma once
18 
31 #if defined(NumberTraits_RECURSES)
32 #error Recursive header files inclusion detected in NumberTraits.h
33 #else // defined(NumberTraits_RECURSES)
34 
35 #define NumberTraits_RECURSES
36 
37 #if !defined NumberTraits_h
38 
39 #define NumberTraits_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <limits>
45 #include <cfloat>
46 #include <boost/integer_traits.hpp>
47 #include <boost/call_traits.hpp>
48 #include "DGtal/base/Common.h"
50 
51 namespace DGtal
52 {
53  enum BoundEnum {BOUNDED = 0, UNBOUNDED = 1, BOUND_UNKNOWN = 2};
54  enum SignEnum {SIGNED = 0, UNSIGNED = 1, SIGN_UNKNOWN = 2};
55 
56 
58 // template class NumberTraits
68  template <typename T>
69  struct NumberTraits
70  {
71  // ----------------------- Associated types ------------------------------
77  typedef T SignedVersion;
78  typedef T UnsignedVersion;
79  typedef T ReturnType;
80 
81  //Defines a type that represents the "best" way to pass
82  // a parameter of type T to a function.
83  typedef typename boost::call_traits<T>::param_type ParamType;
84 
85 
90 #if ( defined(WIN32))
91  static const T ZERO;
92 #else
93  static const T ZERO = T(0);
94 #endif
95 
99 #if (defined (WIN32))
100  static const T ONE;
101 #else
102  static const T ONE = T(1);
103 #endif
104 
108  static ReturnType zero();
109 
113  static ReturnType one();
114 
119  static ReturnType min();
120 
125  static ReturnType max();
126 
131  static unsigned int digits();
132 
136  static BoundEnum isBounded();
140  static SignEnum isSigned();
141 
146  static DGtal::int64_t castToInt64_t(const T & aT)
147  {
148  return static_cast<DGtal::int64_t>(aT);
149  }
154  static double castToDouble(const T & aT)
155  {
156  return static_cast<double>(aT);
157  }
162  static bool even( ParamType aT )
163  {
164  return ( aT & ONE ) == ZERO;
165  }
170  static bool odd( ParamType aT )
171  {
172  return ( aT & ONE ) != ZERO;
173  }
174  }; // end of class NumberTraits
175 
176 
180  template <>
182  {
191  typedef boost::call_traits<uint16_t>::param_type ParamType;
192  static const uint16_t ZERO; // = 0;
193  static const uint16_t ONE; // = 1;
194  static ReturnType zero()
195  {
196  return 0;
197  }
198  static ReturnType one()
199  {
200  return 1;
201  }
202  static ReturnType min()
203  {
204  return boost::integer_traits<uint16_t>::const_min;
205  }
206  static ReturnType max()
207  {
208  return boost::integer_traits<uint16_t>::const_max;
209  }
210  static unsigned int digits()
211  {
212  return boost::integer_traits<uint16_t>::digits;
213  }
215  {
216  return BOUNDED;
217  }
219  {
220  return UNSIGNED;
221  }
223  {
224  return static_cast<DGtal::int64_t>(aT);
225  }
230  static double castToDouble(const uint16_t & aT)
231  {
232  return static_cast<double>(aT);
233  }
238  static bool even( ParamType aT )
239  {
240  return ( aT & 1 ) == 0;
241  }
246  static bool odd( ParamType aT )
247  {
248  return ( aT & 1 ) != 0;
249  }
250 
251  }; // end of class NumberTraits<uint16_t>.
252 
256  template <>
258  {
262  typedef TagTrue IsSigned;
267  typedef boost::call_traits<int16_t>::param_type ParamType;
268  static const int16_t ZERO; // = 0;
269  static const int16_t ONE; // = 1;
270  static ReturnType zero()
271  {
272  return 0;
273  }
274  static ReturnType one()
275  {
276  return 1;
277  }
278  static ReturnType min()
279  {
280  return boost::integer_traits<int16_t>::const_min;
281  }
282  static ReturnType max()
283  {
284  return boost::integer_traits<int16_t>::const_max;
285  }
286  static unsigned int digits()
287  {
288  return boost::integer_traits<int16_t>::digits;
289  }
291  {
292  return BOUNDED;
293  }
295  {
296  return SIGNED;
297  }
299  {
300  return static_cast<DGtal::int64_t>(aT);
301  }
306  static double castToDouble(const int16_t & aT)
307  {
308  return static_cast<double>(aT);
309  }
314  static bool even( ParamType aT )
315  {
316  return ( aT & 1 ) == 0;
317  }
322  static bool odd( ParamType aT )
323  {
324  return ( aT & 1 ) != 0;
325  }
326  }; // end of class NumberTraits<int16_t>.
327 
328 
332  template <>
334  {
343  typedef boost::call_traits<uint8_t>::param_type ParamType;
344  static const uint8_t ZERO; // = 0;
345  static const uint8_t ONE; // = 1;
346  static ReturnType zero()
347  {
348  return 0;
349  }
350  static ReturnType one()
351  {
352  return 1;
353  }
354  static ReturnType min()
355  {
356  return boost::integer_traits<uint8_t>::const_min;
357  }
358  static ReturnType max()
359  {
360  return boost::integer_traits<uint8_t>::const_max;
361  }
362  static unsigned int digits()
363  {
364  return boost::integer_traits<uint8_t>::digits;
365  }
367  {
368  return BOUNDED;
369  }
371  {
372  return UNSIGNED;
373  }
375  {
376  return static_cast<DGtal::int64_t>(aT);
377  }
382  static double castToDouble(const uint8_t & aT)
383  {
384  return static_cast<double>(aT);
385  }
390  static bool even( ParamType aT )
391  {
392  return ( aT & 1 ) == 0;
393  }
398  static bool odd( ParamType aT )
399  {
400  return ( aT & 1 ) != 0;
401  }
402 
403  }; // end of class NumberTraits<uint8_t>.
404 
408  template <>
410  {
414  typedef TagTrue IsSigned;
419  typedef boost::call_traits<int8_t>::param_type ParamType;
420  static const int8_t ZERO; // = 0;
421  static const int8_t ONE; // = 1;
422  static ReturnType zero()
423  {
424  return 0;
425  }
426  static ReturnType one()
427  {
428  return 1;
429  }
430  static ReturnType min()
431  {
432  return boost::integer_traits<int8_t>::const_min;
433  }
434  static ReturnType max()
435  {
436  return boost::integer_traits<int8_t>::const_max;
437  }
438  static unsigned int digits()
439  {
440  return boost::integer_traits<int8_t>::digits;
441  }
443  {
444  return BOUNDED;
445  }
447  {
448  return SIGNED;
449  }
451  {
452  return static_cast<DGtal::int64_t>(aT);
453  }
458  static double castToDouble(const int8_t & aT)
459  {
460  return static_cast<double>(aT);
461  }
466  static bool even( ParamType aT )
467  {
468  return ( aT & 1 ) == 0;
469  }
474  static bool odd( ParamType aT )
475  {
476  return ( aT & 1 ) != 0;
477  }
478  }; // end of class NumberTraits<int16_t>.
479 
483  template <>
485  {
494  typedef boost::call_traits<uint32_t>::param_type ParamType;
495  static const uint32_t ZERO; // = 0;
496  static const uint32_t ONE; // = 1;
497  static ReturnType zero()
498  {
499  return 0;
500  }
501  static ReturnType one()
502  {
503  return 1;
504  }
505  static ReturnType min()
506  {
507  return boost::integer_traits<uint32_t>::const_min;
508  }
509  static ReturnType max()
510  {
511  return boost::integer_traits<uint32_t>::const_max;
512  }
513  static unsigned int digits()
514  {
515  return boost::integer_traits<uint32_t>::digits;
516  }
518  {
519  return BOUNDED;
520  }
522  {
523  return UNSIGNED;
524  }
526  {
527  return static_cast<DGtal::int64_t>(aT);
528  }
529  static double castToDouble(const uint32_t & aT)
530  {
531  return static_cast<double>(aT);
532  }
537  static bool even( ParamType aT )
538  {
539  return ( aT & 1 ) == 0;
540  }
545  static bool odd( ParamType aT )
546  {
547  return ( aT & 1 ) != 0;
548  }
549  }; // end of class NumberTraits<uint32_t>.
550 
554  template <>
556  {
560  typedef TagTrue IsSigned;
565  typedef boost::call_traits<int32_t>::param_type ParamType;
566  static const int32_t ZERO;// = 0;
567  static const int32_t ONE;// = 1;
568  static ReturnType zero()
569  {
570  return 0;
571  }
572  static ReturnType one()
573  {
574  return 1;
575  }
576  static ReturnType min()
577  {
578  return boost::integer_traits<int32_t>::const_min;
579  }
580  static ReturnType max()
581  {
582  return boost::integer_traits<int32_t>::const_max;
583  }
584  static unsigned int digits()
585  {
586  return boost::integer_traits<int32_t>::digits;
587  }
589  {
590  return BOUNDED;
591  }
593  {
594  return SIGNED;
595  }
597  {
598  return static_cast<DGtal::int64_t>(aT);
599  }
604  static double castToDouble(const int32_t & aT)
605  {
606  return static_cast<double>(aT);
607  }
612  static bool even( ParamType aT )
613  {
614  return ( aT & 1 ) == 0;
615  }
620  static bool odd( ParamType aT )
621  {
622  return ( aT & 1 ) != 0;
623  }
624  }; // end of class NumberTraits<int32_t>.
625 
629  template <>
631  {
640  typedef boost::call_traits<uint64_t>::param_type ParamType;
641  static const uint64_t ZERO; // = 0;
642  static const uint64_t ONE; // = 1;
643  static ReturnType zero()
644  {
645  return 0;
646  }
647  static ReturnType one()
648  {
649  return 1;
650  }
651  static ReturnType min()
652  {
653  return boost::integer_traits<uint64_t>::const_min;
654  }
655  static ReturnType max()
656  {
657  return boost::integer_traits<uint64_t>::const_max;
658  }
659  static unsigned int digits()
660  {
661  return boost::integer_traits<uint64_t>::digits;
662  }
664  {
665  return BOUNDED;
666  }
668  {
669  return UNSIGNED;
670  }
672  {
673  return static_cast<DGtal::int64_t>(aT);
674  }
679  static double castToDouble(const uint64_t & aT)
680  {
681  return static_cast<double>(aT);
682  }
687  static bool even( ParamType aT )
688  {
689  return ( aT & 1 ) == 0;
690  }
695  static bool odd( ParamType aT )
696  {
697  return ( aT & 1 ) != 0;
698  }
699  }; // end of class NumberTraits<uint64_t>.
700 
704  template <>
706  {
710  typedef TagTrue IsSigned;
715  typedef boost::call_traits<int64_t>::param_type ParamType;
716  static const int64_t ZERO; // = 0;
717  static const int64_t ONE; // = 1;
718  static ReturnType zero()
719  {
720  return 0;
721  }
722  static ReturnType one()
723  {
724  return 1;
725  }
726  static ReturnType min()
727  {
728  return boost::integer_traits<int64_t>::const_min;
729  }
730  static ReturnType max()
731  {
732  return boost::integer_traits<int64_t>::const_max;
733  }
734  static unsigned int digits()
735  {
736  return boost::integer_traits<int64_t>::digits;
737  }
739  {
740  return BOUNDED;
741  }
743  {
744  return SIGNED;
745  }
747  {
748  return aT;
749  }
750  static double castToDouble(const int64_t & aT)
751  {
752  return static_cast<double>(aT);
753  }
758  static bool even( ParamType aT )
759  {
760  return ( aT & 1 ) == 0;
761  }
766  static bool odd( ParamType aT )
767  {
768  return ( aT & 1 ) != 0;
769  }
770  }; // end of class NumberTraits<int64_t>.
771 
775  template <>
776  struct NumberTraits<float>
777  {
781  typedef TagTrue IsSigned;
783  typedef float SignedVersion;
784  typedef float UnsignedVersion;
785  typedef float ReturnType;
786  typedef boost::call_traits<float>::param_type ParamType;
787  static const float ZERO;
788  static const float ONE;
789  static ReturnType zero()
790  {
791  return 0.0f;
792  }
793  static ReturnType one()
794  {
795  return 1.0f;
796  }
797  static ReturnType min()
798  {
799  return FLT_MIN;
800  }
801  static ReturnType max()
802  {
803  return FLT_MAX;
804  }
805  static unsigned int digits()
806  {
807  return FLT_DIG;
808  }
810  {
811  return BOUNDED;
812  }
814  {
815  return SIGNED;
816  }
817  static DGtal::int64_t castToInt64_t(const float & aT)
818  {
819  return static_cast<int64_t>( aT );
820  }
821  static double castToDouble(const float & aT)
822  {
823  return static_cast<double>(aT);
824  }
825  }; // end of class NumberTraits<float>.
826 
827 
831  template <>
832  struct NumberTraits<double>
833  {
837  typedef TagTrue IsSigned;
839  typedef double SignedVersion;
840  typedef double UnsignedVersion;
841  typedef double ReturnType;
842  typedef boost::call_traits<double>::param_type ParamType;
843  static const double ZERO;
844  static const double ONE;
845  static ReturnType zero()
846  {
847  return 0.0;
848  }
849  static ReturnType one()
850  {
851  return 1.0;
852  }
853  static ReturnType min()
854  {
855  return DBL_MIN;
856  }
857  static ReturnType max()
858  {
859  return DBL_MAX;
860  }
861  static unsigned int digits()
862  {
863  return DBL_DIG;
864  }
866  {
867  return BOUNDED;
868  }
870  {
871  return SIGNED;
872  }
873  static DGtal::int64_t castToInt64_t(const double & aT)
874  {
875  return static_cast<int64_t>( aT );
876  }
877  static double castToDouble(const double & aT)
878  {
879  return static_cast<double>(aT);
880  }
881  }; // end of class NumberTraits<double>.
882 
883 
887  template <>
888  struct NumberTraits<long double>
889  {
893  typedef TagTrue IsSigned;
895  typedef long double SignedVersion;
896  typedef long double UnsignedVersion;
897  typedef long double ReturnType;
898  typedef boost::call_traits<long double>::param_type ParamType;
899  static const long double ZERO;
900  static const long double ONE;
901  static ReturnType zero()
902  {
903  return 0.0;
904  }
905  static ReturnType one()
906  {
907  return 1.0;
908  }
909  static ReturnType min()
910  {
911  return LDBL_MIN;
912  }
913  static ReturnType max()
914  {
915  return LDBL_MAX;
916  }
917  static unsigned int digits()
918  {
919  return LDBL_DIG;
920  }
922  {
923  return BOUNDED;
924  }
926  {
927  return SIGNED;
928  }
929  static DGtal::int64_t castToInt64_t(const long double & aT)
930  {
931  return static_cast<int64_t>( aT );
932  }
933  static double castToDouble(const long double & aT)
934  {
935  return static_cast<double>(aT);
936  }
937  }; // end of class NumberTraits<long double>.
938 
939 
940 
941 #ifdef APPLE
942 
945  template <>
946  struct NumberTraits<unsigned long>
947  {
948  typedef TagTrue IsIntegral;
949  typedef TagTrue IsBounded;
950  typedef TagTrue IsUnsigned;
951  typedef TagFalse IsSigned;
952  typedef TagTrue IsSpecialized;
953  typedef long SignedVersion;
954  typedef unsigned long UnsignedVersion;
955  typedef unsigned long ReturnType;
956  typedef boost::call_traits<unsigned long>::param_type ParamType;
957  static const unsigned long ZERO;
958  static const unsigned long ONE;
959  static ReturnType zero()
960  {
961  return 0;
962  }
963  static ReturnType one()
964  {
965  return 1;
966  }
967  static ReturnType min()
968  {
969  return boost::integer_traits<unsigned long>::const_min;
970  }
971  static ReturnType max()
972  {
973  return boost::integer_traits<unsigned long>::const_max;
974  }
975  static unsigned int digits()
976  {
977  return boost::integer_traits<unsigned long>::digits;
978  }
979  static BoundEnum isBounded()
980  {
981  return BOUNDED;
982  }
983  static SignEnum isSigned()
984  {
985  return SIGNED;
986  }
987  static DGtal::int64_t castToInt64_t(const unsigned long & aT)
988  {
989  return static_cast<int64_t>( aT );
990  }
991  static double castToDouble(const unsigned long & aT)
992  {
993  return static_cast<double>(aT);
994  }
995  }; // end of class NumberTraits<unsigned long>.
996 #endif
997 
998 
999 #ifdef WITH_BIGINTEGER
1000 
1006  template <>
1007  struct NumberTraits<DGtal::BigInteger>
1008  {
1009  typedef TagTrue IsIntegral;
1010  typedef TagFalse IsBounded;
1011  typedef TagTrue IsUnsigned;
1012  typedef TagTrue IsSigned;
1013  typedef TagTrue IsSpecialized;
1016  typedef DGtal::BigInteger ReturnType;
1017  typedef DGtal::BigInteger ParamType;
1018  static const DGtal::BigInteger ZERO;
1019  static const DGtal::BigInteger ONE;
1020  static ReturnType zero()
1021  {
1022  return ZERO;
1023  }
1024  static ReturnType one()
1025  {
1026  return ONE;
1027  }
1028  static ReturnType min()
1029  {
1030  FATAL_ERROR_MSG(false, "UnBounded interger type does not support min() function");
1031  return ZERO;
1032  }
1033  static ReturnType max()
1034  {
1035  FATAL_ERROR_MSG(false, "UnBounded interger type does not support max() function");
1036  return ZERO;
1037  }
1038 
1039  static unsigned int digits()
1040  {
1041  FATAL_ERROR_MSG(false, "UnBounded interger type does not support digits() function");
1042  return 0;
1043  }
1044  static BoundEnum isBounded()
1045  {
1046  return BOUNDED;
1047  }
1048  static SignEnum isSigned()
1049  {
1050  return SIGNED;
1051  }
1053  {
1054  return aT.get_si();
1055  }
1056  static double castToDouble(const DGtal::BigInteger & aT)
1057  {
1058  return aT.get_d();
1059  }
1064  static bool even( ParamType aT )
1065  {
1066  return mpz_even_p( aT.get_mpz_t() );
1067  }
1072  static bool odd( ParamType aT )
1073  {
1074  return mpz_odd_p( aT.get_mpz_t() );
1075  }
1076  }; // end of class NumberTraits<DGtal::BigInteger>.
1077 #endif
1078 
1079 
1081 
1082  template<class A, class B>
1084  {
1086  };
1087 
1088  template<>
1090  {
1092  };
1093 
1094 } // namespace DGtal
1095 
1096 
1098 // Includes inline functions.
1099 #include "DGtal/kernel/NumberTraits.ih"
1100 
1101 // //
1103 
1104 #endif // !defined NumberTraits_h
1105 
1106 #undef NumberTraits_RECURSES
1107 #endif // else defined(NumberTraits_RECURSES)
static const int8_t ZERO
Definition: NumberTraits.h:420
boost::uint32_t uint32_t
unsigned 32-bit integer.
Definition: BasicTypes.h:63
static double castToDouble(const uint64_t &aT)
Definition: NumberTraits.h:679
boost::call_traits< uint8_t >::param_type ParamType
Definition: NumberTraits.h:343
static const int16_t ONE
Definition: NumberTraits.h:269
static const uint64_t ZERO
Definition: NumberTraits.h:641
static DGtal::int64_t castToInt64_t(const int8_t &aT)
Definition: NumberTraits.h:450
static BoundEnum isBounded()
Definition: NumberTraits.h:214
static BoundEnum isBounded()
Definition: NumberTraits.h:809
static bool even(ParamType aT)
Definition: NumberTraits.h:314
static BoundEnum isBounded()
Definition: NumberTraits.h:517
TagUnknown IsUnsigned
Definition: NumberTraits.h:73
static unsigned int digits()
static const int8_t ONE
Definition: NumberTraits.h:421
boost::int8_t int8_t
signed 8-bit integer.
Definition: BasicTypes.h:68
static bool odd(ParamType aT)
Definition: NumberTraits.h:398
static unsigned int digits()
Definition: NumberTraits.h:438
static BoundEnum isBounded()
Definition: NumberTraits.h:588
static unsigned int digits()
Definition: NumberTraits.h:286
static DGtal::int64_t castToInt64_t(const int64_t &aT)
Definition: NumberTraits.h:746
static ReturnType min()
Definition: NumberTraits.h:797
static const uint8_t ONE
Definition: NumberTraits.h:345
static unsigned int digits()
Definition: NumberTraits.h:659
static double castToDouble(const uint8_t &aT)
Definition: NumberTraits.h:382
static ReturnType min()
static BoundEnum isBounded()
static const long double ONE
Definition: NumberTraits.h:900
static double castToDouble(const T &aT)
Definition: NumberTraits.h:154
static bool even(ParamType aT)
Definition: NumberTraits.h:390
boost::call_traits< long double >::param_type ParamType
Definition: NumberTraits.h:898
static double castToDouble(const uint32_t &aT)
Definition: NumberTraits.h:529
boost::call_traits< int64_t >::param_type ParamType
Definition: NumberTraits.h:715
static ReturnType zero()
Definition: NumberTraits.h:718
static ReturnType one()
Definition: NumberTraits.h:849
static unsigned int digits()
Definition: NumberTraits.h:210
static ReturnType max()
static bool even(ParamType aT)
Definition: NumberTraits.h:758
static unsigned int digits()
Definition: NumberTraits.h:584
static bool odd(ParamType aT)
Definition: NumberTraits.h:322
static const T ZERO
Definition: NumberTraits.h:93
static bool odd(ParamType aT)
Definition: NumberTraits.h:766
static unsigned int digits()
Definition: NumberTraits.h:362
static DGtal::int64_t castToInt64_t(const float &aT)
Definition: NumberTraits.h:817
static ReturnType max()
Definition: NumberTraits.h:801
static const double ZERO
Definition: NumberTraits.h:843
static ReturnType zero()
static ReturnType max()
Definition: NumberTraits.h:434
static bool even(ParamType aT)
Definition: NumberTraits.h:687
boost::call_traits< int8_t >::param_type ParamType
Definition: NumberTraits.h:419
boost::call_traits< T >::param_type ParamType
Definition: NumberTraits.h:83
static const int16_t ZERO
Definition: NumberTraits.h:268
static bool even(ParamType aT)
Definition: NumberTraits.h:238
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition: BasicTypes.h:79
static SignEnum isSigned()
Definition: NumberTraits.h:869
static BoundEnum isBounded()
Definition: NumberTraits.h:663
static ReturnType zero()
Definition: NumberTraits.h:789
static const int32_t ONE
Definition: NumberTraits.h:567
static double castToDouble(const int32_t &aT)
Definition: NumberTraits.h:604
boost::int16_t int16_t
signed 16-bit integer.
Definition: BasicTypes.h:70
boost::call_traits< double >::param_type ParamType
Definition: NumberTraits.h:842
static unsigned int digits()
Definition: NumberTraits.h:861
static ReturnType one()
static bool odd(ParamType aT)
Definition: NumberTraits.h:474
static const uint64_t ONE
Definition: NumberTraits.h:642
static BoundEnum isBounded()
Definition: NumberTraits.h:442
static const uint32_t ZERO
Definition: NumberTraits.h:495
static bool even(ParamType aT)
Definition: NumberTraits.h:466
static BoundEnum isBounded()
Definition: NumberTraits.h:290
static ReturnType zero()
Definition: NumberTraits.h:422
static ReturnType zero()
Definition: NumberTraits.h:845
static ReturnType min()
Definition: NumberTraits.h:853
static DGtal::int64_t castToInt64_t(const uint64_t &aT)
Definition: NumberTraits.h:671
boost::call_traits< float >::param_type ParamType
Definition: NumberTraits.h:786
static DGtal::int64_t castToInt64_t(const uint32_t &aT)
Definition: NumberTraits.h:525
static const T ONE
Definition: NumberTraits.h:102
boost::call_traits< int16_t >::param_type ParamType
Definition: NumberTraits.h:267
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:69
boost::call_traits< uint32_t >::param_type ParamType
Definition: NumberTraits.h:494
boost::uint16_t uint16_t
unsigned 16-bit integer.
Definition: BasicTypes.h:61
static DGtal::int64_t castToInt64_t(const T &aT)
Definition: NumberTraits.h:146
static const int64_t ONE
Definition: NumberTraits.h:717
static const uint8_t ZERO
Definition: NumberTraits.h:344
static double castToDouble(const int16_t &aT)
Definition: NumberTraits.h:306
static ReturnType zero()
Definition: NumberTraits.h:568
static DGtal::int64_t castToInt64_t(const uint16_t &aT)
Definition: NumberTraits.h:222
Warning_promote_trait_not_specialized_for_this_case promote_t
static const double ONE
Definition: NumberTraits.h:844
static double castToDouble(const int64_t &aT)
Definition: NumberTraits.h:750
static double castToDouble(const int8_t &aT)
Definition: NumberTraits.h:458
static const uint16_t ZERO
Definition: NumberTraits.h:192
TagUnknown IsBounded
Definition: NumberTraits.h:72
static bool even(ParamType aT)
Definition: NumberTraits.h:162
static SignEnum isSigned()
static ReturnType min()
Definition: NumberTraits.h:430
DGtal is the top-level namespace which contains all DGtal functions and types.
static unsigned int digits()
Definition: NumberTraits.h:805
static ReturnType zero()
Definition: NumberTraits.h:346
boost::uint8_t uint8_t
unsigned 8-bit integer.
Definition: BasicTypes.h:59
static ReturnType max()
Definition: NumberTraits.h:857
static const int64_t ZERO
Definition: NumberTraits.h:716
static BoundEnum isBounded()
Definition: NumberTraits.h:865
boost::uint64_t uint64_t
unsigned 64-bit integer.
Definition: BasicTypes.h:65
static DGtal::int64_t castToInt64_t(const int16_t &aT)
Definition: NumberTraits.h:298
static bool odd(ParamType aT)
Definition: NumberTraits.h:545
static bool odd(ParamType aT)
Definition: NumberTraits.h:620
static DGtal::int64_t castToInt64_t(const long double &aT)
Definition: NumberTraits.h:929
static bool even(ParamType aT)
Definition: NumberTraits.h:612
static ReturnType zero()
Definition: NumberTraits.h:270
static unsigned int digits()
Definition: NumberTraits.h:734
static const uint16_t ONE
Definition: NumberTraits.h:193
boost::call_traits< int32_t >::param_type ParamType
Definition: NumberTraits.h:565
static ReturnType one()
Definition: NumberTraits.h:793
static DGtal::int64_t castToInt64_t(const int32_t &aT)
Definition: NumberTraits.h:596
static double castToDouble(const long double &aT)
Definition: NumberTraits.h:933
static DGtal::int64_t castToInt64_t(const uint8_t &aT)
Definition: NumberTraits.h:374
static double castToDouble(const double &aT)
Definition: NumberTraits.h:877
static double castToDouble(const float &aT)
Definition: NumberTraits.h:821
TagUnknown IsIntegral
Definition: NumberTraits.h:75
static SignEnum isSigned()
Definition: NumberTraits.h:813
static BoundEnum isBounded()
Definition: NumberTraits.h:366
static bool even(ParamType aT)
Definition: NumberTraits.h:537
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
static SignEnum isSigned()
Definition: NumberTraits.h:446
static bool odd(ParamType aT)
Definition: NumberTraits.h:246
static ReturnType one()
Definition: NumberTraits.h:426
boost::call_traits< uint64_t >::param_type ParamType
Definition: NumberTraits.h:640
static const uint32_t ONE
Definition: NumberTraits.h:496
static const float ONE
Definition: NumberTraits.h:788
TagUnknown IsSigned
Definition: NumberTraits.h:74
boost::int64_t int64_t
signed 94-bit integer.
Definition: BasicTypes.h:74
static const float ZERO
Definition: NumberTraits.h:787
TagFalse IsSpecialized
Definition: NumberTraits.h:76
static DGtal::int64_t castToInt64_t(const double &aT)
Definition: NumberTraits.h:873
static BoundEnum isBounded()
Definition: NumberTraits.h:738
static bool odd(ParamType aT)
Definition: NumberTraits.h:695
boost::call_traits< uint16_t >::param_type ParamType
Definition: NumberTraits.h:191
static unsigned int digits()
Definition: NumberTraits.h:513
static unsigned int digits()
Definition: NumberTraits.h:917
static const int32_t ZERO
Definition: NumberTraits.h:566
static double castToDouble(const uint16_t &aT)
Definition: NumberTraits.h:230
static const long double ZERO
Definition: NumberTraits.h:899
static bool odd(ParamType aT)
Definition: NumberTraits.h:170