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