DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
DcmInputStream Class Referenceabstract

abstract base class for input streams. More...

Inheritance diagram for DcmInputStream:

## Public Member Functions
virtual | ~DcmInputStream ()
| destructor
virtual OFBool | good () const
| returns the status of the stream. More...
virtual OFCondition | status () const
| returns the status of the stream 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 offile_off_t | tell () const
| returns the total number of bytes read from the stream so far More...
virtual OFCondition | installCompressionFilter (E_StreamCompression filterType)
| installs a compression filter for the given stream compression type, which should be neither ESC_none nor ESC_unsupported. More...
virtual DcmInputStreamFactory * | newFactory () const =0
| creates a new factory object for the current stream and stream position. More...
virtual void | mark ()
| marks the current stream position for a later putback operation, overwriting a possibly existing prior putback mark. More...
virtual void | putback ()
| resets the stream to the position previously marked with setPutbackMark(). More...

## Protected Member Functions
| DcmInputStream (DcmProducer *initial)
| protected constructor, to be called from derived class constructor More...
const DcmProducer * | currentProducer () const
| returns pointer to current producer object

## Private Member Functions
| DcmInputStream (const DcmInputStream &)
| private unimplemented copy constructor
DcmInputStream & | operator= (const DcmInputStream &)
| private unimplemented copy assignment operator

## Private Attributes
DcmProducer * | current_
| pointer to first node in filter chain
DcmInputFilter * | compressionFilter_
| pointer to compression filter, NULL if no compression
offile_off_t | tell_
| counter for number of bytes read so far
offile_off_t | mark_
| putback marker

## Detailed Description

abstract base class for input streams.

## Constructor & Destructor Documentation

## ◆ DcmInputStream()

DcmInputStream::DcmInputStream | ( | DcmProducer * | initial | ) |
| protected

protected constructor, to be called from derived class constructor

Parameters

  initial | initial pointer to first node in filter chain The pointer is not dereferenced in the constructor, so the object pointed to may be initialized later in the subclass constructor.

## Member Function Documentation

## ◆ avail()

virtual offile_off_t DcmInputStream::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

## ◆ eos()

virtual OFBool DcmInputStream::eos | ( |  | ) |
| virtual

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

Returns
  true if end of stream, false otherwise

## ◆ good()

virtual OFBool DcmInputStream::good | ( |  | ) | const
| virtual

returns the status of the stream.

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

Returns
  status, true if good

## ◆ installCompressionFilter()

virtual OFCondition DcmInputStream::installCompressionFilter | ( | E_StreamCompression | filterType | ) |
| virtual

installs a compression filter for the given stream compression type, which should be neither ESC_none nor ESC_unsupported.

Once a compression filter is active, it cannot be deactivated or replaced during the lifetime of the stream.

Parameters

  filterType | type of compression filter

Returns
  EC_Normal if successful, an error code otherwise

## ◆ mark()

virtual void DcmInputStream::mark | ( |  | ) |
| virtual

marks the current stream position for a later putback operation, overwriting a possibly existing prior putback mark.

The DcmObject read methods rely on the possibility to putback up to 132 bytes for transfer syntax detection, parse error recovery etc. Implementations of this class should guarantee a putback capability of at least 1 kbyte.

## ◆ newFactory()

virtual DcmInputStreamFactory* DcmInputStream::newFactory | ( |  | ) | const
| pure virtual

creates a new factory object for the current stream and stream position.

When activated, the factory will be able to create new DcmInputStream delivering the same data as the current stream. Used to defer loading of value fields until accessed. If no factory object can be created (e.g. because the stream is not seekable), returns NULL.

Returns
  pointer to new factory object if successful, NULL otherwise.

Implemented in DcmStdinStream, DcmInputFileStream, and DcmInputBufferStream.

## ◆ putback()

virtual void DcmInputStream::putback | ( |  | ) |
| virtual

resets the stream to the position previously marked with setPutbackMark().

If the putback operation fails (no putback mark set or putback buffer exceeded), status of the producer switches to bad.

## ◆ read()

virtual offile_off_t DcmInputStream::read | ( | void * | buf,
|  | offile_off_t | buflen
| ) |  |
| virtual

reads as many bytes as possible into the given block.

Parameters

  buf | pointer to memory block, must not be NULL
  buflen | length of memory block

Returns
  number of bytes actually read.

## ◆ skip()

virtual offile_off_t DcmInputStream::skip | ( | offile_off_t | skiplen | ) |
| virtual

skips over the given number of bytes (or less)

Parameters

  skiplen | number of bytes to skip

Returns
  number of bytes actually skipped.

## ◆ status()

virtual OFCondition DcmInputStream::status | ( |  | ) | const
| virtual

returns the status of the stream as an OFCondition object.

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

Returns
  status, EC_Normal if good

## ◆ tell()

virtual offile_off_t DcmInputStream::tell | ( |  | ) | const
| virtual

returns the total number of bytes read from the stream so far

Returns
  total number of bytes read from the stream

Referenced by DcmFileCache::init().

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

- dcmdata/include/dcmtk/dcmdata/dcistrma.h

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