core/vil1/vil1_ip_traits.h

Go to the documentation of this file.
00001 // This is core/vil1/vil1_ip_traits.h
00002 #ifndef vil1_ip_traits_h_
00003 #define vil1_ip_traits_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Describe image types
00010 // \author   awf@robots.ox.ac.uk
00011 // \date 02 Mar 00
00012 
00013 struct vil1_ip_traits_null_type {};
00014 
00015 //: Describe image types (like char**)
00016 template <class T>
00017 struct vil1_ip_traits
00018 {
00019   //: The return type of operator[][]
00020   typedef vil1_ip_traits pixel_type;
00021 
00022   //: The return type of operator[]
00023   typedef vil1_ip_traits row_type;
00024 };
00025 
00026 #if VCL_CAN_DO_PARTIAL_SPECIALIZATION
00027 //: Traits for c-like arrays
00028 template <class T>
00029 struct vil1_ip_traits<T * *>
00030 {
00031   typedef T pixel_type;
00032   typedef T* row_type;
00033 };
00034 
00035 template <class T>
00036 struct vil1_ip_traits<T const* const*>
00037 {
00038   typedef T pixel_type;
00039   typedef T const* row_type;
00040 };
00041 
00042 template <class T>
00043 struct vil1_ip_traits<T * const*>
00044 {
00045   typedef T pixel_type;
00046   typedef T const* row_type;
00047 };
00048 #else
00049 // It's like the good old days... #define declare_list(T)
00050 #define VIL1_IP_TRAITS_DECLARE(T, RT, PT) \
00051 VCL_DEFINE_SPECIALIZATION struct vil1_ip_traits<T > {\
00052  typedef PT pixel_type;\
00053  typedef RT row_type;\
00054  };
00055 
00056 #define VIL1_IP_TRAITS_DECLARE_ALL(T)\
00057 VIL1_IP_TRAITS_DECLARE(T       *      *, T      *, T)\
00058 VIL1_IP_TRAITS_DECLARE(T       * const*, T      *, T)\
00059 VIL1_IP_TRAITS_DECLARE(T       * const* const, T      * const, T)\
00060 VIL1_IP_TRAITS_DECLARE(T  const* const*, T const*, T)
00061 
00062 VIL1_IP_TRAITS_DECLARE_ALL(unsigned char)
00063 VIL1_IP_TRAITS_DECLARE_ALL(short)
00064 VIL1_IP_TRAITS_DECLARE_ALL(int)
00065 VIL1_IP_TRAITS_DECLARE_ALL(float)
00066 
00067 #endif // VCL_CAN_DO_PARTIAL_SPECIALIZATION
00068 
00069 #endif // vil1_ip_traits_h_

Generated on Sat Nov 22 05:08:29 2008 for core/vil1 by  doxygen 1.5.1