22 #ifndef ETCPAL_HANDLE_MANAGER_H_
23 #define ETCPAL_HANDLE_MANAGER_H_
void init_int_handle_manager(IntHandleManager *manager, int max_value, HandleValueInUseFunction value_in_use_func, void *context)
Initialize an IntHandleManager instance.
Definition: handle_manager.c:33
int get_next_int_handle(IntHandleManager *manager)
Once the int handle manager is initialized, this is used to get the next handle value.
Definition: handle_manager.c:53
bool(* HandleValueInUseFunction)(int handle_val, void *context)
A pointer to a function that tests if a given handle value is currently assigned to a resource.
Definition: handle_manager.h:50
struct IntHandleManager IntHandleManager
State for managing generic integer handle values.
State for managing generic integer handle values.
Definition: handle_manager.h:54
int last_handle
The last handle that was handed out, or -1 if none have been handed out yet.
Definition: handle_manager.h:56
bool check_value_in_use
Optimize the handle generation algorithm by tracking whether the handle value has wrapped around.
Definition: handle_manager.h:63
HandleValueInUseFunction value_in_use
Function pointer to determine if a handle value is currently in use.
Definition: handle_manager.h:66
void * context
A context passed to the value in use function.
Definition: handle_manager.h:68
int max_value
Determines a custom wrap-around point.
Definition: handle_manager.h:59