dcmdata/include/dcmtk/dcmdata/dcistrmz.h

00001 /*
00002  *
00003  *  Copyright (C) 1994-2010, OFFIS e.V.
00004  *  All rights reserved.  See COPYRIGHT file for details.
00005  *
00006  *  This software and supporting documentation were developed by
00007  *
00008  *    OFFIS e.V.
00009  *    R&D Division Health
00010  *    Escherweg 2
00011  *    D-26121 Oldenburg, Germany
00012  *
00013  *
00014  *  Module:  dcmdata
00015  *
00016  *  Author:  Marco Eichelberg
00017  *
00018  *  Purpose: zlib compression filter for input streams
00019  *
00020  *  Last Update:      $Author: joergr $
00021  *  Update Date:      $Date: 2010-10-14 13:15:41 $
00022  *  CVS/RCS Revision: $Revision: 1.5 $
00023  *  Status:           $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 #ifndef DCISTRMZ_H
00030 #define DCISTRMZ_H
00031 
00032 #include "dcmtk/config/osconfig.h"
00033 
00034 #ifdef WITH_ZLIB
00035 
00036 #include "dcmtk/dcmdata/dcistrma.h" /* for DcmInputFilter */
00037 
00038 BEGIN_EXTERN_C
00039 #include <zlib.h>
00040 END_EXTERN_C
00041 
00047 extern OFGlobal<OFBool> dcmZlibExpectRFC1950Encoding;
00048 
00051 class DcmZLibInputFilter: public DcmInputFilter
00052 {
00053 public:
00054 
00056   DcmZLibInputFilter();
00057 
00059   virtual ~DcmZLibInputFilter();
00060 
00065   virtual OFBool good() const;
00066 
00071   virtual OFCondition status() const;
00072 
00076   virtual OFBool eos();
00077 
00085   virtual offile_off_t avail();
00086 
00092   virtual offile_off_t read(void *buf, offile_off_t buflen);
00093 
00098   virtual offile_off_t skip(offile_off_t skiplen);
00099 
00104   virtual void putback(offile_off_t num);
00105 
00112   virtual void append(DcmProducer& producer);
00113 
00114 private:
00115 
00117   DcmZLibInputFilter(const DcmZLibInputFilter&);
00118 
00120   DcmZLibInputFilter& operator=(const DcmZLibInputFilter&);
00121 
00127   offile_off_t fillInputBuffer();
00128 
00136   offile_off_t decompress(const void *buf, offile_off_t buflen);
00137 
00141   void fillOutputBuffer();
00142   
00147   void flushOutputBuffer();
00148 
00155   offile_off_t fillInputBuffer(const void *buf, offile_off_t buflen);
00156 
00164   void compressInputBuffer(OFBool finalize);
00165 
00166 
00168   DcmProducer *current_;
00169 
00171   z_streamp zstream_;
00172 
00174   OFCondition status_;
00175 
00177   OFBool eos_;
00178 
00180   unsigned char *inputBuf_;
00181 
00183   offile_off_t inputBufStart_;
00184 
00186   offile_off_t inputBufCount_;
00187 
00189   unsigned char *outputBuf_;
00190 
00192   offile_off_t outputBufStart_;
00193 
00195   offile_off_t outputBufCount_;
00196 
00198   offile_off_t outputBufPutback_;
00199 
00201   OFBool padded_;
00202 };
00203 
00204 #endif
00205 #endif
00206 
00207 /*
00208  * CVS/RCS Log:
00209  * $Log: dcistrmz.h,v $
00210  * Revision 1.5  2010-10-14 13:15:41  joergr
00211  * Updated copyright header. Added reference to COPYRIGHT file.
00212  *
00213  * Revision 1.4  2008-06-23 12:09:13  joergr
00214  * Fixed inconsistencies in Doxygen API documentation.
00215  *
00216  * Revision 1.3  2007/02/19 15:45:41  meichel
00217  * Class DcmInputStream and related classes are now safe for use with
00218  *   large files (2 GBytes or more) if supported by compiler and operating system.
00219  *
00220  * Revision 1.2  2005/12/08 16:28:18  meichel
00221  * Changed include path schema for all DCMTK header files
00222  *
00223  * Revision 1.1  2002/08/27 16:55:34  meichel
00224  * Initial release of new DICOM I/O stream classes that add support for stream
00225  *   compression (deflated little endian explicit VR transfer syntax)
00226  *
00227  *
00228  */
00229 


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1