Web Analytics Made Easy - Statcounter
Skip to content

Class SBCContainerUUID#

ClassList > SBCContainerUUID

This class describes a universally unique identifier (UUID). More...

  • #include <SBCContainerUUID.hpp>

Public Attributes#

Type Name
std::array< uint8_t, 16 > data

Public Static Attributes#

Type Name
SBCContainerUUID invalid
An empty invalid UUID object (equal to SBCContainerUUID() )

Public Functions#

Type Name
SBCContainerUUID (const std::array< uint8_t, 16 > & data)
Constructs a UUID from internal data.
SBCContainerUUID (const std::string & uuid)
Constructs a UUID from a std::string.
SBCContainerUUID (const SBCContainerUUID & other)
Copy constructor.
SBCContainerUUID (SBCContainerUUID && other) noexcept
Move constructor.
SBCContainerUUID () noexcept
Constructs an invalid UUID.
bool isValid () noexcept const
Returns true if and only if the UUID is valid.
bool operator!= (const SBCContainerUUID & other) const
Inequality operator.
std::string operator() () const
Returns the UUID in string format.
SBCContainerUUID & operator++ ()
Prefix increment operator.
SBCContainerUUID operator++ (int)
Postfix increment operator.
SBCContainerUUID & operator-- ()
Prefix decrement operator.
SBCContainerUUID operator-- (int)
Postfix decrement operator.
bool operator< (const SBCContainerUUID & other) const
Lexicographic comparison with another UUID.
SBCContainerUUID & operator= (const SBCContainerUUID & other)
Copy assignment operator.
SBCContainerUUID & operator= (SBCContainerUUID && other) noexcept
Move assignment operator.
bool operator== (const SBCContainerUUID & other) const
Equality operator.
virtual ~SBCContainerUUID ()
Destructs the UUID.

Detailed Description#

SBCContainerUUID objects can hold Universally Unique IDs (UUIDs), which are used to identify classes and SAMSON Extensions. In many cases, UUIDs are automatically generated thanks to the SAMSON Extension Generator.

UUIDs may be used e.g. to retrieve class proxies:

SBCClassProxy*  classProxy = nullptr;
std::string     className("ClassName");
std::string     elementName("ElementName");
SBUUID          elementUUID("0CE16BE8-8AA1-75C4-31A8-B3FA1CE93A94");

// retrieve a class proxy

classProxy = SAMSON::getProxy(className, elementName, elementUUID);

When necessary, SBDTypeRandom can be used to generate UUIDs :

SBRandom    randomGenerator;
SBUUID      randomUUID = randomGenerator.randUUID();

Short name: SBUUID

See also: Identifiers, SAMSON Extension Generator, SBDTypeRandom

Public Attributes Documentation#

variable data#

std::array<uint8_t, 16> SBCContainerUUID::data;

Public Static Attributes Documentation#

variable invalid#

An empty invalid UUID object (equal to SBCContainerUUID() )

SBCContainerUUID SBCContainerUUID::invalid;


Public Functions Documentation#

function SBCContainerUUID [1/5]#

Constructs a UUID from internal data.

explicit SBCContainerUUID::SBCContainerUUID (
    const std::array< uint8_t, 16 > & data
) 

Initializes the UUID with the provided 16-byte array representing the UUID value.

Parameters:

  • data A 16-element array containing the raw UUID bytes.

function SBCContainerUUID [2/5]#

Constructs a UUID from a std::string.

SBCContainerUUID::SBCContainerUUID (
    const std::string & uuid
) 

Constructs a UUID from a string representation.

Parses a UUID string in the standard 36-character format (e.g., "123e4567-e89b-12d3-a456-426614174000"). If the string is not a valid UUID, the resulting object is set to an invalid state.

Parameters:

  • uuid The string containing the UUID.

function SBCContainerUUID [3/5]#

Copy constructor.

SBCContainerUUID::SBCContainerUUID (
    const SBCContainerUUID & other
) 

Constructs a new UUID as a copy of an existing UUID.

Parameters:

  • other The UUID to copy.

function SBCContainerUUID [4/5]#

Move constructor.

SBCContainerUUID::SBCContainerUUID (
    SBCContainerUUID && other
) noexcept

Constructs a new UUID by moving the data from another UUID.

Parameters:

  • other The UUID to move.

function SBCContainerUUID [5/5]#

Constructs an invalid UUID.

SBCContainerUUID::SBCContainerUUID () noexcept

Creates a UUID object that is considered invalid. It can be used as a sentinel value.


function isValid#

Returns true if and only if the UUID is valid.

bool SBCContainerUUID::isValid () noexcept const

Checks whether the UUID is valid.

Determines if the UUID holds a valid value (i.e., not the sentinel invalid UUID).

Returns:

true if the UUID is valid, false otherwise.


function operator!=#

Inequality operator.

bool SBCContainerUUID::operator!= (
    const SBCContainerUUID & other
) const

Checks whether this UUID is not equal to another UUID.

Parameters:

  • other The UUID to compare with.

Returns:

true if the UUIDs are different, false otherwise.


function operator()#

Returns the UUID in string format.

std::string SBCContainerUUID::operator() () const

Returns the string representation of the UUID.

Formats the UUID as a 36-character string in the standard representation.

Returns:

The UUID as a string in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".


function operator++#

Prefix increment operator.

SBCContainerUUID & SBCContainerUUID::operator++ () 

Increments the UUID lexicographically.

Returns:

Reference to this UUID after increment.


function operator++#

Postfix increment operator.

SBCContainerUUID SBCContainerUUID::operator++ (
    int
) 

Returns a copy of the UUID before it is incremented lexicographically.

Returns:

The original UUID value before increment.


function operator--#

Prefix decrement operator.

SBCContainerUUID & SBCContainerUUID::operator-- () 

Decrements the UUID lexicographically.

Returns:

Reference to this UUID after decrement.


function operator--#

Postfix decrement operator.

SBCContainerUUID SBCContainerUUID::operator-- (
    int
) 

Returns a copy of the UUID before it is decremented lexicographically.

Returns:

The original UUID value before decrement.


function operator<#

Lexicographic comparison with another UUID.

bool SBCContainerUUID::operator< (
    const SBCContainerUUID & other
) const

Less-than operator.

Performs a lexicographic comparison between this UUID and another.

Parameters:

  • other The UUID to compare with.

Returns:

true if this UUID is lexicographically less than other, false otherwise.


function operator=#

Copy assignment operator.

SBCContainerUUID & SBCContainerUUID::operator= (
    const SBCContainerUUID & other
) 

Assigns the value of another UUID to this one.

Parameters:

  • other The UUID to assign from.

Returns:

Reference to this UUID after assignment.


function operator=#

Move assignment operator.

SBCContainerUUID & SBCContainerUUID::operator= (
    SBCContainerUUID && other
) noexcept

Moves the value of another UUID into this one.

Parameters:

  • other The UUID to move from.

Returns:

Reference to this UUID after assignment.


function operator==#

Equality operator.

bool SBCContainerUUID::operator== (
    const SBCContainerUUID & other
) const

Checks whether this UUID is equal to another UUID.

Parameters:

  • other The UUID to compare with.

Returns:

true if the UUIDs are equal, false otherwise.


function ~SBCContainerUUID#

Destructs the UUID.

virtual SBCContainerUUID::~SBCContainerUUID () 

Destructor.

Destroys the UUID object.