Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
luid.h File Reference

Lumiera unique object identifier. More...

Go to the source code of this file.

Description

Lumiera unique object identifier.

Lumiera unique identifiers are 128 byte random values. Unlike standard uuid's we don't tag a version within them and we may store generic pointers within the storage space occupied by an LUID.

Due to the extremely huge number space, LUID values can be used as unique identifiers without the need to check for duplicates or collisions. At various places, LUIDs are thus used right away on creation of new object instances or elements, in case a distinguishable object identity is required, e.g.

  • any new attachment of an object into the session ("placement")
  • unique output designation discovered during the translation into a low-level node graph ("builder")
  • interface slots for external binding and plug-ins

Moreover, there is a Luidgen tool to generate fixed LUIDs to be included into source code. It works by replacing the token LUIDGEN in the source code text by a newly generated (random) LUID in octal representation.

LUIDs can also be used to generate hash values for hash table storage.

See also
HashIndexed Adapter for including a LUID into an object
Placement usage example
luidgen.c
hash-util.h hash type definitions

Definition in file luid.h.

#include "lib/hash-value.h"
#include <stdlib.h>

Macros

#define LUMIERA_UID_INITIALIZER(l)
 
#define LUMIERA_UID_FMT
 
#define LUMIERA_UID_CHAR(l, n)   ((unsigned char*)l)[n]
 
#define LUMIERA_UID_ELEMENTS(l)
 
#define LUIDGEN   PLEASE_RUN_THE_LUIDGEN_TOOL_ON_THIS_FILE
 LUIDGEN will be replaced by the 'luidgen' tool with a random uuid.
 

Functions

void * lumiera_uid_ptr_get (const lumiera_uid *luid)
 Retrieve a generic pointer stored in a luid.
 
void lumiera_uid_gen (lumiera_uid *luid)
 Generate a new luid.
 
void lumiera_uid_set_ptr (lumiera_uid *luid, void *ptr)
 Store a generic pointer in a luid.
 
void lumiera_uid_copy (lumiera_uid *dest, lumiera_uid *src)
 Copy an luid.
 
int lumiera_uid_eq (const lumiera_uid *luida, const lumiera_uid *luidb)
 Test 2 luid's for equality.
 
size_t lumiera_uid_hash (const lumiera_uid *luid)
 Generate a hash sum over an luid.
 

Macro Definition Documentation

◆ LUMIERA_UID_INITIALIZER

#define LUMIERA_UID_INITIALIZER (   l)
Value:
{ \
l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7], \
l[8], l[9], l[10], l[11], l[12], l[13], l[14], l[15] \
}

Definition at line 60 of file luid.h.

◆ LUMIERA_UID_FMT

#define LUMIERA_UID_FMT
Value:
"\\%.3hho\\%.3hho\\%.3hho\\%.3hho" \
"\\%.3hho\\%.3hho\\%.3hho\\%.3hho" \
"\\%.3hho\\%.3hho\\%.3hho\\%.3hho" \
"\\%.3hho\\%.3hho\\%.3hho\\%.3hho"

Definition at line 69 of file luid.h.

◆ LUMIERA_UID_CHAR

#define LUMIERA_UID_CHAR (   l,
 
)    ((unsigned char*)l)[n]

Definition at line 75 of file luid.h.

◆ LUMIERA_UID_ELEMENTS

#define LUMIERA_UID_ELEMENTS (   l)
Value:
LUMIERA_UID_CHAR(l,4), LUMIERA_UID_CHAR(l,5), LUMIERA_UID_CHAR(l,6), LUMIERA_UID_CHAR(l,7), \
LUMIERA_UID_CHAR(l,8), LUMIERA_UID_CHAR(l,9), LUMIERA_UID_CHAR(l,10), LUMIERA_UID_CHAR(l,11), \
LUMIERA_UID_CHAR(l,12), LUMIERA_UID_CHAR(l,13), LUMIERA_UID_CHAR(l,14), LUMIERA_UID_CHAR(l,15)
#define LUMIERA_UID_CHAR(l, n)
Definition luid.h:75

Definition at line 78 of file luid.h.

◆ LUIDGEN

#define LUIDGEN   PLEASE_RUN_THE_LUIDGEN_TOOL_ON_THIS_FILE

LUIDGEN will be replaced by the 'luidgen' tool with a random uuid.

Definition at line 87 of file luid.h.

Function Documentation

◆ lumiera_uid_ptr_get()

void * lumiera_uid_ptr_get ( const lumiera_uid luid)

Retrieve a generic pointer stored in a luid.

Definition at line 41 of file luid.c.

Referenced by main().

+ Here is the caller graph for this function:

◆ lumiera_uid_gen()

void lumiera_uid_gen ( lumiera_uid luid)

Generate a new luid.

Definition at line 48 of file luid.c.

References NULL.

Referenced by LuidH::LuidH(), and main().

+ Here is the caller graph for this function:

◆ lumiera_uid_set_ptr()

void lumiera_uid_set_ptr ( lumiera_uid luid,
void *  ptr 
)

Store a generic pointer in a luid.

Definition at line 33 of file luid.c.

Referenced by lib::idi::anonymous_namespace{entry-id.hpp}::buildHash(), and main().

+ Here is the caller graph for this function:

◆ lumiera_uid_copy()

void lumiera_uid_copy ( lumiera_uid dest,
lumiera_uid src 
)

Copy an luid.

Definition at line 90 of file luid.c.

Referenced by HashIndexed_test::checkLUID_passing(), and main().

+ Here is the caller graph for this function:

◆ lumiera_uid_eq()

int lumiera_uid_eq ( const lumiera_uid luida,
const lumiera_uid luidb 
)

Test 2 luid's for equality.

Definition at line 97 of file luid.c.

Referenced by lumiera_invokey_eq(), main(), and LuidH::operator==().

+ Here is the caller graph for this function:

◆ lumiera_uid_hash()

size_t lumiera_uid_hash ( const lumiera_uid luid)

Generate a hash sum over an luid.

Definition at line 103 of file luid.c.

Referenced by LuidH::LuidH(), and LuidH::operator HashVal().

+ Here is the caller graph for this function: