DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Private Member Functions | Private Attributes | List of all members
DcmFileProducer Class Reference

producer class that reads data from a plain file. More...

Inheritance diagram for DcmFileProducer:

## Public Member Functions
| DcmFileProducer (const OFFilename &filename, offile_off_t offset=0)
| constructor More...
virtual | ~DcmFileProducer ()
| 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...
Public Member Functions inherited from DcmProducer
virtual | ~DcmProducer ()
| destructor

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

## Private Attributes
OFFile | file_
| the file we're actually reading from
OFCondition | status_
| status
offile_off_t | size_
| number of bytes in file

## Detailed Description

producer class that reads data from a plain file.

## Constructor & Destructor Documentation

## ◆ DcmFileProducer()

DcmFileProducer::DcmFileProducer | ( | const OFFilename & | filename,
|  | offile_off_t | offset = `0`
| ) |  |

constructor

Parameters

  filename | name of file to be opened (may contain wide chars if support enabled)
  offset | byte offset to skip from the start of file

## Member Function Documentation

## ◆ avail()

virtual offile_off_t DcmFileProducer::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 DcmFileProducer::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 DcmFileProducer::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 DcmFileProducer::putback | ( | offile_off_t | num | ) |
| virtual

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

Parameters

  num | number of bytes to putback. If the putback operation fails, the producer status becomes bad.

Implements DcmProducer.

## ◆ read()

virtual offile_off_t DcmFileProducer::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.

Implements DcmProducer.

## ◆ skip()

virtual offile_off_t DcmFileProducer::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.

Implements DcmProducer.

## ◆ status()

virtual OFCondition DcmFileProducer::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:

- dcmdata/include/dcmtk/dcmdata/dcistrmf.h

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