Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::UUID Class Reference

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

#include <UUID.h>

Public Member Functions

 UUID ()
 Default constructor for UUID.
 UUID (UUIDTag tag)
 Constructor for UUID with a specific value.
 UUID (u64 uuid)
 Constructor for UUID with a specific value.
 UUID (const UUID &)=default
 Copy constructor for UUID.
UUIDoperator= (const UUID &)=default
 Assignment operator for UUID.
 operator u64 () const
 Implicit conversion operator to u64.
bool operator== (const UUID &other) const
 Equality operator for UUID.

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/4]

Raven::UUID::UUID ( )

Default constructor for UUID.

This constructor generates a random UUID.

◆ UUID() [2/4]

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/4]

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/4]

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
inline

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=()

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 & other) const
inline

Equality operator for UUID.

This operator checks if two UUIDs are equal.

Parameters
otherThe UUID to compare with.
Returns
true if the UUIDs are equal, false otherwise.

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