#include <vtkUUID.h>
Inheritance diagram for vtkUUID:
UUID stands for a Universal Unique IDentifier. These are 128 bit numbers which is guaranteed (reasonably) to be unique across both space and time. The mechanism used to guarantee that UUIDs are Unique is through combinations of hardware addresses, time stamps and random seeds. A UUID can be used for multiple purposes, from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects across a network.
There is a reference in the UUID to the hardware address of the first network card on the host which generated the UUID - this reference is intended to ensure the UUID will be unique in space as the MAC address of every network card is assigned by a single global authority and is guaranteed to be unique.
The generation of UUIDs does not require a registration authority for each single identifier. Instead, it requires a unique value over space for each UUID generator. This spatially unique value is specified as an IEEE 802 address, which is usually already applied to network-connected systems. This 48-bit address can be assigned based on an address block obtained through the IEEE registration authority. This UUID specification assumes the availability of an IEEE 802 address.
Table: UUID Format
Field | NDR Data Type | Octet # | Note |
---|---|---|---|
mTimeLow | unsigned long | 0-3 | The low field of the timestamp. |
mTimeMid | unsigned short | 4-5 | The middle field of the timestamp. |
mTimeHigh | unsigned short | 6-7 | The high field of the timestamp multiplexed with the version number. |
mClockSeqHigh | unsigned small | 8 | The high field of the clock sequence multiplexed with the variant. |
mClockSeqLow | unsigned small | 9 | The low field of the clock sequence. |
mNode | character | 10-15 | The spatially unique node identifier. |
The UUID consists of a record of 16 octets and must not contain padding between fields. The total size is 128 bits.
To minimise confusion about bit assignments within octets, the UUID record definition is defined only in terms of fields that are integral numbers of octets. The version number is multiplexed with the time stamp (time_high), and the variant field is multiplexed with the clock sequence (clock_seq_high).
The next component is a timestamp which, as long as clocks always move forward, will be unique in time. The timestamp is a 60 bit value. For UUID version 1, this is represented by Coordinated Universal Time (UTC) as a count of 100-nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar).
The version number is multiplexed in the 4 most significant bits of the mTimeHigh
field.
Table: UUID version Field
msb1 | msb2 | msb3 | msb4 | Version | Description |
---|---|---|---|---|---|
0 | 0 | 0 | 1 | 1 | DCE version, as specified herein. |
0 | 0 | 1 | 0 | 2 | DCE Security version, with embedded POSIX UIDs. |
The variant field determines the layout of the UUID. The structure of DCE UUIDs is fixed across different versions. Other UUID variants may not interoperate with DCE UUIDs. Interoperability of UUIDs is defined as the applicability of operations such as string conversion, comparison, and lexical ordering across different systems. The variant field consists of a variable number of the msbs of the mClockSeqHigh field.
Table: UUID variant Field
msb1 | msb2 | msb3 | Description |
---|---|---|---|
0 | - | - | Reserved, NCS backward compatibility. |
1 | 0 | - | DCE variant. |
1 | 1 | 0 | Reserved, Microsoft Corporation GUID. |
1 | 1 | 1 | Reserved for future definition. |
The formal definition of the UUID string representation is provided by the following extended BNF:
UUID ::= <time_low> <hyphen> <time_mid> <hyphen> <time_high_and_version> <hyphen> <clock_seq_hi_and_reserved> <clock_seq_low> <hyphen> <node>
time_low ::= <hexOctet> <hexOctet> <hexOctet> <hexOctet>
time_mid ::= <hexOctet> <hexOctet>
time_high_and_version ::= <hexOctet> <hexOctet>
clock_seq_hi_and_reserved ::= <hexOctet>
clock_seq_low ::= <hexOctet>
node ::= <hexOctet><hexOctet><hexOctet> <hexOctet><hexOctet><hexOctet>
hexOctet ::= <hexDigit> <hexDigit>
hexDigit ::= <digit> | <a> | <b> | <c> | <d> | <e> | <f>
digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
hyphen ::= "-"
a ::= "a" | "A"
b ::= "b" | "B"
c ::= "c" | "C"
d ::= "d" | "D"
e ::= "e" | "E"
f ::= "f" | "F"
Just in case some part of the above goes wrong, there is a random component placed into the UUID as a catch-all for uniqueness.
The following is an example of a generated UUID: 58f202ac-22cf-11d1-b12d-002035b29092
This has come from a machine with the network hardware address 002035B29092
. From this it may be observed that the Network address of the ethernet adapter matches the last portion of the uuid.
Definition at line 300 of file vtkUUID.h.
Public Member Functions | |
vtkTypeRevisionMacro (vtkUUID, vtkObject) | |
void | PrintSelf (ostream &, vtkIndent) |
void | Clear (void) |
Clear this UUID data to zero. | |
void | Copy (const vtkUUID *a) |
Copy a UUID (source UUID is const). | |
void | Copy (const char *a) |
Unmarshal a UUID from a character string. | |
void | Copy (const unsigned char a[16]) |
Copy identity from a 128-bit, 16-byte sequence. | |
int | GetString (char buffer[37]) const |
Marshal this UUID as a character string into the provided buffer . | |
const char * | GetString (void) const |
Marshal this UUID as a character string. | |
int | GetBinary (unsigned char buffer[16]) const |
Pack this UUID as a 128-bit, 16-byte sequence into the provided buffer . | |
const unsigned char * | GetBinary (void) const |
Pack this UUID into a 128-bit, 16-byte sequence. | |
int | IsNull (void) const |
Returns true if the uuid is the NULL uuid, false otherwise. | |
time_t | GetTime (struct timeval *a) const |
Extract the time value embedded in an ID. | |
long | GetTime (void) const |
Extract the time value embedded in an ID. | |
int | GetVariant (void) const |
Get an enumeration of the UUID variant. | |
int | GetVersion (void) const |
Get an enumeration of the UUID version. | |
void | Swap (vtkUUID *object) |
Swaps the date of this object with those of specified object. | |
Structure & | GetData (void) |
Get the internal data structure of this UUID. | |
const Structure & | GetData (void) const |
Get the internal data structure of this UUID. | |
int | Compare (const vtkUUID *a) const |
Compares two UUIDs. | |
int | Compare (const char *a) const |
Compares two UUIDs. | |
int | Compare (const unsigned char a[16]) const |
Compares two UUIDs. | |
Static Public Member Functions | |
vtkUUID * | New (void) |
const char * | GetVariantString (int variant) |
Get a string representation of the UUID variant. | |
const char * | GetVersionString (int version) |
Get a string representation of the UUID version. | |
Static Public Attributes | |
const vtkUint32Type | TimeOffsetLow = VTK_EXTENSIONS_UINT32(0x13814000) |
Offset between 15-Oct-1582 and 1-Jan-70 (DTSS UTC vs. | |
const vtkUint32Type | TimeOffsetHigh = VTK_EXTENSIONS_UINT32(0x01B21DD2) |
Offset between 15-Oct-1582 and 1-Jan-70 (DTSS UTC vs. | |
Protected Member Functions | |
vtkUUID (void) | |
~vtkUUID () | |
vtkUUID (const vtkUUID *a) | |
vtkUUID (const char *a) | |
vtkUUID (const unsigned char a[16]) | |
Static Protected Member Functions | |
static initialization. | |
void | ClassInitialize (void) |
void | ClassFinalize (void) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Clear this UUID data to zero.
Definition at line 523 of file vtkUUID.h. References vtkUUID::Structure::Clear(). Referenced by Copy(). |
|
Compares two UUIDs. The uuid compare method compares two UUIDs, returning 1 if they are equal, or 0 if they are not. Because the uuid compare command handles the comparison of UUIDs in current and previous DCE formats, you should use it rather than string compare.
Definition at line 784 of file vtkUUID.h. References vtkUUID::Structure::Compare(), and Compare(). |
|
Compares two UUIDs. The uuid compare method compares two UUIDs, returning 1 if they are equal, or 0 if they are not. Because the uuid compare command handles the comparison of UUIDs in current and previous DCE formats, you should use it rather than string compare.
Definition at line 777 of file vtkUUID.h. References vtkUUID::Structure::Compare(), and Compare(). |
|
Compares two UUIDs. The uuid compare method compares two UUIDs, returning 1 if they are equal, or 0 if they are not. Because the uuid compare command handles the comparison of UUIDs in current and previous DCE formats, you should use it rather than string compare.
Definition at line 770 of file vtkUUID.h. References vtkUUID::Structure::Compare(), Compare(), and GetData(). Referenced by Compare(). |
|
Copy identity from a 128-bit, 16-byte sequence.
Definition at line 589 of file vtkUUID.h. References vtkUUID::Structure::Copy(), and Copy(). |
|
Unmarshal a UUID from a character string.
|
|
Copy a UUID (source UUID is const).
Definition at line 582 of file vtkUUID.h. References Clear(), vtkUUID::Structure::Copy(), Copy(), and GetData(). Referenced by Copy(). |
|
Pack this UUID into a 128-bit, 16-byte sequence.
|
|
Pack this UUID as a 128-bit, 16-byte sequence into the provided
Definition at line 626 of file vtkUUID.h. References vtkUUID::Structure::GetBinary(). |
|
Get the internal data structure of this UUID.
|
|
Get the internal data structure of this UUID.
|
|
Marshal this UUID as a character string.
|
|
Marshal this UUID as a character string into the provided
|
|
Extract the time value embedded in an ID.
|
|
Extract the time value embedded in an ID.
|
|
Get an enumeration of the UUID variant.
Definition at line 687 of file vtkUUID.h. References vtkUUID::Structure::GetVariant(). |
|
Get a string representation of the UUID variant.
Definition at line 700 of file vtkUUID.h. References GetVariantString(), VTK_UUID_VARIANT_DCE, VTK_UUID_VARIANT_MICROSOFT, VTK_UUID_VARIANT_NCS, and VTK_UUID_VARIANT_RESERVED. Referenced by GetVariantString(). |
|
Get an enumeration of the UUID version.
Definition at line 693 of file vtkUUID.h. References vtkUUID::Structure::GetVersion(). |
|
Get a string representation of the UUID version.
Definition at line 718 of file vtkUUID.h. References GetVersionString(), VTK_UUID_VERSION_EMBEDDED_POSIX, VTK_UUID_VERSION_NAME, VTK_UUID_VERSION_RANDOM, and VTK_UUID_VERSION_TIME. Referenced by GetVersionString(). |
|
Returns
Definition at line 644 of file vtkUUID.h. References vtkUUID::Structure::IsNull(). |
|
Reimplemented from vtkObject. |
|
Reimplemented from vtkObject. |
|
Swaps the date of this object with those of specified object.
Definition at line 833 of file vtkUUID.h. References GetData(), and vtkUUID::Structure::Swap(). |
|
|
|
Offset between 15-Oct-1582 and 1-Jan-70 (DTSS UTC vs. Unix base times). |
|
Offset between 15-Oct-1582 and 1-Jan-70 (DTSS UTC vs. Unix base times). |