[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

Numeric and Promote Traits of FixedPoint16 |

The numeric and promote traits for FixedPoint16 follow the general specifications for Numeric and Promotion Traits and AlgebraicRing. They are implemented in terms of the traits of the basic types by partial template specialization:

        template <int IntBits, FPOverflowHandling OverflowHandling>
        struct NumericTraits<FixedPoint16<IntBits, OverflowHandling> >
        {
            typedef FixedPoint16<IntBits, OverflowHandling> Type;
            typedef Type                                    Promote;
                // RealPromote undefined -- multiplication with double is not supported.
                // ComplexPromote undefined -- multiplication with double is not supported.
            typedef Type ValueType;

            typedef VigraFalseType isIntegral;
            typedef VigraTrueType  isScalar;
            typedef VigraTrueType  isSigned;
            typedef VigraTrueType  isOrdered;
            typedef VigraFalseType isComplex;

            ... // etc.
        };

        template <int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
        struct PromoteTraits<FixedPoint16<IntBits1, OverflowHandling>,
                             FixedPoint16<IntBits2, OverflowHandling> >
        {
            typedef FixedPoint16<MetaMax<IntBits1, IntBits2>::value, OverflowHandling> Promote;
            ... // etc.
        };

        template <int IntBits, FPOverflowHandling OverflowHandling>
        struct NormTraits<FixedPoint16<IntBits, OverflowHandling> >
        {
            typedef FixedPoint16<IntBits, OverflowHandling>     Type;
            typedef typename PromoteTraits<Type, Type>::Promote SquaredNormType;
            typedef Type                                        NormType;
        };

        template <int IntBits, FPOverflowHandling OverflowHandling>
        struct SquareRootTraits<FixedPoint16<IntBits, OverflowHandling> >
        {
            typedef FixedPoint16<IntBits, OverflowHandling>            Type;
            typedef FixedPoint16<(IntBits + 1) / 2, OverflowHandling>  SquareRootResult;
            typedef Type                                               SquareRootArgument;
        };

#include <vigra/fixedpoint.hxx>
Namespace: vigra

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.7.1 (3 Dec 2010)