DCMTK
Version 3.6.1 20120515
OFFIS DICOM Toolkit
|
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. | |
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 | |
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 |
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.
OFBool DcmWriteCache::bufferIsEmpty | ( | ) | const [inline] |
check whether the buffer is currently empty
Uint32 DcmWriteCache::contentLength | ( | ) | const [inline] |
return the number of bytes of user data currently in buffer
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).
elem | DICOM element to read from |
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.
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 |
Uint32 DcmWriteCache::writeBuffer | ( | DcmOutputStream & | outStream | ) |
write buffer content to output stream
outStream | output stream to write to |