A 128-bit universally unique identifier (UUID).
More...
#include <Uuid.h>
|
| Uuid () |
| Instantiates a new random uuid.
|
|
| Uuid (__m128i uuid) |
| Instantiates a new uuid from a 128-bit number.
|
|
| Uuid (const uint8_t *bytes) |
| Instantiates a new uuid from a byte string.
|
|
| Uuid (const std::string &bytes) |
| Instantiates a new uuid from a byte string.
|
|
| Uuid (const Uuid &other) |
|
| Uuid (Uuid &&other) noexcept |
|
Uuid & | operator= (const Uuid &other) |
|
Uuid & | operator= (Uuid &&other) noexcept |
|
bool | operator== (const Uuid &other) const |
|
bool | operator!= (const Uuid &other) const |
|
std::string | bytes () const |
| Serializes the uuid to a byte std::string (16 bytes).
|
|
std::string | str () const |
| Converts the uuid to its string representation.
|
|
void | str (char *res) const |
| Converts the uuid to its string representation.
|
|
|
std::ostream & | operator<< (std::ostream &os, const Uuid &uuid) |
|
std::size_t | hash_value (const Uuid &obj) |
| Hashes the uuid.
|
|
A 128-bit universally unique identifier (UUID).
Uses Uses SIMD (Single Instruction Multiple Data) with Intel's AVX2 instruction set to generate UUIDs. UUIDs are stored as a 16-byte array, representing a 128-bit number in memory.
See: https://www.rfc-editor.org/rfc/rfc4122
◆ Uuid() [1/3]
spark::lib::Uuid::Uuid |
( |
__m128i | uuid | ) |
|
|
explicit |
Instantiates a new uuid from a 128-bit number.
- Parameters
-
uuid | The 128-bit number to use as uuid. |
◆ Uuid() [2/3]
spark::lib::Uuid::Uuid |
( |
const uint8_t * | bytes | ) |
|
|
explicit |
Instantiates a new uuid from a byte string.
- Parameters
-
bytes | A raw array of bytes (size 16) containing the uuid. |
◆ Uuid() [3/3]
spark::lib::Uuid::Uuid |
( |
const std::string & | bytes | ) |
|
|
explicit |
Instantiates a new uuid from a byte string.
- Parameters
-
bytes | A std::string containing the uuid. |
◆ bytes()
std::string spark::lib::Uuid::bytes |
( |
| ) |
const |
|
nodiscard |
Serializes the uuid to a byte std::string (16 bytes).
- Returns
- The std::string containing the 16 bytes of the uuid.
◆ str() [1/2]
std::string spark::lib::Uuid::str |
( |
| ) |
const |
|
nodiscard |
Converts the uuid to its string representation.
- Returns
- The std::string representation of the uuid.
◆ str() [2/2]
void spark::lib::Uuid::str |
( |
char * | res | ) |
const |
Converts the uuid to its string representation.
- Parameters
-
res | A char array of size 36 to store the result in. |
◆ hash_value
std::size_t hash_value |
( |
const Uuid & | obj | ) |
|
|
friend |
Hashes the uuid.
- Parameters
-
- Returns
- The hashed representation of the uuid.