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

vigra/binary.hxx |

    00001 /************************************************************************/
    00002 /*                                                                      */
    00003 /*               Copyright 2009-2010 by Ullrich Koethe                  */
    00004 /*       Cognitive Systems Group, University of Hamburg, Germany        */
    00005 /*                                                                      */
    00006 /*    This file is part of the VIGRA computer vision library.           */
    00007 /*    The VIGRA Website is                                              */
    00008 /*        http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/      */
    00009 /*    Please direct questions, bug reports, and contributions to        */
    00010 /*        ullrich.koethe@iwr.uni-heidelberg.de    or                    */
    00011 /*        vigra@informatik.uni-hamburg.de                               */
    00012 /*                                                                      */
    00013 /*    Permission is hereby granted, free of charge, to any person       */
    00014 /*    obtaining a copy of this software and associated documentation    */
    00015 /*    files (the "Software"), to deal in the Software without           */
    00016 /*    restriction, including without limitation the rights to use,      */
    00017 /*    copy, modify, merge, publish, distribute, sublicense, and/or      */
    00018 /*    sell copies of the Software, and to permit persons to whom the    */
    00019 /*    Software is furnished to do so, subject to the following          */
    00020 /*    conditions:                                                       */
    00021 /*                                                                      */
    00022 /*    The above copyright notice and this permission notice shall be    */
    00023 /*    included in all copies or substantial portions of the             */
    00024 /*    Software.                                                         */
    00025 /*                                                                      */
    00026 /*    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND    */
    00027 /*    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES   */
    00028 /*    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND          */
    00029 /*    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT       */
    00030 /*    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,      */
    00031 /*    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      */
    00032 /*    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR     */
    00033 /*    OTHER DEALINGS IN THE SOFTWARE.                                   */
    00034 /*                                                                      */
    00035 /************************************************************************/
    00036
    00037 #ifndef VIGRA_BINARY_HXX
    00038 #define VIGRA_BINARY_HXX
    00039
    00040 #include "sized_int.hxx"
    00041
    00042 namespace vigra {
    00043
    00044 template<unsigned int p,unsigned int i> struct BinaryDigit
    00045 {
    00046   static const unsigned int value = p*16+i;
    00047   typedef BinaryDigit<value,0> OOOO;
    00048   typedef BinaryDigit<value,1> OOOI;
    00049   typedef BinaryDigit<value,2> OOIO;
    00050   typedef BinaryDigit<value,3> OOII;
    00051   typedef BinaryDigit<value,4> OIOO;
    00052   typedef BinaryDigit<value,5> OIOI;
    00053   typedef BinaryDigit<value,6> OIIO;
    00054   typedef BinaryDigit<value,7> OIII;
    00055   typedef BinaryDigit<value,8> IOOO;
    00056   typedef BinaryDigit<value,9> IOOI;
    00057   typedef BinaryDigit<value,10> IOIO;
    00058   typedef BinaryDigit<value,11> IOII;
    00059   typedef BinaryDigit<value,12> IIOO;
    00060   typedef BinaryDigit<value,13> IIOI;
    00061   typedef BinaryDigit<value,14> IIIO;
    00062   typedef BinaryDigit<value,15> IIII;
    00063
    00064   operator unsigned int() { return value; }
    00065 };
    00066
    00067 struct Bin
    00068 {
    00069   typedef BinaryDigit<0,0> OOOO;
    00070   typedef BinaryDigit<0,1> OOOI;
    00071   typedef BinaryDigit<0,2> OOIO;
    00072   typedef BinaryDigit<0,3> OOII;
    00073   typedef BinaryDigit<0,4> OIOO;
    00074   typedef BinaryDigit<0,5> OIOI;
    00075   typedef BinaryDigit<0,6> OIIO;
    00076   typedef BinaryDigit<0,7> OIII;
    00077   typedef BinaryDigit<0,8> IOOO;
    00078   typedef BinaryDigit<0,9> IOOI;
    00079   typedef BinaryDigit<0,10> IOIO;
    00080   typedef BinaryDigit<0,11> IOII;
    00081   typedef BinaryDigit<0,12> IIOO;
    00082   typedef BinaryDigit<0,13> IIOI;
    00083   typedef BinaryDigit<0,14> IIIO;
    00084   typedef BinaryDigit<0,15> IIII;
    00085 };
    00086
    00087 } // namespace vigra
    00088
    00089 #endif // VIGRA_BINARY_HXX
    00090

© 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)