DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Private Member Functions | Private Attributes | List of all members
DcmZLibOutputFilter Class Reference

zlib compression filter for output streams. More...

Inheritance diagram for DcmZLibOutputFilter:

## Public Member Functions
| DcmZLibOutputFilter ()
| default constructor
virtual | ~DcmZLibOutputFilter ()
| destructor
virtual OFBool | good () const
| returns the status of the consumer. More...
virtual OFCondition | status () const
| returns the status of the consumer as an OFCondition object. More...
virtual OFBool | isFlushed () const
| returns true if the consumer is flushed, i.e. More...
virtual offile_off_t | avail () const
| returns the minimum number of bytes that can be written with the next call to write(). More...
virtual offile_off_t | write (const void *buf, offile_off_t buflen)
| processes as many bytes as possible from the given input block. More...
virtual void | flush ()
| instructs the consumer to flush its internal content until either the consumer becomes "flushed" or I/O suspension occurs. More...
virtual void | append (DcmConsumer &consumer)
| determines the consumer to which the filter is supposed to write it's output. More...
Public Member Functions inherited from DcmOutputFilter
virtual | ~DcmOutputFilter ()
| destructor
Public Member Functions inherited from DcmConsumer
virtual | ~DcmConsumer ()
| destructor

## Private Member Functions
| DcmZLibOutputFilter (const DcmZLibOutputFilter &)
| private unimplemented copy constructor
DcmZLibOutputFilter & | operator= (const DcmZLibOutputFilter &)
| private unimplemented copy assignment operator
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 | 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 buffer becomes full. More...
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
DcmConsumer * | current_
| pointer to consumer to which compressed output is written
z_streamp | zstream_
| pointer to struct z_stream object containing the zlib status
OFCondition | status_
| status
OFBool | flushed_
| 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 in output ring buffer

## Detailed Description

zlib compression filter for output streams.

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

## Member Function Documentation

## ◆ append()

virtual void DcmZLibOutputFilter::append | ( | DcmConsumer & | consumer | ) |
| virtual

determines the consumer to which the filter is supposed to write it's output.

Once a consumer for the output filter has been defined, it cannot be changed anymore during the lifetime of the object.

Parameters

  consumer | reference to consumer, must not be circular chain

Implements DcmOutputFilter.

## ◆ avail()

virtual offile_off_t DcmZLibOutputFilter::avail | ( |  | ) | const
| virtual

returns the minimum number of bytes that can be written with the next call to write().

The DcmObject write 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 written "en bloc", i.e. all or nothing.

Returns
  minimum of space available in consumer

Implements DcmConsumer.

## ◆ compress()

offile_off_t DcmZLibOutputFilter::compress | ( | const void * | buf,
|  | offile_off_t | buflen,
|  | OFBool | finalize
| ) |  |
| private

feed data from the given block of data to the compression codec until complete or the output ring buffer becomes full.

Does not flush the output ring buffer.

Parameters

  buf | pointer to input data
  buflen | number of bytes in buf
  finalize | true if the current block of data constitutes the end of the input stream, i.e. the compression codec should be forced to flush its internal state.

Returns
  number of bytes processed

## ◆ compressInputBuffer()

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

## ◆ fillInputBuffer()

offile_off_t DcmZLibOutputFilter::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

  buf | pointer to input data
  buflen | number of bytes in buf

Returns
  number of bytes copied to input ring buffer

## ◆ flush()

virtual void DcmZLibOutputFilter::flush | ( |  | ) |
| virtual

instructs the consumer to flush its internal content until either the consumer becomes "flushed" or I/O suspension occurs.

After a call to flush(), a call to write() will produce undefined behaviour.

Implements DcmConsumer.

## ◆ good()

virtual OFBool DcmZLibOutputFilter::good | ( |  | ) | const
| virtual

returns the status of the consumer.

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

Returns
  status, true if good

Implements DcmConsumer.

## ◆ isFlushed()

virtual OFBool DcmZLibOutputFilter::isFlushed | ( |  | ) | const
| virtual

returns true if the consumer is flushed, i.e.

has no more data pending in it's internal state that needs to be flushed before the stream is closed.

Returns
  true if consumer is flushed, false otherwise

Implements DcmConsumer.

## ◆ status()

virtual OFCondition DcmZLibOutputFilter::status | ( |  | ) | const
| virtual

returns the status of the consumer as an OFCondition object.

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

Returns
  status, EC_Normal if good

Implements DcmConsumer.

## ◆ write()

virtual offile_off_t DcmZLibOutputFilter::write | ( | const void * | buf,
|  | offile_off_t | buflen
| ) |  |
| virtual

processes as many bytes as possible from the given input block.

Parameters

  buf | pointer to memory block, must not be NULL
  buflen | length of memory block

Returns
  number of bytes actually processed.

Implements DcmConsumer.

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

- dcmdata/include/dcmtk/dcmdata/dcostrmz.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1