abstract base class for input streams.
More...
|
|
virtual | ~DcmInputStream () |
| | destructor
|
| virtual OFBool | good () const |
| | returns the status of the stream.
|
| virtual OFCondition | status () const |
| | returns the status of the stream as an OFCondition object.
|
| virtual OFBool | eos () |
| | returns true if the producer is at the end of stream.
|
| virtual offile_off_t | avail () |
| | returns the minimum number of bytes that can be read with the next call to read().
|
| virtual offile_off_t | read (void *buf, offile_off_t buflen) |
| | reads as many bytes as possible into the given block.
|
| virtual offile_off_t | skip (offile_off_t skiplen) |
| | skips over the given number of bytes (or less)
|
| virtual offile_off_t | tell () const |
| | returns the total number of bytes read from the stream so far
|
| 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.
|
| virtual DcmInputStreamFactory * | newFactory () const =0 |
| | creates a new factory object for the current stream and stream position.
|
| Uint32 | nestingDepth () const |
| | returns the current sequence nesting depth.
|
| Uint32 | incrementNestingDepth () |
| | increments the sequence nesting depth counter.
|
| void | decrementNestingDepth () |
| | decrements the sequence nesting depth counter.
|
| Sint32 | maxNestingDepth () const |
| | returns the maximum permitted sequence nesting depth for this stream.
|
| void | setMaxNestingDepth (Sint32 maxDepth) |
| | sets the maximum permitted sequence nesting depth for this stream.
|
| virtual void | mark () |
| | marks the current stream position for a later putback operation, overwriting a possibly existing prior putback mark.
|
| virtual void | putback () |
| | resets the stream to the position previously marked with setPutbackMark().
|
|
| | DcmInputStream (DcmProducer *initial) |
| | protected constructor, to be called from derived class constructor
|
|
const DcmProducer * | currentProducer () const |
| | returns pointer to current producer object
|
|
|
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
|
|
Uint32 | nestingDepth_ |
| | current sequence nesting depth (for stack overflow protection)
|
|
Sint32 | maxNestingDepth_ |
| | maximum permitted sequence nesting depth (0 = default 64, -1 = unlimited)
|
abstract base class for input streams.
◆ 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. |
Referenced by DcmInputStream(), and operator=().
◆ 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
◆ decrementNestingDepth()
| void DcmInputStream::decrementNestingDepth |
( |
| ) |
|
decrements the sequence nesting depth counter.
Does nothing if the counter is already zero.
◆ 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
◆ incrementNestingDepth()
| Uint32 DcmInputStream::incrementNestingDepth |
( |
| ) |
|
increments the sequence nesting depth counter.
- Returns
- the new nesting depth after incrementing
◆ installCompressionFilter()
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.
◆ maxNestingDepth()
| Sint32 DcmInputStream::maxNestingDepth |
( |
| ) |
const |
returns the maximum permitted sequence nesting depth for this stream.
A value of 0 means the compile-time default (DCMTK_MAX_SEQUENCE_NESTING) applies. A value of -1 means the check is disabled (unlimited nesting).
- Returns
- maximum nesting depth setting
◆ nestingDepth()
| Uint32 DcmInputStream::nestingDepth |
( |
| ) |
const |
returns the current sequence nesting depth.
This counter is used to prevent stack overflow from deeply nested DICOM sequences in malicious input files.
- Returns
- current nesting depth
◆ newFactory()
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 DcmInputBufferStream, DcmInputFileStream, and DcmStdinStream.
◆ 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.
◆ setMaxNestingDepth()
| void DcmInputStream::setMaxNestingDepth |
( |
Sint32 | maxDepth | ) |
|
sets the maximum permitted sequence nesting depth for this stream.
Must be called before parsing begins.
- Value 0 (default): apply the compile-time default (DCMTK_MAX_SEQUENCE_NESTING, default is 64)
- Value -1: disable the check (allow unlimited nesting)
- Value > 0: use this value as the maximum permitted nesting depth
- Parameters
-
| maxDepth | maximum nesting depth setting |
◆ 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()
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
The documentation for this class was generated from the following file:
- dcmdata/include/dcmtk/dcmdata/dcistrma.h