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