[Insight-developers] NumericTraits docs

Luis Ibanez luis . ibanez at kitware . com
Thu, 04 Sep 2003 17:36:06 -0400


Hi Mark,

in the file

      Code/Common/itkNumericTraits.h

the traits for max(), min() and AccumulateType are defined.

For example for "char":

> template <>
> class NumericTraits<char> : public ITK_NUMERIC_LIMITS<char> {
> public:
>   typedef char ValueType;
>   typedef int PrintType;
>   typedef unsigned char AbsType;
>   typedef short AccumulateType;
>   typedef double RealType;
>   static const char ITKCommon_EXPORT Zero;
>   static const char ITKCommon_EXPORT One;
>
>   static char min() { return char(255) < 0 ? -128 : 0; }
>   static char max() { return char(255) < 0 ? 127 : 255; }
>   static char NonpositiveMin() { return min(); }
>   static bool IsPositive(char val) { return val > Zero; }
>   static bool IsNonpositive(char val) { return val <= Zero; }
>   static bool IsNegative(char val) { return val < Zero; }
>   static bool IsNonnegative(char val) {return val >= Zero; }
> };



    Luis


Mark Foskey wrote:

> The Doxygen doc for itk::NumericTraits says, "These traits are 
> extensions of the standard <numeric_limits> defined by the C++ 
> compilers. Some of the added traits include minimum and maximum value; 
> accumulation type; etc."
>
> It doesn't seem to be the case that minimum, maximum, or accumulation 
> type are defined by any of the existing traits classes.  Should this 
> be corrected or clarified in the documentation?
>