DCMTK  Version 3.6.5
OFFIS DICOM Toolkit
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DcmZLibInputFilter Class Reference

zlib compression filter for input streams More...

+ Inheritance diagram for DcmZLibInputFilter:

Public Member Functions

 DcmZLibInputFilter ()
 default constructor
 
virtual ~DcmZLibInputFilter ()
 destructor
 
virtual OFBool good () const
 returns the status of the producer. More...
 
virtual OFCondition status () const
 returns the status of the producer as an OFCondition object. More...
 
virtual OFBool eos ()
 returns true if the producer is at the end of stream. More...
 
virtual offile_off_t avail ()
 returns the minimum number of bytes that can be read with the next call to read(). More...
 
virtual offile_off_t read (void *buf, offile_off_t buflen)
 reads as many bytes as possible into the given block. More...
 
virtual offile_off_t skip (offile_off_t skiplen)
 skips over the given number of bytes (or less) More...
 
virtual void putback (offile_off_t num)
 resets the stream to the position by the given number of bytes. More...
 
virtual void append (DcmProducer &producer)
 determines the producer from which the filter is supposed to read it's input. More...
 
- Public Member Functions inherited from DcmInputFilter
virtual ~DcmInputFilter ()
 destructor
 
- Public Member Functions inherited from DcmProducer
virtual ~DcmProducer ()
 destructor
 

Private Member Functions

 DcmZLibInputFilter (const DcmZLibInputFilter &)
 private unimplemented copy constructor
 
DcmZLibInputFilteroperator= (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 More...
 
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. More...
 
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 More...
 
void compressInputBuffer (OFBool finalize)
 feed data from the input ring buffer to the compression codec until complete or the output ring buffer becomes full. More...
 

Private Attributes

DcmProducercurrent_
 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
 

Detailed Description

zlib compression filter for input streams

Remarks
this class is only available if DCMTK is compiled with ZLIB support enabled.

Member Function Documentation

◆ append()

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.

Parameters
producerreference to producer, must not be circular chain

Implements DcmInputFilter.

◆ avail()

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.

Returns
minimum of data available in producer

Implements DcmProducer.

◆ compressInputBuffer()

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.

Parameters
finalizetrue 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.

◆ decompress()

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.

Parameters
bufpointer to input data
buflennumber of bytes in buf
Returns
number of bytes processed

◆ eos()

virtual OFBool DcmZLibInputFilter::eos ( )
virtual

returns true if the producer is at the end of stream.

Returns
true if end of stream, false otherwise

Implements DcmProducer.

◆ fillInputBuffer() [1/2]

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

Returns
number of bytes added to input buffer

◆ fillInputBuffer() [2/2]

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

Parameters
bufpointer to input data
buflennumber of bytes in buf
Returns
number of bytes copied to input ring buffer

◆ good()

virtual OFBool DcmZLibInputFilter::good ( ) const
virtual

returns the status of the producer.

Unless the status is good, the producer will not permit any operation.

Returns
status, true if good

Implements DcmProducer.

◆ putback()

virtual void DcmZLibInputFilter::putback ( offile_off_t  num)
virtual

resets the stream to the position by the given number of bytes.

Parameters
numnumber of bytes to putback. If the putback operation fails, the producer status becomes bad.

Implements DcmProducer.

◆ read()

virtual offile_off_t DcmZLibInputFilter::read ( void *  buf,
offile_off_t  buflen 
)
virtual

reads as many bytes as possible into the given block.

Parameters
bufpointer to memory block, must not be NULL
buflenlength of memory block
Returns
number of bytes actually read.

Implements DcmProducer.

◆ skip()

virtual offile_off_t DcmZLibInputFilter::skip ( offile_off_t  skiplen)
virtual

skips over the given number of bytes (or less)

Parameters
skiplennumber of bytes to skip
Returns
number of bytes actually skipped.

Implements DcmProducer.

◆ status()

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.

Returns
status, EC_Normal if good

Implements DcmProducer.


The documentation for this class was generated from the following file:


Generated on Mon Oct 28 2019 for DCMTK Version 3.6.5 by Doxygen 1.8.15