deCONZ C++ API v2.6.1
Loading...
Searching...
No Matches
Atoms

Atoms refer to strings which are allocated once and are stored in the atom table for the lifetime of the application. More...

Classes

struct  AT_Atom
 Represents an atom which is uniquely stored in the atom table. More...
 
struct  AT_AtomIndex
 A unique index referencing a atom. More...
 

Macros

#define AT_MAX_ATOM_SIZE   384
 Maximum size of an atom.
 

Typedefs

typedef struct AT_Atom AT_Atom
 
typedef struct AT_AtomIndex AT_AtomIndex
 

Functions

DECONZ_DLLSPEC void AT_Init (unsigned max_atoms)
 Initialize atom table, called by core.
 
DECONZ_DLLSPEC void AT_Destroy (void)
 Destroyes atom table, called by core.
 
DECONZ_DLLSPEC int AT_AddAtomString (const void *data)
 Adds an atom from zero terminated C-String.
 
DECONZ_DLLSPEC int AT_AddAtom (const void *data, unsigned size, AT_AtomIndex *ati)
 Adds an atom with data and size.
 
DECONZ_DLLSPEC int AT_GetAtomIndex (const void *data, unsigned size, AT_AtomIndex *ati)
 Returns the atom index for given data.
 
DECONZ_DLLSPEC AT_Atom AT_GetAtomByIndex (AT_AtomIndex ati)
 Returns the atom for given index.
 

Detailed Description

Atoms refer to strings which are allocated once and are stored in the atom table for the lifetime of the application.

They can be referenced by a unique and stable index.

Function Documentation

◆ AT_AddAtom()

DECONZ_DLLSPEC int AT_AddAtom ( const void *  data,
unsigned  size,
AT_AtomIndex ati 
)

Adds an atom with data and size.

This function can be called multiple times, the atom will only be added once.

Parameters
datathe data of the atom (doesn't need to be zero terminated)
sizesize of the data
atipointer to atom index which will be set on success
Returns
1 on success

◆ AT_AddAtomString()

DECONZ_DLLSPEC int AT_AddAtomString ( const void *  data)

Adds an atom from zero terminated C-String.

Parameters
dataa zero terminated C-string
Returns
1 on success

◆ AT_GetAtomByIndex()

DECONZ_DLLSPEC AT_Atom AT_GetAtomByIndex ( AT_AtomIndex  ati)

Returns the atom for given index.

Parameters
atia atom index
Returns
a valid atom if found, or zero length atom if not found

◆ AT_GetAtomIndex()

DECONZ_DLLSPEC int AT_GetAtomIndex ( const void *  data,
unsigned  size,
AT_AtomIndex ati 
)

Returns the atom index for given data.

Parameters
datathe data of the atom (doesn't need to be zero terminated)
sizesize of the data
atipointer to atom index which will be set on success
Returns
1 on success