DCMTK  Version 3.6.4
OFFIS DICOM Toolkit
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DcmBufferProducer Class Reference

producer class that reads data from a buffer provided by the caller. More...

+ Inheritance diagram for DcmBufferProducer:

Public Member Functions

 DcmBufferProducer ()
 constructor
 
virtual ~DcmBufferProducer ()
 destructor
 
virtual OFBool good () const
 returns the status of the producer. More...
 
virtual OFCondition status () const
 returns the status of the producer as an OFCondition object. More...
 
virtual OFBool eos ()
 returns true if the producer is at the end of stream. More...
 
virtual offile_off_t avail ()
 returns the minimum number of bytes that can be read with the next call to read(). More...
 
virtual offile_off_t read (void *buf, offile_off_t buflen)
 reads as many bytes as possible into the given block. More...
 
virtual offile_off_t skip (offile_off_t skiplen)
 skips over the given number of bytes (or less) More...
 
virtual void putback (offile_off_t num)
 resets the stream to the position by the given number of bytes. More...
 
virtual void setBuffer (const void *buf, offile_off_t buflen)
 adds the content of the given buffer to the input stream. More...
 
virtual void releaseBuffer ()
 releases the current buffer. More...
 
virtual void setEos ()
 marks the end of stream, i.e. More...
 
- Public Member Functions inherited from DcmProducer
virtual ~DcmProducer ()
 destructor
 

Private Member Functions

 DcmBufferProducer (const DcmBufferProducer &)
 private unimplemented copy constructor
 
DcmBufferProduceroperator= (const DcmBufferProducer &)
 private unimplemented copy assignment operator
 

Private Attributes

unsigned char * buffer_
 the user buffer we're actually reading from
 
unsigned char * backup_
 the backup buffer
 
offile_off_t bufSize_
 size of the user buffer, in bytes
 
offile_off_t bufIndex_
 number of bytes read from the user buffer
 
offile_off_t backupIndex_
 number of bytes read from the backup buffer
 
offile_off_t backupStart_
 index of first valid byte in backup buffer, for putback
 
OFCondition status_
 status
 
OFBool eosflag_
 true if setEos has been called before
 

Detailed Description

producer class that reads data from a buffer provided by the caller.

Used for DICOM network communication.

Member Function Documentation

◆ avail()

virtual offile_off_t DcmBufferProducer::avail ( )
virtual

returns the minimum number of bytes that can be read with the next call to read().

The DcmObject read 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 read "en bloc", i.e. all or nothing.

Returns
minimum of data available in producer

Implements DcmProducer.

◆ eos()

virtual OFBool DcmBufferProducer::eos ( )
virtual

returns true if the producer is at the end of stream.

Returns
true if end of stream, false otherwise

Implements DcmProducer.

◆ good()

virtual OFBool DcmBufferProducer::good ( ) const
virtual

returns the status of the producer.

Unless the status is good, the producer will not permit any operation.

Returns
status, true if good

Implements DcmProducer.

◆ putback()

virtual void DcmBufferProducer::putback ( offile_off_t  num)
virtual

resets the stream to the position by the given number of bytes.

Parameters
numnumber of bytes to putback. If the putback operation fails, the producer status becomes bad.

Implements DcmProducer.

◆ read()

virtual offile_off_t DcmBufferProducer::read ( void *  buf,
offile_off_t  buflen 
)
virtual

reads as many bytes as possible into the given block.

Parameters
bufpointer to memory block, must not be NULL
buflenlength of memory block
Returns
number of bytes actually read.

Implements DcmProducer.

◆ releaseBuffer()

virtual void DcmBufferProducer::releaseBuffer ( )
virtual

releases the current buffer.

Should only be called when the content of the buffer has been read as far as possible. Pending input from the buffer is copied into an internal backup buffer if necessary. If an overflow condition occurs, the producer status becomes bad.

◆ setBuffer()

virtual void DcmBufferProducer::setBuffer ( const void *  buf,
offile_off_t  buflen 
)
virtual

adds the content of the given buffer to the input stream.

Parameters
bufbuffer from which data is read. Must be allocated by caller and remain valid until releaseBuffer() is called
buflenbuffer length, must be even number > 0.

◆ setEos()

virtual void DcmBufferProducer::setEos ( )
virtual

marks the end of stream, i.e.

the data provided with the last call to setBuffer is the last data available in the stream.

◆ skip()

virtual offile_off_t DcmBufferProducer::skip ( offile_off_t  skiplen)
virtual

skips over the given number of bytes (or less)

Parameters
skiplennumber of bytes to skip
Returns
number of bytes actually skipped.

Implements DcmProducer.

◆ status()

virtual OFCondition DcmBufferProducer::status ( ) const
virtual

returns the status of the producer as an OFCondition object.

Unless the status is good, the producer will not permit any operation.

Returns
status, EC_Normal if good

Implements DcmProducer.


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


Generated on Thu Nov 29 2018 for DCMTK Version 3.6.4 by Doxygen 1.8.14