Taskolib
1.3.3
|
An unsigned 64-bit integer for use as a unique ID.
#include <UniqueId.h>
Public Types | |
using | ValueType = std::uint64_t |
Public Member Functions | |
UniqueId () | |
Default-construct a random unique ID. More... | |
UniqueId (ValueType id) | |
Construct a unique ID from a given integer. More... | |
Static Public Member Functions | |
static gul14::optional< UniqueId > | from_string (gul14::string_view str) |
Create a unique ID from the given string, returning an empty optional if the string does not represent a valid hexadecimal number. More... | |
Private Attributes | |
ValueType | id_ |
Static Private Attributes | |
static thread_local std::mt19937_64 | random_number_generator_ { std::random_device{}() } |
Friends | |
bool | operator== (UniqueId a, UniqueId b) |
Determine if two unique IDs are equal. More... | |
bool | operator!= (UniqueId a, UniqueId b) |
Determine if two unique IDs are different. More... | |
std::string | to_string (UniqueId uid) |
Return a hexadecimal string representation of the given unique ID. More... | |
using task::UniqueId::ValueType = std::uint64_t |
task::UniqueId::UniqueId | ( | ) |
Default-construct a random unique ID.
References id_, and random_number_generator_.
|
explicit |
Construct a unique ID from a given integer.
|
static |
Create a unique ID from the given string, returning an empty optional if the string does not represent a valid hexadecimal number.
The string must represent a hexadecimal number with a maximum of 16 characters. Neither leading whitespace nor a "0x" prefix are allowed.
Referenced by task::SequenceManager::parse_folder_name().
|
friend |
Return a hexadecimal string representation of the given unique ID.
|
private |
Referenced by UniqueId().
|
staticprivate |
Referenced by UniqueId().