Zephyr Project API  3.4.0
A Scalable Open Source RTOS
hash_map_api.h File Reference

Hashmap (Hash Table) API. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <zephyr/sys/hash_function.h>
#include <zephyr/sys/util.h>

Go to the source code of this file.

Data Structures

struct  sys_hashmap_iterator
 Generic Hashmap iterator interface. More...
 
struct  sys_hashmap_api
 Generic Hashmap API. More...
 
struct  sys_hashmap_config
 Generic Hashmap configuration. More...
 
struct  sys_hashmap_data
 Generic Hashmap data. More...
 

Macros

#define SYS_HASHMAP_CONFIG(_max_size, _load_factor)
 Initializer for sys_hashmap_config. More...
 

Typedefs

typedef void *(* sys_hashmap_allocator_t) (void *ptr, size_t new_size)
 Allocator interface for sys_hashmap. More...
 
typedef void(* sys_hashmap_iterator_t) (const struct sys_hashmap *map, struct sys_hashmap_iterator *it)
 In-place iterator constructor for sys_hashmap. More...
 
typedef void(* sys_hashmap_callback_t) (uint64_t key, uint64_t value, void *cookie)
 Callback interface for sys_hashmap. More...
 
typedef void(* sys_hashmap_clear_t) (struct sys_hashmap *map, sys_hashmap_callback_t cb, void *cookie)
 Clear all entries contained in a sys_hashmap. More...
 
typedef int(* sys_hashmap_insert_t) (struct sys_hashmap *map, uint64_t key, uint64_t value, uint64_t *old_value)
 Insert a new entry into a sys_hashmap. More...
 
typedef bool(* sys_hashmap_remove_t) (struct sys_hashmap *map, uint64_t key, uint64_t *value)
 Remove an entry from a sys_hashmap. More...
 
typedef bool(* sys_hashmap_get_t) (const struct sys_hashmap *map, uint64_t key, uint64_t *value)
 Get a value from a sys_hashmap. More...
 

Functions

static bool sys_hashmap_iterator_has_next (const struct sys_hashmap_iterator *it)
 Check if a Hashmap iterator has a next entry. More...
 

Detailed Description

Hashmap (Hash Table) API.

Hashmaps (a.k.a Hash Tables) sacrifice space for speed. All operations on a Hashmap (insert, delete, search) are O(1) complexity (on average).