> home > Custom Layer Boundary API

managed_id_declare

January 19th 2020
Get a unique id for a given name within a particular group

Signature

C++
Managed_ID
managed_id_declare(Application_Links* app,
                   String_Const_u8 group,
                   String_Const_u8 name);

Parameters

app

the standard custom layer context pointer

group

a name identifying a managed id group

name

a name identifying a managed id

Return

the id assigned to the given (group, name) pair

Details

When this is called for the first time for a given group, the first id returned is 1, subsequent calls with new names for an existing group return the next highest id, calls for (group, name) pairs that have already been assigned an id return the same id again. The upshot of this is that managed ids can be used to essentially create run-time allocated co-operative enums, where the group names the enum, and the names are the elements of the enum.