00001 /* 00002 * 00003 * Copyright (C) 1994-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmdata 00019 * 00020 * Author: Marco Eichelberg 00021 * 00022 * Purpose: zlib compression filter for output streams 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:28:27 $ 00026 * Source File: $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcmtk/dcmdata/dcostrmz.h,v $ 00027 * CVS/RCS Revision: $Revision: 1.2 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 #ifndef DCOSTRMZ_H 00035 #define DCOSTRMZ_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 00039 #ifdef WITH_ZLIB 00040 00041 #include "dcmtk/dcmdata/dcostrma.h" /* for DcmOutputFilter */ 00042 00043 BEGIN_EXTERN_C 00044 #include <zlib.h> 00045 END_EXTERN_C 00046 00051 extern OFGlobal<int> dcmZlibCompressionLevel; 00052 00055 class DcmZLibOutputFilter: public DcmOutputFilter 00056 { 00057 public: 00058 00060 DcmZLibOutputFilter(); 00061 00063 virtual ~DcmZLibOutputFilter(); 00064 00069 virtual OFBool good() const; 00070 00075 virtual OFCondition status() const; 00076 00082 virtual OFBool isFlushed() const; 00083 00091 virtual Uint32 avail() const; 00092 00098 virtual Uint32 write(const void *buf, Uint32 buflen); 00099 00105 virtual void flush(); 00106 00113 virtual void append(DcmConsumer& consumer); 00114 00115 private: 00116 00118 DcmZLibOutputFilter(const DcmZLibOutputFilter&); 00119 00121 DcmZLibOutputFilter& operator=(const DcmZLibOutputFilter&); 00122 00127 void flushOutputBuffer(); 00128 00139 Uint32 compress(const void *buf, Uint32 buflen, OFBool finalize); 00140 00147 Uint32 fillInputBuffer(const void *buf, Uint32 buflen); 00148 00156 void compressInputBuffer(OFBool finalize); 00157 00159 DcmConsumer *current_; 00160 00162 z_streamp zstream_; 00163 00165 OFCondition status_; 00166 00168 OFBool flushed_; 00169 00171 unsigned char *inputBuf_; 00172 00174 Uint32 inputBufStart_; 00175 00177 Uint32 inputBufCount_; 00178 00180 unsigned char *outputBuf_; 00181 00183 Uint32 outputBufStart_; 00184 00186 Uint32 outputBufCount_; 00187 00188 }; 00189 00190 #endif 00191 #endif 00192 00193 /* 00194 * CVS/RCS Log: 00195 * $Log: dcostrmz.h,v $ 00196 * Revision 1.2 2005/12/08 16:28:27 meichel 00197 * Changed include path schema for all DCMTK header files 00198 * 00199 * Revision 1.1 2002/08/27 16:55:37 meichel 00200 * Initial release of new DICOM I/O stream classes that add support for stream 00201 * compression (deflated little endian explicit VR transfer syntax) 00202 * 00203 * 00204 */ 00205