00001 // This is core/vil1/vil1_stream.h 00002 #ifndef vil1_stream_h_ 00003 #define vil1_stream_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief Stream interface for VIL image loaders 00010 // \author awf@robots.ox.ac.uk 00011 // \date 16 Feb 00 00012 00013 typedef long int vil1_streampos; // should be identical to vcl_istream::streampos 00014 00015 //: Stream interface for VIL image loaders 00016 // This allows the loaders to be used with any type of stream. 00017 class vil1_stream 00018 { 00019 public: 00020 //: Return false if the stream is broken. 00021 virtual bool ok() const = 0; 00022 00023 //: Write n bytes from buf. Returns number of bytes written. 00024 // The return value is less than n only in case of device failure. 00025 virtual vil1_streampos write(void const* buf, vil1_streampos n) = 0; 00026 00027 //: Read n bytes into buf. Returns number of bytes read. 00028 // The return value is less than n only at eof. 00029 virtual vil1_streampos read(void* buf, vil1_streampos n) = 0; 00030 00031 //: Return file pointer 00032 virtual vil1_streampos tell() const = 0; 00033 00034 //: Goto file pointer 00035 virtual void seek(vil1_streampos position) = 0; 00036 00037 //: up/down the reference count 00038 void ref() { ++refcount_; } 00039 void unref(); 00040 00041 protected: 00042 vil1_stream(); 00043 virtual ~vil1_stream(); 00044 00045 private: // use the methods, Luke! 00046 int refcount_; 00047 }; 00048 00049 #endif // vil1_stream_h_
1.5.1