core/vil1/io/vil1_io_image_impl.cxx

Go to the documentation of this file.
00001 // This is core/vil1/io/vil1_io_image_impl.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 
00008 #include "vil1_io_image_impl.h"
00009 #include <vsl/vsl_binary_io.h>
00010 #include <vsl/vsl_clipon_binary_loader.txx>
00011 
00012 //: Write derived class to os using vil1_image_impl reference
00013 void vil1_io_image_impl::b_write_by_base(vsl_b_ostream& os,
00014                                          const vil1_image_impl& base) const
00015 {
00016   vsl_b_write(os,base);
00017 }
00018 
00019 //: Write derived class to os using vil1_image_impl reference
00020 void vil1_io_image_impl::b_read_by_base(vsl_b_istream& is,
00021                                         vil1_image_impl& base) const
00022 {
00023   vsl_b_read(is,base);
00024 }
00025 
00026 //: Print summary of derived class to os using vil1_image_impl reference
00027 void vil1_io_image_impl::print_summary_by_base(vcl_ostream& os,
00028                                                const vil1_image_impl& base) const
00029 {
00030   vsl_print_summary(os,base);
00031 }
00032 
00033 //=========================================================================
00034 //: Binary save self to stream.
00035 void vsl_b_write(vsl_b_ostream & os, const vil1_image_impl & )
00036 {
00037   const short io_version_no = 1;
00038   vsl_b_write(os, io_version_no);
00039   // Nothing to save.
00040 }
00041 
00042 //=========================================================================
00043 //: Binary load self from stream.
00044 void vsl_b_read(vsl_b_istream &is, vil1_image_impl & )
00045 {
00046   if (!is) return;
00047 
00048   short ver;
00049 
00050   vsl_b_read(is, ver);
00051   switch (ver)
00052   {
00053    case 1:
00054     // Nothing to load.
00055    default:
00056     vcl_cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, vil1_image_impl&)\n"
00057              << "           Unknown version number "<< ver << '\n';
00058     is.is().clear(vcl_ios::badbit); // Set an unrecoverable IO error on stream
00059     return;
00060   }
00061 }
00062 
00063 //=========================================================================
00064 //: Output a human readable summary to the stream
00065 void vsl_print_summary(vcl_ostream & /*os*/,const vil1_image_impl & /*p*/)
00066 {
00067   vcl_cerr << "vsl_print_summary() NYI\n";
00068 }
00069 
00070 //: Add example object to list of those that can be loaded
00071 //  The vsl_binary_loader must see an example of each derived class
00072 //  before it knows how to deal with them.
00073 //  A clone is taken of b
00074 void vsl_add_to_binary_loader(const vil1_io_image_impl& b)
00075 {
00076     vsl_clipon_binary_loader<vil1_image_impl,vil1_io_image_impl>::
00077       instance().add(b);
00078 }
00079 
00080 
00081 //: Binary save to stream by vil1_image_impl pointer
00082 void vsl_b_write(vsl_b_ostream &os, const vil1_image_impl * b)
00083 {
00084     vsl_clipon_binary_loader<vil1_image_impl,vil1_io_image_impl>::
00085       instance().write_object(os,b);
00086 }
00087 
00088 //: Binary read from stream by vil1_image_impl pointer
00089 void vsl_b_read(vsl_b_istream &is, vil1_image_impl* &b)
00090 {
00091     vsl_clipon_binary_loader<vil1_image_impl,vil1_io_image_impl>::
00092       instance().read_object(is,b);
00093 }
00094 
00095 //: Print summary to stream by vil1_image_impl pointer
00096 void vsl_print_summary(vcl_ostream &os, const vil1_image_impl * b)
00097 {
00098     vsl_clipon_binary_loader<vil1_image_impl,vil1_io_image_impl>::
00099       instance().print_object_summary(os,b);
00100 }
00101 
00102 // Explicitly instantiate loader
00103 VSL_CLIPON_BINARY_LOADER_INSTANTIATE(vil1_image_impl, vil1_io_image_impl);

Generated on Sat Nov 22 05:08:29 2008 for core/vil1 by  doxygen 1.5.1