Expose module registry

This commit is contained in:
Vftdan 2024-08-18 14:44:39 +02:00
parent 68a189dba1
commit 5969a1df8e
2 changed files with 12 additions and 3 deletions

View File

@ -1,7 +1,6 @@
#include "module_registry.h"
#include "hash_table.h"
static TYPED_HASH_TABLE(GraphNodeSpecification*) registry;
static GraphNodeSpecificationRegistry registry;
static bool initialized = false;
static void
@ -34,7 +33,13 @@ lookup_graph_node_specification(const char * name)
return registry.value_array[idx];
}
void
const GraphNodeSpecificationRegistry *
get_graph_node_specification_registy()
{
ensure_initialized();
return &registry;
}
__attribute__((destructor)) void
destroy_graph_node_specification_registry()
{

View File

@ -2,9 +2,13 @@
#define MODULE_REGISTRY_H_
#include "graph.h"
#include "hash_table.h"
typedef TYPED_HASH_TABLE(GraphNodeSpecification*) GraphNodeSpecificationRegistry;
void register_graph_node_specification(GraphNodeSpecification * spec);
GraphNodeSpecification * lookup_graph_node_specification(const char * name);
void destroy_graph_node_specification_registry();
const GraphNodeSpecificationRegistry * get_graph_node_specification_registy();
#endif /* end of include guard: MODULE_REGISTRY_H_ */