00001 #ifndef CLASSLIB_INTERACTIVE_DECOMPRESSOR_H 00002 # define CLASSLIB_INTERACTIVE_DECOMPRESSOR_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/sysapi/system.h" 00007 # include "classlib/sysapi/IOTypes.h" 00008 00009 namespace lat { 00010 //<<<<<< PUBLIC DEFINES >>>>>> 00011 //<<<<<< PUBLIC CONSTANTS >>>>>> 00012 //<<<<<< PUBLIC TYPES >>>>>> 00013 00014 class Decompressor; 00015 class InputStream; 00016 class OutputStream; 00017 00018 //<<<<<< PUBLIC VARIABLES >>>>>> 00019 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00020 //<<<<<< CLASS DECLARATIONS >>>>>> 00021 00046 class InteractiveDecompressor 00047 { 00048 public: 00049 enum { DEFAULT_BUF_SIZE = 4096 }; 00050 00051 virtual ~InteractiveDecompressor (void); 00052 00053 virtual void begin (void); 00054 00055 protected: 00056 InteractiveDecompressor (Decompressor *decompressor, 00057 InputStream *input = 0, 00058 OutputStream *output = 0, 00059 IOSize inBufSize = DEFAULT_BUF_SIZE, 00060 IOSize outBufSize = DEFAULT_BUF_SIZE); 00061 00062 virtual void setInputStream (InputStream *input); 00063 virtual void setOutputStream (OutputStream *output); 00064 00065 virtual void waitForInput (void); 00066 virtual void waitForOutput (void); 00067 00068 virtual void doInput (void); 00069 virtual void doOutput (void); 00070 virtual void decompress (void); 00071 00072 virtual bool flush (void); 00073 virtual void finish (void); 00074 00075 Decompressor *m_decompressor;//< The decompressor engine 00076 00077 InputStream *m_input; //< The non-blocking input 00078 unsigned char *m_inBuf; //< Internal input buffer 00079 IOSize m_inBufSize; //< Size of m_inBuf 00080 bool m_inputting; //< Set when doInput() is registered 00081 00082 OutputStream *m_output; //< The non-blocking output 00083 unsigned char *m_outBuf; //< Internal output buffer 00084 IOSize m_outBufSize; //< Size of m_outBuf 00085 IOSize m_out; //< Bytes of data remaining in m_outBuf 00086 IOSize m_bottom; //< Offset at which m_out begins 00087 bool m_outputting; //< Set when doOutput() is registered 00088 00089 private: 00090 // no semantics, undefined 00091 InteractiveDecompressor (const InteractiveDecompressor &); 00092 InteractiveDecompressor &operator= (const InteractiveDecompressor &); 00093 }; 00094 00095 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00096 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00097 00098 } // namespace lat 00099 #endif // CLASSLIB_INTERACTIVE_DECOMPRESSOR_H