Struct GUID_t

Struct Documentation

struct Microsoft::Applications::Events::GUID_t

The GUID_t structure represents the portable cross-platform implementation of a GUID (Globally Unique ID).

GUIDs identify objects such as interfaces, manager entry-point vectors (EPVs), and class objects. A GUID is a 128-bit value consisting of one group of eight hexadecimal digits, followed by three groups of four hexadecimal digits, each followed by one group of 12 hexadecimal digits.

The definition of this structure is the cross-platform equivalent to the Windows RPC GUID definition.

Note: You must provide your own converter to convert from a Windows RPC GUID to a GUID_t.

Public Functions

GUID_t()

The default GUID_t constructor.

Creates a null instance of the GUID_t object (initialized to all zeros). {00000000-0000-0000-0000-000000000000}.

GUID_t(const char *guid_string)

A constructor that creates a GUID_t object from a hyphenated string.

Parameters

guid_string – A hyphenated string that contains the GUID (curly braces optional).

GUID_t(const uint8_t guid_bytes[16], bool bigEndian = false)

A constructor that creates a GUID_t object from a byte array.

Parameters
  • guid_bytes – A byte array.

  • bigEndian

    A boolean value that specifies the byte order.

    A value of

    true

    specifies the more natural human-readable order.

    A value of

    false (the default) specifies the same order as the .NET GUID constructor.

GUID_t(int d1, int d2, int d3, const std::initializer_list<uint8_t> &v)

A constructor that creates a GUID_t object from three integers and a byte array.

Parameters
  • d1 – An integer that specifies the first eight hexadecimal digits of the GUID.

  • d2 – An integer that specifies the first group of four hexadecimal digits.

  • d3 – An integer that specifies the second group of four hexadecimal digits.

  • v – A reference to an array of eight bytes. The first two bytes contain the third group of four hexadecimal digits. The remaining six bytes contain the final 12 hexadecimal digits.

GUID_t(const GUID_t &guid)

The GUID_t copy constructor.

Parameters

guid – A GUID_t object.

GUID_t(GUID_t &&guid) noexcept

The GUID_t move constructor.

Parameters

guid – A GUID_t object.

GUID_t &operator=(const GUID_t &guid) noexcept

The GUID_t copy-assignment operator.

Parameters

guid – A GUID_t object.

GUID_t &operator=(GUID_t &&guid) noexcept

The GUID_t move assignment operator.

Parameters

guid – A GUID_t object.

void to_bytes(uint8_t (&guid_bytes)[16]) const

Converts this GUID_t to an array of bytes.

Parameters

guid_bytes – A uint8_t array of 16 bytes.

std::string to_string() const

Convert this GUID_t object to a string.

Returns

This GUID_t object in a string.

std::size_t Hash() const

Calculates the size of this GUID_t object.

The output from this method is compatible with std::unordered_map.

Returns

The size of the GUID_t object in bytes.

bool operator==(GUID_t const &other) const

Tests to determine whether two GUID_t objects are equivalent (needed for maps).

Returns

A boolean value that indicates success or failure.

bool operator<(GUID_t const &other) const

Tests to determine how to sort 2 GUID_t objects

Returns

A boolean value that indicates success or failure.

Public Members

uint32_t Data1

Specifies the first eight hexadecimal digits of the GUID.

uint16_t Data2

Specifies the first group of four hexadecimal digits.

/summary>

uint16_t Data3

Specifies the second group of four hexadecimal digits.

uint8_t Data4[8]

An array of eight bytes.

The first two bytes contain the third group of four hexadecimal digits. The remaining six bytes contain the final 12 hexadecimal digits.