DCMTK Version 3.7.0 OFFIS DICOM Toolkit

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

class that manages the life cycle of a temporary file. More...

## Public Member Functions
DcmInputStream * | create () const
| create an input stream that permits reading from the temporary file More...
void | increaseRefCount ()
| increase reference counter for this object
void | decreaseRefCount ()
| decreases reference counter for this object and deletes the temporary file and this object if the reference counter becomes zero.

## Static Public Member Functions
static DcmTempFileHandler * | newInstance (const OFFilename &filename)
| static method that permits creation of instances of this class (only) on the heap, never on the stack. More...

## Private Member Functions
| DcmTempFileHandler (const OFFilename &filename)
| private constructor. More...
virtual | ~DcmTempFileHandler ()
| private destructor. More...
| DcmTempFileHandler (const DcmTempFileHandler &arg)
| private undefined copy constructor
DcmTempFileHandler & | operator= (const DcmTempFileHandler &arg)
| private undefined copy assignment operator

## Private Attributes
size_t | refCount_
| number of references to temporary file. More...
OFMutex | mutex_
| mutex for MT-safe reference counting More...
OFFilename | filename_
| path to temporary file

## Detailed Description

class that manages the life cycle of a temporary file.

It maintains a thread-safe reference counter, and when this counter is decreased to zero, unlinks (deletes) the file and then the handler object itself.

## Constructor & Destructor Documentation

## ◆ DcmTempFileHandler()

DcmTempFileHandler::DcmTempFileHandler | ( | const OFFilename & | filename | ) |
| private

private constructor.

Instances of this class are always created through newInstance().

Parameters

  filename | path to temporary file (may contain wide chars if support enabled)

## ◆ ~DcmTempFileHandler()

virtual DcmTempFileHandler::~DcmTempFileHandler | ( |  | ) |
| private virtual

private destructor.

Instances of this class are always deleted through the reference counting methods

## Member Function Documentation

## ◆ create()

DcmInputStream* DcmTempFileHandler::create | ( |  | ) | const

create an input stream that permits reading from the temporary file

Returns
  pointer to input stream. Note that there is no guarantee that the input stream actually permits reading, i.e. the presence of the temporary file is not checked.

## ◆ newInstance()

static DcmTempFileHandler* DcmTempFileHandler::newInstance | ( | const OFFilename & | filename | ) |
| static

static method that permits creation of instances of this class (only) on the heap, never on the stack.

A newly created instance always has a reference counter of 1.

Parameters

  filename | path to temporary file (may contain wide chars if support enabled)

## Member Data Documentation

## ◆ mutex_

OFMutex DcmTempFileHandler::mutex_
| private

mutex for MT-safe reference counting

Remarks
  this member is only available if DCMTK is compiled with thread support enabled.

## ◆ refCount_

size_t DcmTempFileHandler::refCount_
| private

number of references to temporary file.

Default initialized to 1 upon construction of this object

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