Blame thirdparty/tiff-4.0.3/contrib/stream/tiffstream.h
|
roentgen |
b75cab |
// tiff stream interface class definition
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
#ifndef _TIFF_STREAM_H_
|
|
roentgen |
b75cab |
#define _TIFF_STREAM_H_
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
#include <iostream.h></iostream.h>
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
#include "tiffio.h"
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
class TiffStream {
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
public:
|
|
roentgen |
b75cab |
// ctor/dtor
|
|
roentgen |
b75cab |
TiffStream();
|
|
roentgen |
b75cab |
~TiffStream();
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
public:
|
|
roentgen |
b75cab |
enum SeekDir {
|
|
roentgen |
b75cab |
beg,
|
|
roentgen |
b75cab |
cur,
|
|
roentgen |
b75cab |
end,
|
|
roentgen |
b75cab |
};
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
public:
|
|
roentgen |
b75cab |
// factory methods
|
|
roentgen |
b75cab |
TIFF* makeFileStream(iostream* str);
|
|
roentgen |
b75cab |
TIFF* makeFileStream(istream* str);
|
|
roentgen |
b75cab |
TIFF* makeFileStream(ostream* str);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
public:
|
|
roentgen |
b75cab |
// tiff client methods
|
|
roentgen |
b75cab |
static tsize_t read(thandle_t fd, tdata_t buf, tsize_t size);
|
|
roentgen |
b75cab |
static tsize_t write(thandle_t fd, tdata_t buf, tsize_t size);
|
|
roentgen |
b75cab |
static toff_t seek(thandle_t fd, toff_t offset, int origin);
|
|
roentgen |
b75cab |
static toff_t size(thandle_t fd);
|
|
roentgen |
b75cab |
static int close(thandle_t fd);
|
|
roentgen |
b75cab |
static int map(thandle_t fd, tdata_t* phase, toff_t* psize);
|
|
roentgen |
b75cab |
static void unmap(thandle_t fd, tdata_t base, tsize_t size);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
public:
|
|
roentgen |
b75cab |
// query method
|
|
roentgen |
b75cab |
TIFF* getTiffHandle() const { return m_tif; }
|
|
roentgen |
b75cab |
unsigned int getStreamLength() { return m_streamLength; }
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
private:
|
|
roentgen |
b75cab |
// internal methods
|
|
roentgen |
b75cab |
unsigned int getSize(thandle_t fd);
|
|
roentgen |
b75cab |
unsigned int tell(thandle_t fd);
|
|
roentgen |
b75cab |
bool seekInt(thandle_t fd, unsigned int offset, int origin);
|
|
roentgen |
b75cab |
bool isOpen(thandle_t fd);
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
private:
|
|
roentgen |
b75cab |
thandle_t m_this;
|
|
roentgen |
b75cab |
TIFF* m_tif;
|
|
roentgen |
b75cab |
static const char* m_name;
|
|
roentgen |
b75cab |
istream* m_inStream;
|
|
roentgen |
b75cab |
ostream* m_outStream;
|
|
roentgen |
b75cab |
iostream* m_ioStream;
|
|
roentgen |
b75cab |
int m_streamLength;
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
};
|
|
roentgen |
b75cab |
|
|
roentgen |
b75cab |
#endif // _TIFF_STREAM_H_
|
|
roentgen |
b75cab |
/*
|
|
roentgen |
b75cab |
* Local Variables:
|
|
roentgen |
b75cab |
* mode: c++
|
|
roentgen |
b75cab |
* c-basic-offset: 8
|
|
roentgen |
b75cab |
* fill-column: 78
|
|
roentgen |
b75cab |
* End:
|
|
roentgen |
b75cab |
*/
|