dmi_registry_create
Synopsis
#include <opendmi/registry.h>
#define DMI_REGISTRY_CAPACITY 64
dmi_registry_t *dmi_registry_create(dmi_context_t *context, size_t capacity);
void dmi_registry_destroy(dmi_registry_t *registry);
Description
A registry holds the structures of a table as entities, in the order the table holds them, and indexes them by their handles in a hash table.
The dmi_registry_create function creates an empty registry bound to
context, with a hash table of capacity cells. The capacity only tells
how long the chains of the cells grow, and does not limit the number of
structures the registry holds.
A context creates a registry of its own as it is opened, fills it with the
structures of its table, and destroys it as it is closed; the program gets
it with dmi_get_registry, and neither creates nor destroys it. The
functions which fill a registry are internal to the library, so a registry
created by the program stays empty.
The dmi_registry_destroy function destroys a registry along with the
entities it holds, so the entities obtained from it must not be used after
that. Passing nullptr does nothing.
Return value
On success, dmi_registry_create returns the registry. On failure, which
happens if context is nullptr or if memory is exhausted, it returns
nullptr.