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 #include "exception.h"
00033
00034 namespace OpenRaw {
00035 namespace IO {
00036
00040 class Stream
00041 {
00042 public:
00046 Stream(const char *filename);
00047 virtual ~Stream();
00048
00052 typedef ::or_error Error;
00053
00054
00056 virtual Error open() = 0;
00058 virtual int close() = 0;
00060 virtual int seek(off_t offset, int whence) = 0;
00062 virtual int read(void *buf, size_t count) = 0;
00063 virtual off_t filesize() = 0;
00064
00065
00066
00067 Error get_error()
00068 {
00069 return m_error;
00070 }
00071
00073 const std::string &get_path() const
00074 {
00075 return m_fileName;
00076 }
00077
00078 uint8_t readByte() throw(Internals::IOException);
00079 protected:
00080 void set_error(Error error)
00081 {
00082 m_error = error;
00083 }
00084
00085 private:
00087 Stream(const Stream& f);
00089 Stream & operator=(const Stream&);
00090
00092 std::string m_fileName;
00093 Error m_error;
00094 };
00095
00096 }
00097 }
00098
00099
00100 #endif