Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::UUID Class Reference

A class representing a Universally Unique Identifier (UUID). More...

#include <UUID.h>

Public Member Functions

CORE_API UUID ()
 Default constructor for UUID.
CORE_API UUID (UUIDTag tag)
 Constructor for UUID with a specific value.
CORE_API UUID (u64 uuid)
 Constructor for UUID with a specific value.
CORE_API UUID (u64 uuid, UUIDTag tag)
CORE_API UUID (const UUID &)=default
 Copy constructor for UUID.
CORE_API UUIDoperator= (const UUID &)=default
 Assignment operator for UUID.
constexpr operator u64 () const
 Implicit conversion operator to u64.
constexpr bool operator== (const UUID &) const noexcept=default
constexpr auto operator<=> (const UUID &) const noexcept=default
const char * ToHex () const
 Return the UUID as a hexadecimal string.

Detailed Description

A class representing a Universally Unique Identifier (UUID).

The UUID class is responsible for creating and managing universally unique identifiers. These identifiers are crucial for distinguishing objects across different systems or sessions. The class provides mechanisms for creating UUIDs, comparing them, and converting between UUIDs and their underlying 64-bit representation.

Key features:

  • Default constructor generates a random UUID.
  • Option to initialize a UUID with a specific 64-bit value.
  • Comparison and assignment operators for ease of use.
  • Implicit conversion to u64, enabling smooth integration with systems expecting a 64-bit identifier.

Typical usage:

  1. Use the default constructor to generate a new UUID: UUID uuid;
  2. Alternatively, initialize with a specific value: UUID uuid(123456789);
  3. Compare UUIDs using == or store them in data structures requiring unique keys.
Note
  • The UUID is internally stored as a 64-bit unsigned integer.
  • Custom hash function is provided for easy use in hash-based containers such as std::unordered_map.

Constructor & Destructor Documentation

◆ UUID() [1/5]

Raven::UUID::UUID ( )

Default constructor for UUID.

This constructor generates a random UUID.

◆ UUID() [2/5]

Raven::UUID::UUID ( UUIDTag tag)
explicit

Constructor for UUID with a specific value.

This constructor initializes the UUID with the given tag.

Parameters
tagwhat kind of UUID.

◆ UUID() [3/5]

Raven::UUID::UUID ( u64 uuid)
explicit

Constructor for UUID with a specific value.

This constructor initializes the UUID with a given 64-bit unsigned integer.

Parameters
uuidThe 64-bit unsigned integer to initialize the UUID.

◆ UUID() [4/5]

Raven::UUID::UUID ( u64 uuid,
UUIDTag tag )
explicit

◆ UUID() [5/5]

CORE_API Raven::UUID::UUID ( const UUID & )
default

Copy constructor for UUID.

This constructor creates a new UUID as a copy of another UUID.

Member Function Documentation

◆ operator u64()

Raven::UUID::operator u64 ( ) const
inlineconstexpr

Implicit conversion operator to u64.

This operator allows the UUID to be used as a 64-bit unsigned integer.

Note
This conversion is implicit, allowing the UUID to be used in contexts
Returns
The UUID as a 64-bit unsigned integer.

◆ operator<=>()

auto Raven::UUID::operator<=> ( const UUID & ) const
constexprdefaultnoexcept

◆ operator=()

CORE_API UUID & Raven::UUID::operator= ( const UUID & )
default

Assignment operator for UUID.

This operator assigns the value of another UUID to this one.

Returns
A reference to this UUID.

◆ operator==()

bool Raven::UUID::operator== ( const UUID & ) const
constexprdefaultnoexcept

◆ ToHex()

const char * Raven::UUID::ToHex ( ) const
inline

Return the UUID as a hexadecimal string.

Returns
The UUID as a hex string.

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