# gdcm::UIDGenerator Class Reference

Class for generating unique UID. More...

`#include <gdcmUIDGenerator.h>`

Collaboration diagram for gdcm::UIDGenerator:
[legend]

List of all members.

## Public Member Functions

| UIDGenerator ()
| By default the root of a UID is a GDCM Root...
const char * | Generate ()

## Static Public Member Functions

static const char * | GetGDCMUID ()
| Return the default (GDCM) root UID:
static const char * | GetRoot ()
static bool | IsValid (const char *uid)
static void | SetRoot (const char *root)

## Protected Member Functions

const char * | Generate2 ()

## Static Protected Member Functions

static bool | GenerateUUID (unsigned char *uuid_data)

## Detailed Description

Class for generating unique UID.

Note:
  bla Usage: When constructing a Series or Study UID, user *has* to keep around the UID, otherwise the UID Generator will simply forget the value and create a new UID.

Examples:

  EncapsulateFileInRawData.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GenFakeImage.cxx, GetSubSequenceData.cxx, and uid_unique.cxx.

## Constructor & Destructor Documentation

gdcm::UIDGenerator::UIDGenerator | ( |  | ) | `[inline]`

By default the root of a UID is a GDCM Root...

## Member Function Documentation

const char* gdcm::UIDGenerator::Generate | ( |  | ) |

Internally uses a std::string, so two calls have the same pointer ! save into a std::string In summary do not write code like that: const char *uid1 = uid.Generate(); const char *uid2 = uid.Generate(); since uid1 == uid2

Examples:
  EncapsulateFileInRawData.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GenFakeImage.cxx, and uid_unique.cxx.

const char* gdcm::UIDGenerator::Generate2 | ( |  | ) | `[protected]`

static bool gdcm::UIDGenerator::GenerateUUID | ( | unsigned char * | uuid_data | ) | `[static, protected]`

static const char* gdcm::UIDGenerator::GetGDCMUID | ( |  | ) | `[static]`

Return the default (GDCM) root UID:

static const char* gdcm::UIDGenerator::GetRoot | ( |  | ) | `[static]`

static bool gdcm::UIDGenerator::IsValid | ( | const char * | uid | ) | `[static]`

Find out if the string is a valid UID or not

Todo:
  : Move that in DataStructureAndEncoding (see FileMetaInformation::CheckFileMetaInformation)

static void gdcm::UIDGenerator::SetRoot | ( | const char * | root | ) | `[static]`

The current implementation in GDCM make use of the UUID implementation (RFC 4122) and has been successfully been tested for a root of size 26 bytes. Any longer root should work (the ::Generate() function will return a string), but will truncate the high bits of the 128bits UUID until the generated string fits on 64 bits. The authors disclaims any responsabitlity for garanteeing uniqueness of UIDs when the root is longer than 26 bytes.

Examples:
  uid_unique.cxx.

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

- gdcmUIDGenerator.h