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.

Definition at line 50 of file dcwcache.h.


Member Function Documentation

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

OFBool DcmWriteCache::bufferIsEmpty (  )  const [inline]

check whether the buffer is currently empty

Returns:
true if buffer is empty, false otherwise

Definition at line 85 of file dcwcache.h.

References numBytes_.

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

Definition at line 90 of file dcwcache.h.

References numBytes_.

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

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:


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1