Go to the documentation of this file.00001
00002 #ifndef vgl_io_homg_plane_3d_txx_
00003 #define vgl_io_homg_plane_3d_txx_
00004
00005
00006
00007 #include "vgl_io_homg_plane_3d.h"
00008 #include <vsl/vsl_binary_io.h>
00009
00010
00011
00012 template<class T>
00013 void vsl_b_write(vsl_b_ostream &os, const vgl_homg_plane_3d<T> & p)
00014 {
00015 const short io_version_no = 1;
00016 vsl_b_write(os, io_version_no);
00017 vsl_b_write(os, p.nx());
00018 vsl_b_write(os, p.ny());
00019 vsl_b_write(os, p.nz());
00020 vsl_b_write(os, p.d());
00021 }
00022
00023
00024
00025 template<class T>
00026 void vsl_b_read(vsl_b_istream &is, vgl_homg_plane_3d<T> & p)
00027 {
00028 if (!is) return;
00029
00030 short v;
00031 vsl_b_read(is, v);
00032 switch (v)
00033 {
00034 case 1:
00035 T x,y,z,d;
00036 vsl_b_read(is, x);
00037 vsl_b_read(is, y);
00038 vsl_b_read(is, z);
00039 vsl_b_read(is, d);
00040 p.set(x,y,z,d);
00041 break;
00042
00043 default:
00044 vcl_cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, vgl_homg_plane_3d<T>&)\n"
00045 << " Unknown version number "<< v << '\n';
00046 is.is().clear(vcl_ios::badbit);
00047 return;
00048 }
00049 }
00050
00051
00052
00053
00054 template<class T>
00055 void vsl_print_summary(vcl_ostream& os,const vgl_homg_plane_3d<T> & p)
00056 {
00057 os<<"( x,y,z="<< p.nx()<<','<<p.ny()<<','<<p.nz()<< " d=" << p.d() << ')';
00058 }
00059
00060 #define VGL_IO_HOMG_PLANE_3D_INSTANTIATE(T) \
00061 template void vsl_print_summary(vcl_ostream &, const vgl_homg_plane_3d<T > &); \
00062 template void vsl_b_read(vsl_b_istream &, vgl_homg_plane_3d<T > &); \
00063 template void vsl_b_write(vsl_b_ostream &, const vgl_homg_plane_3d<T > &)
00064
00065 #endif // vgl_io_homg_plane_3d_txx_