OFFIS DCMTK  Version 3.6.0
dcistrmz.h
1 /*
2  *
3  * Copyright (C) 1994-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Marco Eichelberg
17  *
18  * Purpose: zlib compression filter for input streams
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:15:41 $
22  * CVS/RCS Revision: $Revision: 1.5 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DCISTRMZ_H
30 #define DCISTRMZ_H
31 
32 #include "dcmtk/config/osconfig.h"
33 
34 #ifdef WITH_ZLIB
35 
36 #include "dcmtk/dcmdata/dcistrma.h" /* for DcmInputFilter */
37 
38 BEGIN_EXTERN_C
39 #include <zlib.h>
40 END_EXTERN_C
41 
47 extern OFGlobal<OFBool> dcmZlibExpectRFC1950Encoding;
48 
52 {
53 public:
54 
57 
59  virtual ~DcmZLibInputFilter();
60 
65  virtual OFBool good() const;
66 
71  virtual OFCondition status() const;
72 
76  virtual OFBool eos();
77 
85  virtual offile_off_t avail();
86 
92  virtual offile_off_t read(void *buf, offile_off_t buflen);
93 
98  virtual offile_off_t skip(offile_off_t skiplen);
99 
104  virtual void putback(offile_off_t num);
105 
112  virtual void append(DcmProducer& producer);
113 
114 private:
115 
118 
121 
127  offile_off_t fillInputBuffer();
128 
136  offile_off_t decompress(const void *buf, offile_off_t buflen);
137 
141  void fillOutputBuffer();
142 
147  void flushOutputBuffer();
148 
155  offile_off_t fillInputBuffer(const void *buf, offile_off_t buflen);
156 
164  void compressInputBuffer(OFBool finalize);
165 
166 
169 
171  z_streamp zstream_;
172 
175 
177  OFBool eos_;
178 
180  unsigned char *inputBuf_;
181 
183  offile_off_t inputBufStart_;
184 
186  offile_off_t inputBufCount_;
187 
189  unsigned char *outputBuf_;
190 
192  offile_off_t outputBufStart_;
193 
195  offile_off_t outputBufCount_;
196 
198  offile_off_t outputBufPutback_;
199 
201  OFBool padded_;
202 };
203 
204 #endif
205 #endif
206 
207 /*
208  * CVS/RCS Log:
209  * $Log: dcistrmz.h,v $
210  * Revision 1.5 2010-10-14 13:15:41 joergr
211  * Updated copyright header. Added reference to COPYRIGHT file.
212  *
213  * Revision 1.4 2008-06-23 12:09:13 joergr
214  * Fixed inconsistencies in Doxygen API documentation.
215  *
216  * Revision 1.3 2007/02/19 15:45:41 meichel
217  * Class DcmInputStream and related classes are now safe for use with
218  * large files (2 GBytes or more) if supported by compiler and operating system.
219  *
220  * Revision 1.2 2005/12/08 16:28:18 meichel
221  * Changed include path schema for all DCMTK header files
222  *
223  * Revision 1.1 2002/08/27 16:55:34 meichel
224  * Initial release of new DICOM I/O stream classes that add support for stream
225  * compression (deflated little endian explicit VR transfer syntax)
226  *
227  *
228  */
229 
z_streamp zstream_
pointer to struct z_stream object containing the zlib status
Definition: dcistrmz.h:171
offile_off_t inputBufCount_
number of bytes in input ring buffer
Definition: dcistrmz.h:186
OFBool eos_
true if the zlib object has reported Z_STREAM_END
Definition: dcistrmz.h:177
virtual ~DcmZLibInputFilter()
destructor
OFCondition status_
status
Definition: dcistrmz.h:174
DcmProducer * current_
pointer to producer from which compressed input is read
Definition: dcistrmz.h:168
virtual offile_off_t avail()
returns the minimum number of bytes that can be read with the next call to read().
zlib compression filter for input streams
Definition: dcistrmz.h:51
offile_off_t outputBufCount_
number of bytes available for read in output ring buffer
Definition: dcistrmz.h:195
offile_off_t decompress(const void *buf, offile_off_t buflen)
decompress data into the given output block until complete or no more input is available in the input...
virtual offile_off_t skip(offile_off_t skiplen)
skips over the given number of bytes (or less)
DcmZLibInputFilter()
default constructor
virtual void putback(offile_off_t num)
resets the stream to the position by the given number of bytes.
void fillOutputBuffer()
reads and decompresses data from the producer until the producer suspends or the output ring buffer b...
offile_off_t fillInputBuffer()
reads data from the producer into the input ring buffer until the input ring buffer becomes full or t...
offile_off_t outputBufPutback_
number of putback bytes in output ring buffer
Definition: dcistrmz.h:198
virtual OFBool good() const
returns the status of the producer.
virtual offile_off_t read(void *buf, offile_off_t buflen)
reads as many bytes as possible into the given block.
offile_off_t outputBufStart_
offset of first byte in output ring buffer
Definition: dcistrmz.h:192
offile_off_t inputBufStart_
offset of first byte in input ring buffer
Definition: dcistrmz.h:183
unsigned char * inputBuf_
input ring buffer
Definition: dcistrmz.h:180
virtual OFCondition status() const
returns the status of the producer as an OFCondition object.
pure virtual abstract base class for input filters, i.e.
Definition: dcistrma.h:103
void compressInputBuffer(OFBool finalize)
feed data from the input ring buffer to the compression codec until complete or the output ring buffe...
virtual OFBool eos()
returns true if the producer is at the end of stream.
DcmZLibInputFilter & operator=(const DcmZLibInputFilter &)
private unimplemented copy assignment operator
OFBool padded_
flag indicating whether or not a pad byte has been appended to the input stream
Definition: dcistrmz.h:201
void flushOutputBuffer()
writes the content of the output ring buffer to the next filter stage until the output ring buffer be...
pure virtual abstract base class for producers, i.e.
Definition: dcistrma.h:43
unsigned char * outputBuf_
output ring buffer
Definition: dcistrmz.h:189
virtual void append(DcmProducer &producer)
determines the producer from which the filter is supposed to read it's input.
Template class which allows to declare global objects that are protected by a Mutex if used in multi-...
Definition: ofglobal.h:45
General purpose class for condition codes.
Definition: ofcond.h:305


Generated on Wed Dec 28 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.8