Universally Unique Identifier (UUID) API
Collaboration diagram for Universally Unique Identifier (UUID) API:

Functions

void rdm_uuidInit (RDM_UUID_FACTORY_T *factory, uint32_t seed)
void rdm_uuidTerm (RDM_UUID_FACTORY_T *factory)
void rdm_uuidCreate (RDM_UUID_FACTORY_T *factory, RDM_UUID_T *uuid)
RDM_RETCODE rdm_uuidFromString (const char *str, RDM_UUID_T *uuid)
size_t rdm_uuidStrLen (const RDM_UUID_T *uuid, bool braces)
RDM_RETCODE rdm_uuidToString (const RDM_UUID_T *uuid, char *str, size_t len, bool braces)
RDM_RETCODE rdm_uuidToStringEx (const RDM_UUID_T *uuid, char *str, size_t len, bool braces, size_t *bytesOut)

Detailed Description

The RaimaDB uuid datatype API. The functions here are located in RaimaDB Base Functionality. Linker option:

    -lrdmbase

The UUID/GUID types represent 128-bit unique identifiers. The implementation of UUID/GUID is represented by the RFC 4122 standard

Function Documentation

rdm_uuidCreate()

void rdm_uuidCreate ( RDM_UUID_FACTORY_T * factory,
RDM_UUID_T * uuid
)

#include <rdmuuidapi.h>

Create a Universally Unique Identifier (UUID)

This function is able to create a universally unique identifier with a very high probability.

See also
rdm_uuidInit
rdm_uuidToString
rdm_uuidFromString
rdm_uuidTerm
Parameters
factory [IN] The factory to use for creating UUIDs
uuid [OUT] The Universally Unique Identifier to be creasted

rdm_uuidFromString()

RDM_RETCODE rdm_uuidFromString ( const char * str,
RDM_UUID_T * uuid
)

#include <rdmuuidapi.h>

Convert a string to a Universally Unique Identifier (UUID)

Convert a string to a Universally Unique Identifier (UUID).

Return values
sOKAY Normal, successful return.
ePSP_INVUUID Invalid UUID in the PSP library.
See also
rdm_uuidToString
rdm_uuidCreate
Parameters
str [IN] The UUID in string form that is to be converted
uuid [OUT] The converted UUID

rdm_uuidInit()

void rdm_uuidInit ( RDM_UUID_FACTORY_T * factory,
uint32_t seed
)

#include <rdmuuidapi.h>

Create a Universally Unique Identifier (UUID)

This function sets up a factory for creating universally unique identifier with a very high probability of being unique. One factory is very unlikely to generate two identical UUIDs.

The initial state of the factory is based on a seed and some information from the PSP layer such as the current time, the process ID, and the MAC address. Excactly which information is being used depend on the PSP and is therefor platform dependent.

Care should be taken to not use more than one factory for UUIDs that need to be unique. There is never an absolute guarantee that the generated UUIDs will be unique even with a single factory.

See also
rdm_uuidCreate
rdm_uuidTerm
Parameters
factory [IN] The factory to use for creating UUIDs
seed [IN] A seed that will be combined with other information from the PSP

rdm_uuidStrLen()

size_t rdm_uuidStrLen ( const RDM_UUID_T * uuid,
bool braces
)

#include <rdmuuidapi.h>

Get the string length of a Universally Unique Identifier (UUID)

Get the string length of a Universally Unique Identifier if it were to be converted to a string.

Returns
The string length, if converted to a string
See also
rdm_uuidToString
Parameters
uuid [IN] The UUID we want the string length off if converted to a string
braces [IN] Whether the converted string should include braces

rdm_uuidTerm()

void rdm_uuidTerm ( RDM_UUID_FACTORY_T * factory )

#include <rdmuuidapi.h>

Create a Universally Unique Identifier (UUID)

This function terminates a factory for creating universally unique identifier

See also
rdm_uuidCreate
rdm_uuidInit
Parameters
factory [IN] The factory to be terminated

rdm_uuidToString()

RDM_RETCODE rdm_uuidToString ( const RDM_UUID_T * uuid,
char * str,
size_t len,
bool braces
)

#include <rdmuuidapi.h>

Convert a Universally Unique Identifier (UUID) to a string

Convert a Universally Unique Identifier (UUID) to a string. The string buffer provided should be big enough to hold at least 36 characters, plus the optional braces, and a null terminator.

Return values
sOKAY Normal, successful return.
sTRUNCATE Result is truncated.
See also
rdm_uuidStrLen
rdm_uuidFromString
rdm_uuidCreate
Parameters
uuid [IN] The UUID that is to be converted
str [OUT] The string buffer for the converted UUID
len [IN] The lengt of the provided string buffer measured in number of characters
braces [IN] Whether the converted string should include braces

rdm_uuidToStringEx()

RDM_RETCODE rdm_uuidToStringEx ( const RDM_UUID_T * uuid,
char * str,
size_t len,
bool braces,
size_t * bytesOut
)

#include <rdmuuidapi.h>

Parameters
uuid [IN] The UUID that is to be converted
str [OUT] The string buffer for the converted UUID
len [IN] The lengt of the provided string buffer measured in number of characters
braces [IN] Whether the converted string should include braces
bytesOut [OUT] The number of bytes written to str