DCMTK Version 3.7.0 OFFIS DICOM Toolkit

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

This class implements a buffering mechanism that is used when writing large elements that reside in file into an output stream. More...

## Public Member Functions
| DcmWriteCache ()
| default constructor. Construction is cheap (no allocation of memory block).
| ~DcmWriteCache ()
| destructor
void | init (void *owner, Uint32 fieldLength, Uint32 bytesTransferred, E_ByteOrder byteOrder)
| initialize the buffer maintained by this class. More...
OFBool | bufferIsEmpty () const
| check whether the buffer is currently empty More...
Uint32 | contentLength () const
| return the number of bytes of user data currently in buffer More...
OFCondition | fillBuffer (DcmElement &elem)
| fill buffer from given DICOM element if buffer is currently empty. More...
Uint32 | writeBuffer (DcmOutputStream &outStream)
| write buffer content to output stream More...

## Private Member Functions
| DcmWriteCache (const DcmWriteCache &arg)
| private undefined copy constructor
DcmWriteCache & | operator= (const DcmWriteCache &arg)
| private undefined copy assignment operator

## Private Attributes
DcmFileCache | fcache_
| file cache object
Uint8 * | buf_
| write buffer
void * | owner_
| current "owner" (DcmElement instance using this buffer)
Uint32 | offset_
| offset within buffer to first byte
Uint32 | numBytes_
| number of user data bytes currently in buffer
Uint32 | capacity_
| buffer size in bytes
Uint32 | fieldLength_
| length of the current DICOM element, in bytes
Uint32 | fieldOffset_
| offset within the current DICOM element, in bytes
E_ByteOrder | byteOrder_
| current output byte order

## Detailed Description

This class implements a buffering mechanism that is used when writing large elements that reside in file into an output stream.

DcmElement::getPartialValue is used to fill the buffer maintained by this class, and the buffer content is then copied to the output stream. The intermediate buffer is necessary because both DcmElement::getPartialValue and DcmOutputStream::write expect a buffer to write to and read from, respectively.

## Member Function Documentation

## ◆ bufferIsEmpty()

OFBool DcmWriteCache::bufferIsEmpty | ( |  | ) | const
| inline

check whether the buffer is currently empty

Returns
  true if buffer is empty, false otherwise

## ◆ contentLength()

Uint32 DcmWriteCache::contentLength | ( |  | ) | const
| inline

return the number of bytes of user data currently in buffer

Returns
  number of bytes of user data currently in buffer

## ◆ fillBuffer()

OFCondition DcmWriteCache::fillBuffer | ( | DcmElement & | elem | ) |

fill buffer from given DICOM element if buffer is currently empty.

This method uses DcmElement::getPartialValue to fill the buffer from the given DICOM element at the given offset (which is updated to reflect the number of bytes read into the buffer).

Parameters

  elem | DICOM element to read from

Returns
  EC_Normal if successful, an error code otherwise

## ◆ init()

void DcmWriteCache::init | ( | void * | owner,
|  | Uint32 | fieldLength,
|  | Uint32 | bytesTransferred,
|  | E_ByteOrder | byteOrder
| ) |  |

initialize the buffer maintained by this class.

Can safely be called multiple times.

Parameters

  owner | current "owner" (DcmElement instance using this buffer)
  fieldLength | number of bytes of user data in DICOM element
  bytesTransferred | number of bytes of user data in DICOM element that have already been transferred
  byteOrder | byteOrder desired byte order in buffer

## ◆ writeBuffer()

Uint32 DcmWriteCache::writeBuffer | ( | DcmOutputStream & | outStream | ) |

write buffer content to output stream

Parameters

  outStream | output stream to write to

Returns
  number of bytes written

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

- dcmdata/include/dcmtk/dcmdata/dcwcache.h

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