00001 // ===================================================================== 00031 // ===================================================================== 00032 #ifdef __CLDAQ_ZLIB_USE 00033 #ifndef CLDAQ__TDATADEFLATION_HH 00034 #define CLDAQ__TDATADEFLATION_HH 00035 00036 #include "Tglobals.h" 00037 00038 // Z_NO_COMPRESSION 0 00039 // Z_BEST_SPEED 1 00040 // Z_BEST_COMPRESSION 9 00041 // Z_DEFAULT_COMPRESSION (-1) 00042 00043 00063 class TDataDeflation 00064 { 00065 00066 private: 00067 enum { tDefaultBufferSize = 1024 * 1024 }; 00068 00069 private: 00070 Tzstream theDeflationStream; 00071 Tint theCompressionLevel; 00072 Tint theStatus; 00073 Tbyte* theOutputBuffer; 00074 Tint theSizeOfOutputBuffer; 00075 Tvoid* theDeflatedData; 00076 Tint theSizeOfDeflatedData; 00077 00078 public: 00079 TDataDeflation( Tint bufsize = tDefaultBufferSize, Tint level = Z_DEFAULT_COMPRESSION ); 00080 TDataDeflation( const TDataDeflation& right ); 00081 ~TDataDeflation(); 00082 00083 public: 00084 const TDataDeflation& operator=( const TDataDeflation& right ); 00085 00086 public: 00087 Tvoid Compress( Tvoid* input, Tint nbyte, Tbool islast = Tfalse ); 00088 00089 public: 00090 const Tzstream& GetDeflationStream() const; 00091 Tzstream& GetDeflationStream(); 00092 Tint GetCompressionLevel() const; 00093 Tint GetStatus() const; 00094 Tint GetSizeOfOutputBuffer() const; 00095 Tvoid* GetDeflatedData() const; 00096 Tint GetSizeOfDeflatedData() const; 00097 Tvoid SetCompressionLevel( Tint level ); 00098 Tvoid SetOutputBuffer( Tint bufsize ); 00099 00100 #ifdef __CLDAQ_ROOT_DLL 00101 ClassDef(TDataDeflation,0) 00102 #endif 00103 00104 }; 00105 00106 inline const Tzstream& TDataDeflation::GetDeflationStream() const 00107 { 00108 return theDeflationStream; 00109 } 00110 00111 inline Tzstream& TDataDeflation::GetDeflationStream() 00112 { 00113 return theDeflationStream; 00114 } 00115 00116 inline Tint TDataDeflation::GetCompressionLevel() const 00117 { 00118 return theCompressionLevel; 00119 } 00120 00121 inline Tint TDataDeflation::GetStatus() const 00122 { 00123 return theStatus; 00124 } 00125 00126 inline Tint TDataDeflation::GetSizeOfOutputBuffer() const 00127 { 00128 return theSizeOfOutputBuffer; 00129 } 00130 00131 inline Tvoid* TDataDeflation::GetDeflatedData() const 00132 { 00133 return theDeflatedData; 00134 } 00135 00136 inline Tint TDataDeflation::GetSizeOfDeflatedData() const 00137 { 00138 return theSizeOfDeflatedData; 00139 } 00140 00141 #endif 00142 #endif