00001 // This is core/vil1/io/vil1_io_image_impl.h 00002 #ifndef vil1_io_image_impl_h 00003 #define vil1_io_image_impl_h 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \author Ian Scott (Manchester) 00010 // \date 21-Mar-2001 00011 00012 #include <vsl/vsl_binary_io.h> 00013 #include <vil1/vil1_image_impl.h> 00014 00015 //: Base for objects which provide IO for classes derived from vil1_image_impl 00016 class vil1_io_image_impl 00017 { 00018 public: 00019 //: Constructor 00020 vil1_io_image_impl() {} 00021 00022 //: Destructor 00023 virtual ~vil1_io_image_impl() {} 00024 00025 //: Create new object of type vil1_image_impl on heap 00026 virtual vil1_image_impl* new_object() const = 0; 00027 00028 //: Write derived class to os using vil1_image_impl reference 00029 virtual void b_write_by_base(vsl_b_ostream& os, 00030 const vil1_image_impl& base) const; 00031 00032 //: Write derived class to os using vil1_image_impl reference 00033 virtual void b_read_by_base(vsl_b_istream& is, 00034 vil1_image_impl& base) const; 00035 00036 //: Print summary of derived class to os using vil1_image_impl reference 00037 virtual void print_summary_by_base(vcl_ostream& os, 00038 const vil1_image_impl& base) const; 00039 00040 //: Copy this object onto the heap and return a pointer 00041 virtual vil1_io_image_impl* clone() const =0; 00042 00043 //: Return name of class for which this object provides IO 00044 virtual vcl_string target_classname() const { return "vil1_image_impl"; } 00045 00046 //: Return true if b is of class target_classname() 00047 // Typically this will just be "return b.is_a()==target_classname()" 00048 // However, third party libraries may use a different system 00049 virtual bool is_io_for(const vil1_image_impl& b) const 00050 { return b.is_a()==target_classname(); } 00051 }; 00052 00053 //: Add example object to list of those that can be loaded 00054 // The vsl_binary_loader must see an example of each derived class 00055 // before it knows how to deal with them. 00056 // A clone is taken of b 00057 void vsl_add_to_binary_loader(const vil1_io_image_impl& b); 00058 00059 //: Binary save to stream by vil1_image_impl pointer 00060 void vsl_b_write(vsl_b_ostream &os, const vil1_image_impl * b); 00061 00062 //: Binary read from stream by vil1_image_impl pointer 00063 void vsl_b_read(vsl_b_istream &is, vil1_image_impl* &b); 00064 00065 //: Print summary to stream by vil1_image_impl pointer 00066 void vsl_print_summary(vcl_ostream &os, const vil1_image_impl * b); 00067 00068 //: Binary save vil1_real_polynomial to stream. 00069 void vsl_b_write(vsl_b_ostream &os, const vil1_image_impl & v); 00070 00071 //: Binary load vil1_real_polynomial from stream. 00072 void vsl_b_read(vsl_b_istream &is, vil1_image_impl & v); 00073 00074 //: Print human readable summary of object to a stream 00075 void vsl_print_summary(vcl_ostream& os,const vil1_image_impl & b); 00076 00077 #endif // vil1_io_image_impl_h
1.5.1