DCMTK: DcmBufferConsumer Class Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DcmBufferConsumer Class Reference

consumer class that stores data in a buffer provided by the caller. More...

Inheritance diagram for DcmBufferConsumer:

## Public Member Functions
| DcmBufferConsumer (void *buf, offile_off_t bufLen)
| constructor
virtual | ~DcmBufferConsumer ()
| destructor
virtual OFBool | good () const
| returns the status of the consumer.
virtual OFCondition | status () const
| returns the status of the consumer as an OFCondition object.
virtual OFBool | isFlushed () const
| returns true if the consumer is flushed, i.e.
virtual offile_off_t | avail () const
| returns the minimum number of bytes that can be written with the next call to write().
virtual offile_off_t | write (const void *buf, offile_off_t buflen)
| processes as many bytes as possible from the given input block.
virtual void | flush ()
| instructs the consumer to flush its internal content until either the consumer becomes "flushed" or I/O suspension occurs.
virtual void | flushBuffer (void *&buffer, offile_off_t &length)
| retrieves and flushes the underlying buffer.
virtual offile_off_t | filled ()
| query the number of bytes in buffer without flushing it.
Public Member Functions inherited from DcmConsumer
virtual | ~DcmConsumer ()
| destructor

## Private Member Functions
| DcmBufferConsumer (const DcmBufferConsumer &)
| private unimplemented copy constructor
DcmBufferConsumer & | operator= (const DcmBufferConsumer &)
| private unimplemented copy assignment operator

## Private Attributes
unsigned char * | buffer_
| the buffer we're actually writing to
offile_off_t | bufSize_
| size of the buffer, in bytes
offile_off_t | filled_
| number of bytes filled in buffer
OFCondition | status_
| status

## Detailed Description

consumer class that stores data in a buffer provided by the caller.

Used for DICOM network communication.

## Constructor & Destructor Documentation

## ◆ DcmBufferConsumer()

DcmBufferConsumer::DcmBufferConsumer | ( | void * | buf,
|  | offile_off_t | bufLen )

constructor

Parameters

  buf | buffer in which data is stored. Must be allocated by caller and remain valid during the lifetime of this object.
  bufLen | buffer length, must be even number (0 permitted).

Referenced by DcmBufferConsumer(), and operator=().

## Member Function Documentation

## ◆ avail()

virtual offile_off_t DcmBufferConsumer::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.

## ◆ filled()

virtual offile_off_t DcmBufferConsumer::filled | ( |  | ) |
| virtual

query the number of bytes in buffer without flushing it.

Returns
  number of bytes in buffer.

## ◆ flush()

virtual void DcmBufferConsumer::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.

## ◆ flushBuffer()

virtual void DcmBufferConsumer::flushBuffer | ( | void *& | buffer,
|  | offile_off_t & | length )
| virtual

retrieves and flushes the underlying buffer.

After return of this method, the buffer is considered to have been flushed (copied, stored) by the caller and is reused by the next write operation.

Parameters

  buffer | pointer to user provided buffer returned in this parameter
  length | number of bytes in buffer returned in this parameter

## ◆ good()

virtual OFBool DcmBufferConsumer::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 DcmBufferConsumer::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 DcmBufferConsumer::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 DcmBufferConsumer::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/dcostrmb.h

Generated on Wed Apr 30 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2