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

details vigra/metaprogramming.hxx VIGRA

00001 /************************************************************************/
00002 /*                                                                      */
00003 /*               Copyright 1998-2002 by Ullrich Koethe                  */
00004 /*       Cognitive Systems Group, University of Hamburg, Germany        */
00005 /*                                                                      */
00006 /*    This file is part of the VIGRA computer vision library.           */
00007 /*    ( Version 1.2.0, Aug 07 2003 )                                    */
00008 /*    You may use, modify, and distribute this software according       */
00009 /*    to the terms stated in the LICENSE file included in               */
00010 /*    the VIGRA distribution.                                           */
00011 /*                                                                      */
00012 /*    The VIGRA Website is                                              */
00013 /*        http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/      */
00014 /*    Please direct questions, bug reports, and contributions to        */
00015 /*        koethe@informatik.uni-hamburg.de                              */
00016 /*                                                                      */
00017 /*  THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY EXPRESS OR          */
00018 /*  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED      */
00019 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
00020 /*                                                                      */
00021 /************************************************************************/
00022 
00023 #ifndef VIGRA_METAPROGRAMMING_HXX
00024 #define VIGRA_METAPROGRAMMING_HXX
00025 
00026 namespace vigra {
00027 
00028 struct VigraTrueType
00029 {
00030    enum { asBool = true };
00031 };
00032 
00033 struct VigraFalseType
00034 {
00035     enum { asBool = false };
00036 };
00037 
00038 /**  \addtogroup MultiArrayTags Multi-dimensional Array Tags
00039       Meta-programming tags to mark array's as strided or unstrided.
00040 */
00041 
00042 //@{
00043 
00044 /********************************************************/
00045 /*                                                      */
00046 /*                   StridedArrayTag                    */
00047 /*                                                      */
00048 /********************************************************/
00049 
00050 /** tag for marking a MultiArray strided.
00051 
00052 <b>\#include</b>
00053 "<a href="multi_array_8hxx-source.html">vigra/multi_array.hxx</a>"
00054 
00055 Namespace: vigra
00056 */
00057 struct StridedArrayTag {};
00058 
00059 /********************************************************/
00060 /*                                                      */
00061 /*                  UnstridedArrayTag                   */
00062 /*                                                      */
00063 /********************************************************/
00064 
00065 /** tag for marking a MultiArray unstrided.
00066 
00067 <b>\#include</b>
00068 "<a href="multi_array_8hxx-source.html">vigra/multi_array.hxx</a>"
00069 
00070 Namespace: vigra
00071 */
00072 struct UnstridedArrayTag {};
00073 
00074 template<class T>
00075 class TypeTraits
00076 {
00077   public:
00078     typedef VigraFalseType isPOD;
00079     typedef VigraFalseType isBuiltinType;
00080 };
00081 
00082 #ifndef NO_PARTIAL_TEMPLATE_SPECIALIZATION
00083 template<class T> 
00084 class TypeTraits<T *>
00085 {
00086   public:
00087     typedef VigraTrueType isPOD;
00088     typedef VigraTrueType isBuiltinType;
00089 };
00090 
00091 template<class T> 
00092 class TypeTraits<T const *>
00093 {
00094   public:
00095     typedef VigraTrueType isPOD;
00096     typedef VigraTrueType isBuiltinType;
00097 };
00098 #endif
00099 
00100 #define VIGRA_TYPE_TRAITS(type) \
00101 template<> \
00102 class TypeTraits<type> \
00103 { \
00104   public: \
00105     typedef VigraTrueType isPOD; \
00106     typedef VigraTrueType isBuiltinType; \
00107 };
00108 
00109 VIGRA_TYPE_TRAITS(char)
00110 VIGRA_TYPE_TRAITS(signed char)
00111 VIGRA_TYPE_TRAITS(unsigned char)
00112 VIGRA_TYPE_TRAITS(short)
00113 VIGRA_TYPE_TRAITS(unsigned short)
00114 VIGRA_TYPE_TRAITS(int)
00115 VIGRA_TYPE_TRAITS(unsigned int)
00116 VIGRA_TYPE_TRAITS(long)
00117 VIGRA_TYPE_TRAITS(unsigned long)
00118 VIGRA_TYPE_TRAITS(float)
00119 VIGRA_TYPE_TRAITS(double)
00120 VIGRA_TYPE_TRAITS(long double)
00121 
00122 #undef VIGRA_TYPE_TRAITS
00123 
00124 //@}
00125 
00126 } // namespace vigra
00127 
00128 #endif /* VIGRA_METAPROGRAMMING_HXX */

© Ullrich Köthe (koethe@informatik.uni-hamburg.de)
Cognitive Systems Group, University of Hamburg, Germany

html generated using doxygen and Python
VIGRA 1.2.0 (7 Aug 2003)