core/vpdl/vpdt/vpdt_field_default.h
Go to the documentation of this file.
00001 // This is core/vpdl/vpdt/vpdt_field_default.h
00002 #ifndef vpdt_field_default_h_
00003 #define vpdt_field_default_h_
00004 //:
00005 // \file
00006 // \author Matthew Leotta
00007 // \brief A type generator for the default types (those used in vpdl)
00008 // \date March 5, 2009
00009 //
00010 // The default field types are scalar, fixed vector, and variable vector
00011 // This class acts as an inverse to vpdt_field_traits.  From the scalar
00012 // type (T) and dimension (n), it produces the default field type according to:
00013 // - For n > 1 the field type is vnl_vector_fixed<T,n>
00014 // - For n == 1 the field type is T
00015 // - For n == 0 the field type is vnl_vector<T>
00016 //
00017 // The n == 0 indicates that the dimension is dynamic and set at run time.
00018 //
00019 // \verbatim
00020 //  Modifications
00021 //   None
00022 // \endverbatim
00023 
00024 #include <vnl/vnl_vector.h>
00025 #include <vnl/vnl_vector_fixed.h>
00026 
00027 
00028 //: Generate the default field type for scalar type T and dimension n
00029 template <class T, unsigned int n=0>
00030 struct vpdt_field_default 
00031 {
00032   //: The default field type
00033   typedef vnl_vector_fixed<T,n> type;
00034 };
00035 
00036 
00037 //: Generate the default field type for scalar type T and dimension n
00038 template <class T>
00039 struct vpdt_field_default<T,1>
00040 {
00041   //: The default field type
00042   typedef T type;
00043 };
00044 
00045 
00046 //: Generate the default field type for scalar type T and dimension n
00047 template <class T>
00048 struct vpdt_field_default<T,0>
00049 {
00050   //: The default field type
00051   typedef vnl_vector<T> type;
00052 };
00053 
00054 
00055 #endif // vpdt_field_default_h_