DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
| OFUUID (const struct BinaryRepresentation &val)
| Construct a new UUID from its binary representation. More...
void | generate ()
| Generate a new UUID. More...
OFString & | toString (OFString &result, E_Representation representation=ER_RepresentationDefault) const
| Get the string representation of this UUID. More...
STD_NAMESPACE ostream & | print (STD_NAMESPACE ostream &stream, E_Representation representation=ER_RepresentationDefault) const
| Write the string representation of this UUID to a stream. More...
void | getBinaryRepresentation (struct BinaryRepresentation &val) const
| Get the binary representation of this UUID. More...
OFBool | operator== (const OFUUID &other) const
| Compare this instance to another OFUUID instance. More...
OFBool | operator!= (const OFUUID &other) const
| Compare this instance to another OFUUID instance. More...

## Private Member Functions
void | printInteger (STD_NAMESPACE ostream &stream) const
| Print the integer representation to the given stream. More...
void | printHex (STD_NAMESPACE ostream &stream) const
| Print the hexadecimal representation to the given stream. More...

## 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

enum OFUUID::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.

## ◆ OFUUID() [2/2]

OFUUID::OFUUID | ( | const struct BinaryRepresentation & | val | ) |

Construct a new UUID from its binary representation.

Parameters

  val | the 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

  val | the 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

  other | the other instance

Returns
  OFFalse if both UUIDs are equal.

## ◆ operator==()

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

Compare this instance to another OFUUID instance.

Parameters

  other | the other instance

Returns
  OFTrue if both UUIDs are equal.

## ◆ 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

  stream | the output stream to write to
  representation | the representation to use

Returns
  stream

## ◆ printHex()

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

Print the hexadecimal representation to the given stream.

Parameters

  stream | stream to print to.

## ◆ printInteger()

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

Print the integer representation to the given stream.

Parameters

  stream | stream to print to.

## ◆ toString()

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

Get the string representation of this UUID.

Parameters

  result | string instance to save the result in
  representation | the representation to use

Returns
  result

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

- ofstd/include/dcmtk/ofstd/ofuuid.h

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