1// tiff stream interface class definition 2 3#ifndef _TIFF_STREAM_H_ 4#define _TIFF_STREAM_H_ 5 6#include <iostream.h> 7 8#include "tiffio.h" 9 10class TiffStream { 11 12public: 13 // ctor/dtor 14 TiffStream(); 15 ~TiffStream(); 16 17public: 18 enum SeekDir { 19 beg, 20 cur, 21 end, 22 }; 23 24public: 25 // factory methods 26 TIFF* makeFileStream(iostream* str); 27 TIFF* makeFileStream(istream* str); 28 TIFF* makeFileStream(ostream* str); 29 30public: 31 // tiff client methods 32 static tsize_t read(thandle_t fd, tdata_t buf, tsize_t size); 33 static tsize_t write(thandle_t fd, tdata_t buf, tsize_t size); 34 static toff_t seek(thandle_t fd, toff_t offset, int origin); 35 static toff_t size(thandle_t fd); 36 static int close(thandle_t fd); 37 static int map(thandle_t fd, tdata_t* phase, toff_t* psize); 38 static void unmap(thandle_t fd, tdata_t base, tsize_t size); 39 40public: 41 // query method 42 TIFF* getTiffHandle() const { return m_tif; } 43 unsigned int getStreamLength() { return m_streamLength; } 44 45private: 46 // internal methods 47 unsigned int getSize(thandle_t fd); 48 unsigned int tell(thandle_t fd); 49 bool seekInt(thandle_t fd, unsigned int offset, int origin); 50 bool isOpen(thandle_t fd); 51 52private: 53 thandle_t m_this; 54 TIFF* m_tif; 55 static const char* m_name; 56 istream* m_inStream; 57 ostream* m_outStream; 58 iostream* m_ioStream; 59 int m_streamLength; 60 61}; 62 63#endif // _TIFF_STREAM_H_/* 64 * Local Variables: 65 * mode: c++ 66 * c-basic-offset: 8 67 * fill-column: 78 68 * End: 69 */ 70