OFFIS DCMTK  Version 3.6.0
dcostrmz.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 output 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 DCOSTRMZ_H
30 #define DCOSTRMZ_H
31 
32 #include "dcmtk/config/osconfig.h"
33 
34 #ifdef WITH_ZLIB
35 
36 #include "dcmtk/dcmdata/dcostrma.h" /* for DcmOutputFilter */
37 
38 BEGIN_EXTERN_C
39 #include <zlib.h>
40 END_EXTERN_C
41 
46 extern OFGlobal<int> dcmZlibCompressionLevel;
47 
51 {
52 public:
53 
56 
58  virtual ~DcmZLibOutputFilter();
59 
64  virtual OFBool good() const;
65 
70  virtual OFCondition status() const;
71 
77  virtual OFBool isFlushed() const;
78 
86  virtual offile_off_t avail() const;
87 
93  virtual offile_off_t write(const void *buf, offile_off_t buflen);
94 
100  virtual void flush();
101 
108  virtual void append(DcmConsumer& consumer);
109 
110 private:
111 
114 
117 
122  void flushOutputBuffer();
123 
134  offile_off_t compress(const void *buf, offile_off_t buflen, OFBool finalize);
135 
142  offile_off_t fillInputBuffer(const void *buf, offile_off_t buflen);
143 
151  void compressInputBuffer(OFBool finalize);
152 
155 
157  z_streamp zstream_;
158 
161 
163  OFBool flushed_;
164 
166  unsigned char *inputBuf_;
167 
169  offile_off_t inputBufStart_;
170 
172  offile_off_t inputBufCount_;
173 
175  unsigned char *outputBuf_;
176 
178  offile_off_t outputBufStart_;
179 
181  offile_off_t outputBufCount_;
182 
183 };
184 
185 #endif
186 #endif
187 
188 /*
189  * CVS/RCS Log:
190  * $Log: dcostrmz.h,v $
191  * Revision 1.5 2010-10-14 13:15:41 joergr
192  * Updated copyright header. Added reference to COPYRIGHT file.
193  *
194  * Revision 1.4 2008-06-23 12:09:13 joergr
195  * Fixed inconsistencies in Doxygen API documentation.
196  *
197  * Revision 1.3 2007/02/19 16:06:09 meichel
198  * Class DcmOutputStream and related classes are now safe for use with
199  * large files (2 GBytes or more) if supported by compiler and operating system.
200  *
201  * Revision 1.2 2005/12/08 16:28:27 meichel
202  * Changed include path schema for all DCMTK header files
203  *
204  * Revision 1.1 2002/08/27 16:55:37 meichel
205  * Initial release of new DICOM I/O stream classes that add support for stream
206  * compression (deflated little endian explicit VR transfer syntax)
207  *
208  *
209  */
210 
zlib compression filter for output streams
Definition: dcostrmz.h:50
virtual void append(DcmConsumer &consumer)
determines the consumer to which the filter is supposed to write it&#39;s output.
z_streamp zstream_
pointer to struct z_stream object containing the zlib status
Definition: dcostrmz.h:157
void compressInputBuffer(OFBool finalize)
feed data from the input ring buffer to the compression codec until complete or the output ring buffe...
DcmConsumer * current_
pointer to consumer to which compressed output is written
Definition: dcostrmz.h:154
offile_off_t inputBufCount_
number of bytes in input ring buffer
Definition: dcostrmz.h:172
DcmZLibOutputFilter & operator=(const DcmZLibOutputFilter &)
private unimplemented copy assignment operator
offile_off_t inputBufStart_
offset of first byte in input ring buffer
Definition: dcostrmz.h:169
virtual void flush()
instructs the consumer to flush its internal content until either the consumer becomes "flushed" or I...
virtual offile_off_t write(const void *buf, offile_off_t buflen)
processes as many bytes as possible from the given input block.
offile_off_t compress(const void *buf, offile_off_t buflen, OFBool finalize)
feed data from the given block of data to the compression codec until complete or the output ring buf...
OFBool flushed_
true if the zlib object has reported Z_STREAM_END
Definition: dcostrmz.h:163
offile_off_t outputBufStart_
offset of first byte in output ring buffer
Definition: dcostrmz.h:178
void flushOutputBuffer()
writes the content of the output ring buffer to the next filter stage until the output ring buffer be...
virtual OFBool isFlushed() const
returns true if the consumer is flushed, i.e.
DcmZLibOutputFilter()
default constructor
OFCondition status_
status
Definition: dcostrmz.h:160
offile_off_t fillInputBuffer(const void *buf, offile_off_t buflen)
copies as much of the given block of data as possible in the input ring buffer
offile_off_t outputBufCount_
number of bytes in output ring buffer
Definition: dcostrmz.h:181
virtual offile_off_t avail() const
returns the minimum number of bytes that can be written with the next call to write().
pure virtual abstract base class for output filters, i.e.
Definition: dcostrma.h:97
virtual ~DcmZLibOutputFilter()
destructor
unsigned char * inputBuf_
input ring buffer
Definition: dcostrmz.h:166
unsigned char * outputBuf_
output ring buffer
Definition: dcostrmz.h:175
virtual OFCondition status() const
returns the status of the consumer as an OFCondition object.
pure virtual abstract base class for consumers, i.e.
Definition: dcostrma.h:41
virtual OFBool good() const
returns the status of the consumer.
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 14 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.11