Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hash_map.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/hash_map_api.h>
#include <zephyr/sys/hash_map_cxx.h>
#include <zephyr/sys/hash_map_oa_lp.h>
#include <zephyr/sys/hash_map_sc.h>

Go to the source code of this file.

Data Structures

struct  sys_hashmap
 Generic Hashmap. More...
 

Macros

#define SYS_HASHMAP_DEFINE_ADVANCED(_name, _api, _config_type, _data_type, _hash_func, _alloc_func, ...)
 Declare a Hashmap (advanced)
 
#define SYS_HASHMAP_DEFINE_STATIC_ADVANCED(_name, _api, _config_type, _data_type, _hash_func, _alloc_func, ...)
 Declare a Hashmap statically (advanced)
 
#define SYS_HASHMAP_DEFINE(_name)
 Declare a Hashmap.
 
#define SYS_HASHMAP_DEFINE_STATIC(_name)
 Declare a Hashmap statically.
 
#define SYS_HASHMAP_DEFAULT_ALLOCATOR   sys_hashmap_default_allocator
 The default Hashmap allocator.
 
#define SYS_HASHMAP_DEFAULT_LOAD_FACTOR   75
 The default Hashmap load factor (in hundredths)
 

Functions

static void * sys_hashmap_default_allocator (void *ptr, size_t size)
 
static void sys_hashmap_foreach (const struct sys_hashmap *map, sys_hashmap_callback_t cb, void *cookie)
 Iterate over all values contained in a sys_hashmap.
 
static void sys_hashmap_clear (struct sys_hashmap *map, sys_hashmap_callback_t cb, void *cookie)
 Clear all entries contained in a sys_hashmap.
 
static int sys_hashmap_insert (struct sys_hashmap *map, uint64_t key, uint64_t value, uint64_t *old_value)
 Insert a new entry into a sys_hashmap.
 
static bool sys_hashmap_remove (struct sys_hashmap *map, uint64_t key, uint64_t *value)
 Remove an entry from a sys_hashmap.
 
static bool sys_hashmap_get (const struct sys_hashmap *map, uint64_t key, uint64_t *value)
 Get a value from a sys_hashmap.
 
static bool sys_hashmap_contains_key (const struct sys_hashmap *map, uint64_t key)
 Check if map contains a value associated with key.
 
static size_t sys_hashmap_size (const struct sys_hashmap *map)
 Query the number of entries contained within map.
 
static bool sys_hashmap_is_empty (const struct sys_hashmap *map)
 Check if map is empty.
 
static uint8_t sys_hashmap_load_factor (const struct sys_hashmap *map)
 Query the load factor of map.
 
static size_t sys_hashmap_num_buckets (const struct sys_hashmap *map)
 Query the number of buckets used in map.
 
static bool sys_hashmap_should_rehash (const struct sys_hashmap *map, bool grow, size_t num_reserved, size_t *new_num_buckets)
 Decide whether the Hashmap should be resized.