DcmZLibInputFilter Class Reference

zlib compression filter for input streams More...

Inheritance diagram for DcmZLibInputFilter:

DcmInputFilter DcmProducer List of all members.

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 () const
 returns true if the producer is at the end of stream.
virtual Uint32 avail () const
 returns the minimum number of bytes that can be read with the next call to read().
virtual Uint32 read (void *buf, Uint32 buflen)
 reads as many bytes as possible into the given block.
virtual Uint32 skip (Uint32 skiplen)
 skips over the given number of bytes (or less)
virtual void putback (Uint32 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
DcmZLibInputFilteroperator= (const DcmZLibInputFilter &)
 private unimplemented copy assignment operator
Uint32 fillInputBuffer ()
 reads data from the producer into the input ring buffer until the input ring buffer becomes full or the producer suspends
Uint32 decompress (const void *buf, Uint32 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
Uint32 fillInputBuffer (const void *buf, Uint32 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

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
Uint32 inputBufStart_
 offset of first byte in input ring buffer
Uint32 inputBufCount_
 number of bytes in input ring buffer
unsigned char * outputBuf_
 output ring buffer
Uint32 outputBufStart_
 offset of first byte in output ring buffer
Uint32 outputBufCount_
 number of bytes available for read in output ring buffer
Uint32 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

Definition at line 56 of file dcistrmz.h.


Member Function Documentation

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:
producer reference to producer, must not be circular chain

Implements DcmInputFilter.

virtual Uint32 DcmZLibInputFilter::avail  )  const [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.

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:
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.

Uint32 DcmZLibInputFilter::decompress const void *  buf,
Uint32  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:
buf pointer to input data
number of bytes in buf
Returns:
number of bytes processed

virtual OFBool DcmZLibInputFilter::eos  )  const [virtual]
 

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

Returns:
true if end of stream, false otherwise

Implements DcmProducer.

Uint32 DcmZLibInputFilter::fillInputBuffer const void *  buf,
Uint32  buflen
[private]
 

copies as much of the given block of data as possible in the input ring buffer

Parameters:
buf pointer to input data
number of bytes in buf
Returns:
number of bytes copied to input ring buffer

Uint32 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

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.

virtual void DcmZLibInputFilter::putback Uint32  num  )  [virtual]
 

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

Parameters:
num number of bytes to putback. If the putback operation fails, the producer status becomes bad.

Implements DcmProducer.

virtual Uint32 DcmZLibInputFilter::read void *  buf,
Uint32  buflen
[virtual]
 

reads as many bytes as possible into the given block.

Parameters:
buf pointer to memory block, must not be NULL
buflen length of memory block
Returns:
number of bytes actually read.

Implements DcmProducer.

virtual Uint32 DcmZLibInputFilter::skip Uint32  skiplen  )  [virtual]
 

skips over the given number of bytes (or less)

Parameters:
skiplen number of bytes to skip
Returns:
number of bytes actually skipped.

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.

Returns:
status, EC_Normal if good

Implements DcmProducer.


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


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5