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 input streams 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:28:18 $ 00026 * Source File: $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcmtk/dcmdata/dcistrmz.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 DCISTRMZ_H 00035 #define DCISTRMZ_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 00039 #ifdef WITH_ZLIB 00040 00041 #include "dcmtk/dcmdata/dcistrma.h" /* for DcmInputFilter */ 00042 00043 BEGIN_EXTERN_C 00044 #include <zlib.h> 00045 END_EXTERN_C 00046 00052 extern OFGlobal<OFBool> dcmZlibExpectRFC1950Encoding; 00053 00056 class DcmZLibInputFilter: public DcmInputFilter 00057 { 00058 public: 00059 00061 DcmZLibInputFilter(); 00062 00064 virtual ~DcmZLibInputFilter(); 00065 00070 virtual OFBool good() const; 00071 00076 virtual OFCondition status() const; 00077 00081 virtual OFBool eos() const; 00082 00090 virtual Uint32 avail() const; 00091 00097 virtual Uint32 read(void *buf, Uint32 buflen); 00098 00103 virtual Uint32 skip(Uint32 skiplen); 00104 00109 virtual void putback(Uint32 num); 00110 00117 virtual void append(DcmProducer& producer); 00118 00119 private: 00120 00122 DcmZLibInputFilter(const DcmZLibInputFilter&); 00123 00125 DcmZLibInputFilter& operator=(const DcmZLibInputFilter&); 00126 00132 Uint32 fillInputBuffer(); 00133 00141 Uint32 decompress(const void *buf, Uint32 buflen); 00142 00146 void fillOutputBuffer(); 00147 00152 void flushOutputBuffer(); 00153 00160 Uint32 fillInputBuffer(const void *buf, Uint32 buflen); 00161 00169 void compressInputBuffer(OFBool finalize); 00170 00171 00173 DcmProducer *current_; 00174 00176 z_streamp zstream_; 00177 00179 OFCondition status_; 00180 00182 OFBool eos_; 00183 00185 unsigned char *inputBuf_; 00186 00188 Uint32 inputBufStart_; 00189 00191 Uint32 inputBufCount_; 00192 00194 unsigned char *outputBuf_; 00195 00197 Uint32 outputBufStart_; 00198 00200 Uint32 outputBufCount_; 00201 00203 Uint32 outputBufPutback_; 00204 00206 OFBool padded_; 00207 }; 00208 00209 #endif 00210 #endif 00211 00212 /* 00213 * CVS/RCS Log: 00214 * $Log: dcistrmz.h,v $ 00215 * Revision 1.2 2005/12/08 16:28:18 meichel 00216 * Changed include path schema for all DCMTK header files 00217 * 00218 * Revision 1.1 2002/08/27 16:55:34 meichel 00219 * Initial release of new DICOM I/O stream classes that add support for stream 00220 * compression (deflated little endian explicit VR transfer syntax) 00221 * 00222 * 00223 */ 00224