Loading...
Searching...
No Matches
DcmFileConsumer Class Reference

consumer class that stores data in a plain file. More...

Inheritance diagram for DcmFileConsumer:

## Public Member Functions

| DcmFileConsumer (const OFFilename &filename)
| constructor
| DcmFileConsumer (FILE *file)
| constructor
| DcmFileConsumer (OFFile &file)
| constructor
virtual | ~DcmFileConsumer ()
| destructor
virtual OFBool | good () const
| returns the status of the consumer.
virtual OFCondition | status () const
| returns the status of the consumer as an OFCondition object.
virtual OFBool | isFlushed () const
| returns true if the consumer is flushed, i.e.
virtual offile_off_t | avail () const
| returns the minimum number of bytes that can be written with the next call to write().
virtual offile_off_t | write (const void *buf, offile_off_t buflen)
| processes as many bytes as possible from the given input block.
virtual void | flush ()
| instructs the consumer to flush its internal content until either the consumer becomes "flushed" or I/O suspension occurs.
virtual void | fclose ()
| closes the file associated with this object.
Public Member Functions inherited from DcmConsumer
virtual | ~DcmConsumer ()
| destructor

## Private Member Functions

| DcmFileConsumer (const DcmFileConsumer &)
| private unimplemented copy constructor
DcmFileConsumer & | operator= (const DcmFileConsumer &)
| private unimplemented copy assignment operator

## Private Attributes

OFFile | file_container_
| container encapsulating a FILE *
OFFile & | file_
| reference the file we actually writing to.
OFCondition | status_
| status

## Detailed Description

consumer class that stores data in a plain file.

## Constructor & Destructor Documentation

## DcmFileConsumer() [1/3]

DcmFileConsumer::DcmFileConsumer | ( | const OFFilename & | filename | ) |

constructor

Parameters

  filename | name of file to be created (may contain wide chars if support enabled)

Referenced by DcmFileConsumer(), and operator=().

## DcmFileConsumer() [2/3]

DcmFileConsumer::DcmFileConsumer | ( | FILE * | file | ) |

constructor

Parameters

  file | structure, file must already be open for writing

## DcmFileConsumer() [3/3]

DcmFileConsumer::DcmFileConsumer | ( | OFFile & | file | ) |

constructor

Parameters

  OFFile | instance, file must already be open for writing, and the OFFile object must remain valid as long as this instance exists.

## Member Function Documentation

## avail()

virtual offile_off_t DcmFileConsumer::avail | ( |  | ) | const

virtual

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

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

Returns
  minimum of space available in consumer

Implements DcmConsumer.

## fclose()

virtual void DcmFileConsumer::fclose | ( |  | ) |

virtual

closes the file associated with this object.

Updates the internal status variable in case of an error.

## flush()

virtual void DcmFileConsumer::flush | ( |  | ) |

virtual

instructs the consumer to flush its internal content until either the consumer becomes "flushed" or I/O suspension occurs.

After a call to flush(), a call to write() will produce undefined behaviour.

Implements DcmConsumer.

## good()

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

virtual

returns the status of the consumer.

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

Returns
  status, true if good

Implements DcmConsumer.

## isFlushed()

virtual OFBool DcmFileConsumer::isFlushed | ( |  | ) | const

virtual

returns true if the consumer is flushed, i.e.

has no more data pending in it's internal state that needs to be flushed before the stream is closed.

Returns
  true if consumer is flushed, false otherwise

Implements DcmConsumer.

## status()

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

virtual

returns the status of the consumer as an OFCondition object.

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

Returns
  status, EC_Normal if good

Implements DcmConsumer.

## write()

virtual offile_off_t DcmFileConsumer::write | ( | const void * | buf,
|  | offile_off_t | buflen )

virtual

processes as many bytes as possible from the given input block.

Parameters

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

Returns
  number of bytes actually processed.

Implements DcmConsumer.

## Member Data Documentation

## file_

OFFile& DcmFileConsumer::file_

private

reference the file we actually writing to.

Points to file_container_ in most, but not all cases

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

- dcmdata/include/dcmtk/dcmdata/dcostrmf.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.15.0