DCMTK
Version 3.6.1 20120515
OFFIS DICOM Toolkit
|
zlib compression filter for input streams More...
Public Member Functions | |
DcmZLibInputFilter () | |
default constructor | |
virtual | ~DcmZLibInputFilter () |
destructor | |
virtual OFBool | good () const |
returns the status of the producer. | |
virtual OFCondition | status () const |
returns the status of the producer as an OFCondition object. | |
virtual OFBool | eos () |
returns true if the producer is at the end of stream. | |
virtual offile_off_t | avail () |
returns the minimum number of bytes that can be read with the next call to read(). | |
virtual offile_off_t | read (void *buf, offile_off_t buflen) |
reads as many bytes as possible into the given block. | |
virtual offile_off_t | skip (offile_off_t skiplen) |
skips over the given number of bytes (or less) | |
virtual void | putback (offile_off_t num) |
resets the stream to the position by the given number of bytes. | |
virtual void | append (DcmProducer &producer) |
determines the producer from which the filter is supposed to read it's input. | |
Private Member Functions | |
DcmZLibInputFilter (const DcmZLibInputFilter &) | |
private unimplemented copy constructor | |
DcmZLibInputFilter & | operator= (const DcmZLibInputFilter &) |
private unimplemented copy assignment operator | |
offile_off_t | fillInputBuffer () |
reads data from the producer into the input ring buffer until the input ring buffer becomes full or the producer suspends | |
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 ring buffer. | |
void | fillOutputBuffer () |
reads and decompresses data from the producer until the producer suspends or the output ring buffer becomes full. | |
void | flushOutputBuffer () |
writes the content of the output ring buffer to the next filter stage until the output ring buffer becomes empty or the next filter stage becomes full | |
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 | |
void | compressInputBuffer (OFBool finalize) |
feed data from the input ring buffer to the compression codec until complete or the output ring buffer becomes full. | |
Private Attributes | |
DcmProducer * | current_ |
pointer to producer from which compressed input is read | |
z_streamp | zstream_ |
pointer to struct z_stream object containing the zlib status | |
OFCondition | status_ |
status | |
OFBool | eos_ |
true if the zlib object has reported Z_STREAM_END | |
unsigned char * | inputBuf_ |
input ring buffer | |
offile_off_t | inputBufStart_ |
offset of first byte in input ring buffer | |
offile_off_t | inputBufCount_ |
number of bytes in input ring buffer | |
unsigned char * | outputBuf_ |
output ring buffer | |
offile_off_t | outputBufStart_ |
offset of first byte in output ring buffer | |
offile_off_t | outputBufCount_ |
number of bytes available for read in output ring buffer | |
offile_off_t | outputBufPutback_ |
number of putback bytes in output ring buffer | |
OFBool | padded_ |
flag indicating whether or not a pad byte has been appended to the input stream |
zlib compression filter for input streams
virtual void DcmZLibInputFilter::append | ( | DcmProducer & | producer | ) | [virtual] |
determines the producer from which the filter is supposed to read it's input.
Once a producer for the input filter has been defined, it cannot be changed anymore during the lifetime of the object.
producer | reference to producer, must not be circular chain |
Implements DcmInputFilter.
virtual offile_off_t DcmZLibInputFilter::avail | ( | ) | [virtual] |
returns the minimum number of bytes that can be read with the next call to read().
The DcmObject read methods rely on avail to return a value > 0 if there is no I/O suspension since certain data such as tag and length are only read "en bloc", i.e. all or nothing.
Implements DcmProducer.
void DcmZLibInputFilter::compressInputBuffer | ( | OFBool | finalize | ) | [private] |
feed data from the input ring buffer to the compression codec until complete or the output ring buffer becomes full.
Does not flush the output ring buffer.
finalize | true if the content of the input ring buffer constitutes the end of the input stream, i.e. the compression codec should be forced to flush its internal state. |
offile_off_t DcmZLibInputFilter::decompress | ( | const void * | buf, |
offile_off_t | buflen | ||
) | [private] |
decompress data into the given output block until complete or no more input is available in the input ring buffer.
does not re-fill the input ring buffer from the producer.
buf | pointer to input data |
buflen | number of bytes in buf |
virtual OFBool DcmZLibInputFilter::eos | ( | ) | [virtual] |
returns true if the producer is at the end of stream.
Implements DcmProducer.
offile_off_t DcmZLibInputFilter::fillInputBuffer | ( | ) | [private] |
reads data from the producer into the input ring buffer until the input ring buffer becomes full or the producer suspends
offile_off_t DcmZLibInputFilter::fillInputBuffer | ( | const void * | buf, |
offile_off_t | buflen | ||
) | [private] |
copies as much of the given block of data as possible in the input ring buffer
buf | pointer to input data |
buflen | number of bytes in buf |
virtual OFBool DcmZLibInputFilter::good | ( | ) | const [virtual] |
returns the status of the producer.
Unless the status is good, the producer will not permit any operation.
Implements DcmProducer.
virtual void DcmZLibInputFilter::putback | ( | offile_off_t | num | ) | [virtual] |
resets the stream to the position by the given number of bytes.
num | number of bytes to putback. If the putback operation fails, the producer status becomes bad. |
Implements DcmProducer.
virtual offile_off_t DcmZLibInputFilter::read | ( | void * | buf, |
offile_off_t | buflen | ||
) | [virtual] |
reads as many bytes as possible into the given block.
buf | pointer to memory block, must not be NULL |
buflen | length of memory block |
Implements DcmProducer.
virtual offile_off_t DcmZLibInputFilter::skip | ( | offile_off_t | skiplen | ) | [virtual] |
skips over the given number of bytes (or less)
skiplen | number of bytes to skip |
Implements DcmProducer.
virtual OFCondition DcmZLibInputFilter::status | ( | ) | const [virtual] |
returns the status of the producer as an OFCondition object.
Unless the status is good, the producer will not permit any operation.
Implements DcmProducer.