DCMTK  Version 3.6.1 20120515
OFFIS DICOM Toolkit
Public Member Functions | Private Member Functions | Private Attributes
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...

List of all members.

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.
OFBool bufferIsEmpty () const
 check whether the buffer is currently empty
Uint32 contentLength () const
 return the number of bytes of user data currently in buffer
OFCondition fillBuffer (DcmElement &elem)
 fill buffer from given DICOM element if buffer is currently empty.
Uint32 writeBuffer (DcmOutputStream &outStream)
 write buffer content to output stream

Private Member Functions

 DcmWriteCache (const DcmWriteCache &arg)
 private undefined copy constructor
DcmWriteCacheoperator= (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

OFBool DcmWriteCache::bufferIsEmpty ( ) const [inline]

check whether the buffer is currently empty

Returns:
true if buffer is empty, false otherwise
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

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:
elemDICOM element to read from
Returns:
EC_Normal if successful, an error code otherwise
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:
ownercurrent "owner" (DcmElement instance using this buffer)
fieldLengthnumber of bytes of user data in DICOM element
bytesTransferrednumber of bytes of user data in DICOM element that have already been transferred
byteOrderbyteOrder desired byte order in buffer

write buffer content to output stream

Parameters:
outStreamoutput stream to write to
Returns:
number of bytes written

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


Generated on Tue May 15 2012 for DCMTK Version 3.6.1 20120515 by Doxygen 1.7.5.1-20111027