Go to the documentation of this file.00001 #ifndef vpgl_io_proj_camera_txx_
00002 #define vpgl_io_proj_camera_txx_
00003
00004 #include "vpgl_io_proj_camera.h"
00005
00006
00007 #include <vpgl/vpgl_proj_camera.h>
00008 #include <vnl/io/vnl_io_matrix_fixed.h>
00009
00010 template <class T>
00011 void vsl_b_write(vsl_b_ostream & os, vpgl_proj_camera<T> const& camera)
00012 {
00013 if (!os) return;
00014 unsigned version = 1;
00015 vsl_b_write(os, version);
00016 vsl_b_write(os, camera.get_matrix());
00017 }
00018
00019
00020 template <class T>
00021 void vsl_b_read(vsl_b_istream & is, vpgl_proj_camera<T> &camera)
00022 {
00023 if (!is) return;
00024 short ver;
00025 vsl_b_read(is, ver);
00026 vnl_matrix_fixed<T,3,4> Pnew;
00027 switch (ver)
00028 {
00029 case 1:
00030 vsl_b_read(is, Pnew);
00031 camera.set_matrix(Pnew);
00032 break;
00033 default:
00034 vcl_cerr << "I/O ERROR: vpgl_proj_camera::b_read(vsl_b_istream&)\n"
00035 << " Unknown version number "<< ver << '\n';
00036 is.is().clear(vcl_ios::badbit);
00037 return;
00038 }
00039 }
00040
00041
00042 template <class T>
00043 void vsl_print_summary(vcl_ostream& os,const vpgl_proj_camera<T> & c)
00044 {
00045 os << c << '\n';
00046 }
00047
00048
00049 #define VPGL_IO_PROJ_CAMERA_INSTANTIATE(T) \
00050 template void vsl_b_write(vsl_b_ostream & os, vpgl_proj_camera<T > const& camera); \
00051 template void vsl_b_read(vsl_b_istream & is, vpgl_proj_camera<T > &camera); \
00052 template void vsl_print_summary(vcl_ostream& os,const vpgl_proj_camera<T > & b)
00053
00054 #endif // vpgl_io_proj_camera_txx_