functional-dag
Loading...
Searching...
No Matches
fn_dag::GUID< T > Class Template Reference

(Utility) For defining a globally unique UUIDv4 identifier. More...

#include <guid_impl.hpp>

Public Member Functions

 GUID (const GUID_vals &_values)
 Wrapper of the 128 bit integer.
 
 GUID (const GUID< T > &_values)
 Copy constructor of the GUID.
 
string to_uuid () const
 Get the UUIDv4 representation of the GUID.
 

Static Public Member Functions

static expected< GUID< T >, error_codes > from_uuid (const string_view &_uuid)
 Parse a UUIDv4 representation into an internal 128bit unsigned int.
 

Public Attributes

GUID_vals m_id
 The internal UUID representation.
 

Detailed Description

template<typename T>
class fn_dag::GUID< T >

(Utility) For defining a globally unique UUIDv4 identifier.

This class is a utility that serializes a UUIDv4 to a flatbuffer uuid and back. More specificaly, UUIDs are stored as 128bit unsigned integers for speed of comparison and sorting once IDs have been turned into it's internal representation.

Constructor & Destructor Documentation

◆ GUID() [1/2]

template<typename T>
fn_dag::GUID< T >::GUID ( const GUID_vals & _values)

Wrapper of the 128 bit integer.

GUID Constructor.

Parameters
_valuesA 128bit uint to wrap.

◆ GUID() [2/2]

template<typename T>
fn_dag::GUID< T >::GUID ( const GUID< T > & _values)

Copy constructor of the GUID.

GUID Constructor.

Parameters
_valuesAnother GUID to copy.

Member Function Documentation

◆ from_uuid()

template<typename T>
expected< GUID< T >, error_codes > fn_dag::GUID< T >::from_uuid ( const string_view & _uuid)
static

Parse a UUIDv4 representation into an internal 128bit unsigned int.

This function will attempt to parse a string that contains a UUIDv4. In the event that it does not successfully parse it, an error is returned instead.

Parameters
_uuidA well formed UUIDv4 string.
Returns
An expectation of a GUID or a specific error in the event of a parsing problem.

◆ to_uuid()

template<typename T>
string fn_dag::GUID< T >::to_uuid ( ) const

Get the UUIDv4 representation of the GUID.

This function takes the internal 128bit unsigned integer and formats it as a well formed hexidecimal UUIDv4.

Returns
A well formed UUIDv4 using the underlying 128 bit integer.