DCMTK Version 3.7.0
OFFIS DICOM Toolkit
Loading...
Searching...
No Matches
OFFilenameCreator Class Reference

A class for automatically creating unique pseudo-random filenames. More...

Public Member Functions

 OFFilenameCreator ()
 default constructor
 OFFilenameCreator (const OFFilenameCreator &copy)
 copy constructor
virtual ~OFFilenameCreator ()
 destructor
OFFilenameCreatoroperator= (const OFFilenameCreator &copy)
 assignment operator
OFBool makeFilename (unsigned int &seed, const char *dir, const char *prefix, const char *postfix, OFString &filename)
 creates a new unique filename.

Static Public Member Functions

static unsigned int hashString (const char *str)
 creates hash value.

Static Private Member Functions

static void addLongToString (unsigned long l, OFString &s)
 appends the lower 32 bit of the given number to the given string.

Private Attributes

unsigned long creation_time
 date/time of creation of this object

Detailed Description

A class for automatically creating unique pseudo-random filenames.

Member Function Documentation

◆ addLongToString()

void OFFilenameCreator::addLongToString ( unsigned long l,
OFString & s )
staticprivate

appends the lower 32 bit of the given number to the given string.

Always appends exactly 8 digits (padded with leading zeros).

Parameters
lnumber to be appended to string
sstring to be added to

◆ hashString()

unsigned int OFFilenameCreator::hashString ( const char * str)
static

creates hash value.

(i.e. random seed) from character string.

Parameters
strnull-terminated string
Returns
hash value

◆ makeFilename()

OFBool OFFilenameCreator::makeFilename ( unsigned int & seed,
const char * dir,
const char * prefix,
const char * postfix,
OFString & filename )

creates a new unique filename.

Parameters
seedseed of random number generator
dirdirectory in which the file name should be located
prefixfilename prefix
postfixfilename postfix
filenamestring in which the filename (path) is returned
Returns
OFTrue if successful, OFFalse if no filename could be created.

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


Generated on for DCMTK Version 3.7.0 by Doxygen 1.15.0