00001 // This is brl/bseg/bbgm/bbgm_feature_image.txx 00002 #ifndef bbgm_feature_image_txx_ 00003 #define bbgm_feature_image_txx_ 00004 //: 00005 // \file 00006 00007 #include "bbgm_feature_image.h" 00008 #include <vbl/io/vbl_io_array_2d.h> 00009 #include <vcl_typeinfo.h> 00010 00011 //=========================================================================== 00012 // Binary I/O Methods 00013 00014 00015 //: Return a string name 00016 // \note this is probably not portable 00017 template<class f_type_> 00018 vcl_string 00019 bbgm_feature_image<f_type_>::is_a() const 00020 { 00021 return "bbgm_feature_image<"+vcl_string(typeid(f_type_).name())+">"; 00022 } 00023 00024 00025 template<class f_type_> 00026 bbgm_feature_image_base* 00027 bbgm_feature_image<f_type_>::clone() const 00028 { 00029 return new bbgm_feature_image<f_type_>(*this); 00030 } 00031 00032 00033 //: Return IO version number; 00034 template<class f_type_> 00035 short 00036 bbgm_feature_image<f_type_>::version() const 00037 { 00038 return 1; 00039 } 00040 00041 00042 //: Binary save self to stream. 00043 template<class f_type_> 00044 void 00045 bbgm_feature_image<f_type_>::b_write(vsl_b_ostream &os) const 00046 { 00047 vsl_b_write(os, version()); 00048 vsl_b_write(os, data_); 00049 } 00050 00051 00052 //: Binary load self from stream. 00053 template<class f_type_> 00054 void 00055 bbgm_feature_image<f_type_>::b_read(vsl_b_istream &is) 00056 { 00057 if (!is) 00058 return; 00059 short ver; 00060 vsl_b_read(is, ver); 00061 switch (ver) 00062 { 00063 case 1: 00064 vsl_b_read(is, data_); 00065 break; 00066 default: 00067 vcl_cerr << "bbgm_image: unknown I/O version " << ver << '\n'; 00068 } 00069 } 00070 00071 00072 #include <vbl/io/vbl_io_array_2d.txx> 00073 #include <vsl/vsl_vector_io.txx> 00074 #define BBGM_FEATURE_IMAGE_INSTANTIATE(T) \ 00075 template class bbgm_feature_image<T >; \ 00076 VBL_IO_ARRAY_2D_INSTANTIATE(T) 00077 00078 00079 #endif // bbgm_feature_image_txx_