DCMTK Version 3.6.9
OFFIS DICOM Toolkit
Loading...
Searching...
No Matches
OFUUID Class Reference

Helper class for generating and storing UUIDs, as specified in ITU-T X.667. More...

Classes

struct  BinaryRepresentation
 

Public Types

enum  E_Representation {
  ER_RepresentationInteger , ER_RepresentationHex , ER_RepresentationOID , ER_RepresentationURN ,
  ER_RepresentationDefault = ER_RepresentationHex
}
 The possible ways to represent a UUID. More...
 

Public Member Functions

 OFUUID ()
 Default constructor.
 
 OFUUID (const struct BinaryRepresentation &val)
 Construct a new UUID from its binary representation.
 
void generate ()
 Generate a new UUID.
 
OFStringtoString (OFString &result, E_Representation representation=ER_RepresentationDefault) const
 Get the string representation of this UUID.
 
STD_NAMESPACE ostream & print (STD_NAMESPACE ostream &stream, E_Representation representation=ER_RepresentationDefault) const
 Write the string representation of this UUID to a stream.
 
void getBinaryRepresentation (struct BinaryRepresentation &val) const
 Get the binary representation of this UUID.
 
OFBool operator== (const OFUUID &other) const
 Compare this instance to another OFUUID instance.
 
OFBool operator!= (const OFUUID &other) const
 Compare this instance to another OFUUID instance.
 

Private Member Functions

void printInteger (STD_NAMESPACE ostream &stream) const
 Print the integer representation to the given stream.
 
void printHex (STD_NAMESPACE ostream &stream) const
 Print the hexadecimal representation to the given stream.
 

Private Attributes

Uint32 time_low
 Octets 0-3 of the time field.
 
Uint16 time_mid
 Octets 4-5 of the time field.
 
Uint16 version_and_time_high
 4 bits for the version and the 12 highest bits of the time
 
Uint8 variant_and_clock_seq_high
 2 bits for the variant and the 6 highest bits of the clock sequence
 
Uint8 clock_seq_low
 The lowest 8 bits of the clock sequence.
 
Uint8 node [6]
 The node value in the form of a MAC address.
 
OFRandom rnd
 Pseudo random number generator.
 

Detailed Description

Helper class for generating and storing UUIDs, as specified in ITU-T X.667.

A UUID is an Universally Unique IDentifier. If UUIDs are generated correctly, it's almost impossible that the same UUID is generated twice.

Warning
The implementation of this class still contains a few "FIXME" comments and should, therefore, not be used in productive environments as long as these corrections have not yet been implemented.

Class Documentation

◆ OFUUID::BinaryRepresentation

struct OFUUID::BinaryRepresentation

Member Enumeration Documentation

◆ E_Representation

The possible ways to represent a UUID.

Enumerator
ER_RepresentationInteger 

The UUID is printed as one, long integer in base 10 (up to 39 digits long)

ER_RepresentationHex 

The UUID is printed in hexadecimal notation with hyphens (-) separating groups.

ER_RepresentationOID 

The UUID is printed as one, long integer with the prefix "2.25.".

ER_RepresentationURN 

The UUID is printed in hexadecimal notation with the prefix "urn:uuid:".

ER_RepresentationDefault 

The default representation that is used when none is given.

Constructor & Destructor Documentation

◆ OFUUID() [1/2]

OFUUID::OFUUID ( )

Default constructor.

Generates a new UUID.

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

◆ OFUUID() [2/2]

OFUUID::OFUUID ( const struct BinaryRepresentation & val)

Construct a new UUID from its binary representation.

Parameters
valthe binary representation
See also
getBinaryRepresentation

Member Function Documentation

◆ generate()

void OFUUID::generate ( )

Generate a new UUID.

The old UUID is discarded.

◆ getBinaryRepresentation()

void OFUUID::getBinaryRepresentation ( struct BinaryRepresentation & val) const

Get the binary representation of this UUID.

Parameters
valthe structure where the result should be saved to

◆ operator!=()

OFBool OFUUID::operator!= ( const OFUUID & other) const
inline

Compare this instance to another OFUUID instance.

Parameters
otherthe other instance
Returns
OFFalse if both UUIDs are equal.

References OFUUID().

◆ operator==()

OFBool OFUUID::operator== ( const OFUUID & other) const

Compare this instance to another OFUUID instance.

Parameters
otherthe other instance
Returns
OFTrue if both UUIDs are equal.

References OFUUID().

◆ print()

STD_NAMESPACE ostream & OFUUID::print ( STD_NAMESPACE ostream & stream,
E_Representation representation = ER_RepresentationDefault ) const

Write the string representation of this UUID to a stream.

Parameters
streamthe output stream to write to
representationthe representation to use
Returns
stream

References ER_RepresentationDefault.

◆ printHex()

void OFUUID::printHex ( STD_NAMESPACE ostream & stream) const
private

Print the hexadecimal representation to the given stream.

Parameters
streamstream to print to.

◆ printInteger()

void OFUUID::printInteger ( STD_NAMESPACE ostream & stream) const
private

Print the integer representation to the given stream.

Parameters
streamstream to print to.

◆ toString()

OFString & OFUUID::toString ( OFString & result,
E_Representation representation = ER_RepresentationDefault ) const

Get the string representation of this UUID.

Parameters
resultstring instance to save the result in
representationthe representation to use
Returns
result

References ER_RepresentationDefault.


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


Generated on Fri Feb 28 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2