15 #ifndef RCUTILS__TYPES__HASH_MAP_H_ 16 #define RCUTILS__TYPES__HASH_MAP_H_ 30 struct rcutils_hash_map_impl_t;
34 struct rcutils_hash_map_impl_t *
impl;
65 #define HASH_MAP_VALIDATE_HASH_MAP(map) \ 66 RCUTILS_CHECK_ARGUMENT_FOR_NULL(map, RCUTILS_RET_INVALID_ARGUMENT); \ 67 if (NULL == map->impl) { \ 68 RCUTILS_SET_ERROR_MSG("map is not initialized"); \ 69 return RCUTILS_RET_NOT_INITIALIZED; \ 172 size_t initial_capacity,
413 const void * previous_key,
422 #endif // RCUTILS__TYPES__HASH_MAP_H_ bool rcutils_hash_map_key_exists(const rcutils_hash_map_t *hash_map, const void *key)
Get whether or not a key exists.
rcutils_ret_t rcutils_hash_map_init(rcutils_hash_map_t *hash_map, size_t initial_capacity, size_t key_size, size_t data_size, rcutils_hash_map_key_hasher_t key_hashing_func, rcutils_hash_map_key_cmp_t key_cmp_func, const rcutils_allocator_t *allocator)
Initialize a rcutils_hash_map_t, allocating space for given capacity.
int(* rcutils_hash_map_key_cmp_t)(const void *, const void *)
The function signature for a key comparison function.
Definition: hash_map.h:54
int rcutils_ret_t
Definition: rcutils_ret.h:23
size_t(* rcutils_hash_map_key_hasher_t)(const void *)
The function signature for a key hashing function.
Definition: hash_map.h:42
rcutils_ret_t rcutils_hash_map_get_size(const rcutils_hash_map_t *hash_map, size_t *size)
Get the current size of the hash_map.
struct rcutils_hash_map_impl_t * impl
Definition: hash_map.h:34
Definition: hash_map.h:32
#define RCUTILS_PUBLIC_TYPE
Definition: visibility_control.h:51
rcutils_hash_map_t rcutils_get_zero_initialized_hash_map()
Return an empty hash_map struct.
Encapsulation of an allocator.
Definition: allocator.h:45
struct rcutils_hash_map_t rcutils_hash_map_t
rcutils_ret_t rcutils_hash_map_get_next_key_and_data(const rcutils_hash_map_t *hash_map, const void *previous_key, void *key, void *data)
Get the next key in the hash_map, unless NULL is given, then get the first key.
rcutils_ret_t rcutils_hash_map_get(const rcutils_hash_map_t *hash_map, const void *key, void *data)
Get value given a key.
size_t rcutils_hash_map_string_hash_func(const void *key_str)
A hashing function for a null terminated c string.
int rcutils_hash_map_string_cmp_func(const void *val1, const void *val2)
A comparison function for a null terminated c string.
#define RCUTILS_WARN_UNUSED
Definition: macros.h:24
#define RCUTILS_PUBLIC
Definition: visibility_control.h:48
rcutils_ret_t rcutils_hash_map_set(rcutils_hash_map_t *hash_map, const void *key, const void *value)
Set a key value pair in the hash_map, increasing capacity if necessary.
rcutils_ret_t rcutils_hash_map_get_capacity(const rcutils_hash_map_t *hash_map, size_t *capacity)
Get the current capacity of the hash_map.
rcutils_ret_t rcutils_hash_map_unset(rcutils_hash_map_t *hash_map, const void *key)
Unset a key value pair in the hash_map.
rcutils_ret_t rcutils_hash_map_fini(rcutils_hash_map_t *hash_map)
Finalize the previously initialized hash_map struct.