Monado OpenXR Runtime
u_hashmap.h
Go to the documentation of this file.
1 // Copyright 2019, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief Hashmap for integer values header.
6  * @author Jakob Bornecrantz <jakob@collabora.com>
7  * @ingroup aux_util
8  */
9 
10 #pragma once
11 
12 #include "xrt/xrt_compiler.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 
19 /*!
20  * @struct u_hashmap_int
21  * @ingroup aux_util
22  *
23  * A simple uint64_t key to a void pointer hashmap.
24  */
25 struct u_hashmap_int;
26 
27 typedef void (*u_hashmap_int_callback)(void *item, void *priv);
28 
29 int
30 u_hashmap_int_create(struct u_hashmap_int **out_hashmap);
31 
32 int
34 
35 int
36 u_hashmap_int_find(struct u_hashmap_int *hmi, uint64_t key, void **out_item);
37 
38 int
39 u_hashmap_int_insert(struct u_hashmap_int *hmi, uint64_t key, void *value);
40 
41 int
42 u_hashmap_int_erase(struct u_hashmap_int *hmi, uint64_t key);
43 
44 /*!
45  * First clear the hashmap and then call the given callback with each item that
46  * was in the hashmap.
47  *
48  * @ingroup aux_util
49  */
50 void
53  void *priv);
54 
55 
56 #ifdef __cplusplus
57 }
58 #endif
A simple uint64_t key to a void pointer hashmap.
Definition: u_hashmap.cpp:22
int u_hashmap_int_insert(struct u_hashmap_int *hmi, uint64_t key, void *value)
Definition: u_hashmap.cpp:63
void u_hashmap_int_clear_and_call_for_each(struct u_hashmap_int *hmi, u_hashmap_int_callback cb, void *priv)
First clear the hashmap and then call the given callback with each item that was in the hashmap...
Definition: u_hashmap.cpp:77
int u_hashmap_int_destroy(struct u_hashmap_int **hmi)
Definition: u_hashmap.cpp:43
int u_hashmap_int_erase(struct u_hashmap_int *hmi, uint64_t key)
Definition: u_hashmap.cpp:70
int u_hashmap_int_find(struct u_hashmap_int *hmi, uint64_t key, void **out_item)
Definition: u_hashmap.cpp:51
Header holding common defines.
void(* u_hashmap_int_callback)(void *item, void *priv)
Definition: u_hashmap.h:27
int u_hashmap_int_create(struct u_hashmap_int **out_hashmap)
Definition: u_hashmap.cpp:35