sdi_toolBox
Functions
sdi_toolBox::desktop::utils::uuid Namespace Reference

Utility functions for UUID and unique identifier generation. More...

Functions

std::string uniqid (bool moreEntropy=false)
 Generate a unique identifier based on the current time (microseconds).
 
std::string v4 ()
 Generate a random UUID (version 4).
 
std::string v7 ()
 Generate a time-ordered UUID (version 7).
 

Detailed Description

Utility functions for UUID and unique identifier generation.

Provides functions to generate unique identifiers in various formats:

Function Documentation

◆ uniqid()

std::string uniqid ( bool  moreEntropy = false)
inline

Generate a unique identifier based on the current time (microseconds).

Produces a string identifier derived from the current timestamp in microseconds. If moreEntropy is true, additional random bytes are appended to increase uniqueness (useful when multiple identifiers are generated in quick succession).

Parameters
moreEntropyIf true, append extra random entropy to the identifier.
Returns
std::string Generated identifier (ASCII string, format not strictly defined).

Definition at line 70 of file uuid.h.

◆ v4()

std::string v4 ( )
inline

Generate a random UUID (version 4).

Produces a RFC 4122 compliant UUID version 4 using random data. The returned string uses the canonical textual representation: "8-4-4-4-12" hexadecimal digits.

Returns
std::string UUID v4 as a text string.

Definition at line 101 of file uuid.h.

◆ v7()

std::string v7 ( )
inline

Generate a time-ordered UUID (version 7).

Produces a UUID v7 combining a timestamp and random bits to allow roughly time-ordered identifiers while keeping sufficient entropy for uniqueness. The returned string uses the canonical textual representation: "8-4-4-4-12" hexadecimal digits.

Note
UUID v7 is a newer specification intended for sortable UUIDs.
Returns
std::string UUID v7 as a text string.

Definition at line 145 of file uuid.h.