00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __IO_STREAM_H__
00023 #define __IO_STREAM_H__
00024
00025 #include <sys/types.h>
00026 #include <unistd.h>
00027
00028 #include <string>
00029
00030 #include <libopenraw/libopenraw.h>
00031
00032 namespace OpenRaw {
00033 namespace IO {
00034
00038 class Stream
00039 {
00040 public:
00044 Stream(const char *filename);
00045 virtual ~Stream();
00046
00050 typedef ::or_error Error;
00051
00052
00054 virtual Error open() = 0;
00056 virtual int close() = 0;
00058 virtual int seek(off_t offset, int whence) = 0;
00060 virtual int read(void *buf, size_t count) = 0;
00061 virtual off_t filesize() = 0;
00062
00063
00064
00065 Error get_error()
00066 {
00067 return m_error;
00068 }
00069
00071 const std::string &get_path() const
00072 {
00073 return m_fileName;
00074 }
00075
00076 protected:
00077 void set_error(Error error)
00078 {
00079 m_error = error;
00080 }
00081
00082 private:
00084 Stream(const Stream& f);
00086 Stream & operator=(const Stream&);
00087
00089 std::string m_fileName;
00090 Error m_error;
00091 };
00092
00093 }
00094 }
00095
00096
00097 #endif