GDCM: gdcm::UIDGenerator Class Reference

GDCM 3.2.10

Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
gdcm::UIDGenerator Class Reference

Class for generating unique UID. More...

`#include <gdcmUIDGenerator.h>`

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

## Static Protected Member Functions
static bool | GenerateUUID (unsigned char *uuid_data)

## Detailed Description

Class for generating unique UID.

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
  CreateJPIPDataSet.cxx, EncapsulateFileInRawData.cxx, Extracting_All_Resolution.cxx, Fake_Image_Using_Stream_Image_Writer.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GenFakeImage.cxx, GetSubSequenceData.cxx, ManipulateFile.cs, MpegVideoInfo.cs, ReformatFile.cs, StreamImageReaderTest.cxx, TemplateEmptyImage.cxx, and uid_unique.cxx.

## Constructor & Destructor Documentation

## ◆ UIDGenerator()

gdcm::UIDGenerator::UIDGenerator | ( |  | ) |
| inline

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

## Member Function Documentation

## ◆ Generate()

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
  CreateJPIPDataSet.cxx, EncapsulateFileInRawData.cxx, Extracting_All_Resolution.cxx, Fake_Image_Using_Stream_Image_Writer.cxx, GenAllVR.cxx, GenFakeIdentifyFile.cxx, GenFakeImage.cxx, GetSubSequenceData.cxx, ManipulateFile.cs, ReformatFile.cs, StreamImageReaderTest.cxx, TemplateEmptyImage.cxx, and uid_unique.cxx.

## ◆ GenerateUUID()

bool gdcm::UIDGenerator::GenerateUUID | ( | unsigned char * | uuid_data | ) |
| staticprotected

## ◆ GetGDCMUID()

const char * gdcm::UIDGenerator::GetGDCMUID | ( |  | ) |
| static

Return the default (GDCM) root UID:

## ◆ GetRoot()

const char * gdcm::UIDGenerator::GetRoot | ( |  | ) |
| static

Examples
  ExplicitLittleEndian.cs, ReformatFile.cs, and StandardizeFiles.cs.

## ◆ IsValid()

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)

## ◆ SetRoot()

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 guaranteeing uniqueness of UIDs when the root is longer than 26 bytes.

Examples
  ExplicitLittleEndian.cs, ReformatFile.cs, StandardizeFiles.cs, and uid_unique.cxx.

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

- gdcmUIDGenerator.h