Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_T_n.h

Go to the documentation of this file.
00001 #ifndef vnl_T_n_h_
00002 #define vnl_T_n_h_
00003 // This is vxl/vnl/vnl_T_n.h
00004 
00005 /*
00006   fsm@robots.ox.ac.uk
00007 */
00008 #include <vnl/vnl_vector_fixed.h>
00009 // Purpose: the vnl_vector_fixed<T,n> template class provides 
00010 // non-mallocing vectors of given size, but it has no constructor
00011 // from n Ts. This macro declares a class vnl_T_n which is derived
00012 // directly from vnl_vector_fixed<T,n> and has such a constructor.
00013 //
00014 // Inspired by the numerous double-3, int-2 things lying around.
00015 
00016 // cpp traits!
00017 #define vnl_T_n_aux_1(T) (T x) { data[0] = x; }
00018 #define vnl_T_n_aux_2(T) (T x, T y) { data[0] = x; data[1] = y; }
00019 #define vnl_T_n_aux_3(T) (T x, T y, T z) { data[0] = x; data[1] = y; data[2] = z; }
00020 #define vnl_T_n_aux_4(T) (T x, T y, T z, T w) { data[0] = x; data[1] = y; data[2] = z; data[3] = w; }
00021 
00022 //: this macro defines the class.
00023 // e.g. use vnl_T_n_impl(int,2) to implement class vnl_int_2.
00024 #define vnl_T_n_class_impl(T,n) \
00025 class vnl_##T##_##n : public vnl_vector_fixed<T ,n> { \
00026 public: \
00027   vnl_##T##_##n() { } \
00028   vnl_##T##_##n(vnl_vector<T > const & rhs) : vnl_vector_fixed<T ,n>(rhs) { } \
00029   vnl_##T##_##n(vnl_vector_fixed<T ,n> const & rhs) : vnl_vector_fixed<T ,n>(rhs) { } \
00030   vnl_##T##_##n vnl_T_n_aux_##n(T) \
00031 };
00032 
00033 // some compilers need a bit of help with the overload resolution.
00034 #define vnl_T_n_funcs_impl(T,n) /* no need */
00035 
00036 //: clients use this.
00037 #define vnl_T_n_impl(T,n) \
00038 vnl_T_n_class_impl(T,n) \
00039 vnl_T_n_funcs_impl(T,n)
00040 
00041 #endif // vnl_T_n_h_

Generated at Wed Mar 12 01:13:16 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000