MrSID Decode SDK for Raster Reference Manual  9.0.0.3864
lt_ioBufferedStream.h
Go to the documentation of this file.
00001 /* $Id$ */
00002 /* //////////////////////////////////////////////////////////////////////////
00003 //                                                                         //
00004 // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue,   //
00005 // Suite 200, Seattle, WA 98104.  Unauthorized use or distribution         //
00006 // prohibited.  Access to and use of this code is permitted only under     //
00007 // license from LizardTech, Inc.  Portions of the code are protected by    //
00008 // US and foreign patents and other filings. All Rights Reserved.          //
00009 //                                                                         //
00011 /* PUBLIC */
00012 
00013 #ifndef LT_IO_BUFFERED_STREAM_H
00014 #define LT_IO_BUFFERED_STREAM_H
00015 
00016 #include "lt_ioStreamInf.h"
00017 
00018 LT_BEGIN_NAMESPACE( LizardTech )
00019 
00020 class LTIOBufPage;
00021 class LTIOBufPageCache;
00022 
00028 class LTIOBufferedStream : public LTIOStreamInf
00029 {
00030 public:
00031    LTIOBufferedStream();
00032    virtual ~LTIOBufferedStream();
00033 
00043    virtual LT_STATUS initialize(   LTIOStreamInf* src,
00044                                  lt_uint32 pageSize=1024,
00045                                  lt_uint32 numPages = 10,
00046                                  const char* tempDir = 0L);
00047 
00048 
00049    virtual bool isEOF();
00050    virtual bool isOpen();
00051    virtual LT_STATUS open();
00052    virtual LT_STATUS close();
00053    virtual lt_uint32 read( lt_uint8 *pDest, lt_uint32 numBytes );
00054    virtual lt_uint32 write( const lt_uint8 *pSrc, lt_uint32 numBytes );
00055    virtual LT_STATUS seek( lt_int64 offset, LTIOSeekDir origin );
00056    virtual lt_int64 tell();
00057    virtual LTIOStreamInf* duplicate();
00058    virtual LT_STATUS getLastError() const;
00059    virtual const char* getID() const;
00060 
00061 private:
00062    const LTIOBufPage* getPage( lt_uint64 pageIndex );
00063 
00064 protected:
00065    lt_uint32      m_pageSize;
00066    lt_uint32      m_numPages;
00067    LTIOBufPageCache*      m_buffer;
00068    LTIOStreamInf*   m_src;
00069    lt_uint64      m_cur;
00070    bool             m_eof;
00071    char*            m_tempDir;
00072 };
00073 
00074 
00075 
00076 LT_END_NAMESPACE( LizardTech )
00077 
00078 
00079 #endif   // LT_IO_BUFFERED_STREAM_H