00001 // ===================================================================== 00021 // ===================================================================== 00022 #ifndef __TDATADEFLATION_HH 00023 #define __TDATADEFLATION_HH 00024 #ifdef __CLDAQ_ZLIB_USE 00025 00026 #include "Tglobals.h" 00027 00028 // Z_NO_COMPRESSION 0 00029 // Z_BEST_SPEED 1 00030 // Z_BEST_COMPRESSION 9 00031 // Z_DEFAULT_COMPRESSION (-1) 00032 00033 00053 class TDataDeflation 00054 { 00055 00056 private: 00057 enum { tDefaultBufferSize = 1024 * 1024 }; 00058 00059 private: 00060 Tzstream theDeflationStream; 00061 Tint theCompressionLevel; 00062 Tint theStatus; 00063 Tbyte* theOutputBuffer; 00064 Tint theSizeOfOutputBuffer; 00065 Tvoid* theDeflatedData; 00066 Tint theSizeOfDeflatedData; 00067 00068 public: 00069 TDataDeflation( Tint bufsize = tDefaultBufferSize, Tint level = Z_DEFAULT_COMPRESSION ); 00070 TDataDeflation( const TDataDeflation& right ); 00071 ~TDataDeflation(); 00072 00073 public: 00074 const TDataDeflation& operator=( const TDataDeflation& right ); 00075 00076 public: 00077 Tvoid Compress( Tvoid* input, Tint nbyte, Tbool islast = Tfalse ); 00078 00079 public: 00080 const Tzstream& GetDeflationStream() const; 00081 Tzstream& GetDeflationStream(); 00082 Tint GetCompressionLevel() const; 00083 Tint GetStatus() const; 00084 Tint GetSizeOfOutputBuffer() const; 00085 Tvoid* GetDeflatedData() const; 00086 Tint GetSizeOfDeflatedData() const; 00087 Tvoid SetCompressionLevel( Tint level ); 00088 Tvoid SetOutputBuffer( Tint bufsize ); 00089 00090 }; 00091 00092 inline const Tzstream& TDataDeflation::GetDeflationStream() const 00093 { 00094 return theDeflationStream; 00095 } 00096 00097 inline Tzstream& TDataDeflation::GetDeflationStream() 00098 { 00099 return theDeflationStream; 00100 } 00101 00102 inline Tint TDataDeflation::GetCompressionLevel() const 00103 { 00104 return theCompressionLevel; 00105 } 00106 00107 inline Tint TDataDeflation::GetStatus() const 00108 { 00109 return theStatus; 00110 } 00111 00112 inline Tint TDataDeflation::GetSizeOfOutputBuffer() const 00113 { 00114 return theSizeOfOutputBuffer; 00115 } 00116 00117 inline Tvoid* TDataDeflation::GetDeflatedData() const 00118 { 00119 return theDeflatedData; 00120 } 00121 00122 inline Tint TDataDeflation::GetSizeOfDeflatedData() const 00123 { 00124 return theSizeOfDeflatedData; 00125 } 00126 00127 #endif 00128 #endif