Zephyr Project API  3.4.0
A Scalable Open Source RTOS
hash_map_oa_lp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Meta
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14#ifndef ZEPHYR_INCLUDE_SYS_HASH_MAP_OA_LP_H_
15#define ZEPHYR_INCLUDE_SYS_HASH_MAP_OA_LP_H_
16
17#include <stddef.h>
18
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27 void *buckets;
28 size_t n_buckets;
29 size_t size;
31};
32
46#define SYS_HASHMAP_OA_LP_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, ...) \
47 SYS_HASHMAP_DEFINE_ADVANCED(_name, &sys_hashmap_oa_lp_api, sys_hashmap_config, \
48 sys_hashmap_oa_lp_data, _hash_func, _alloc_func, __VA_ARGS__)
49
63#define SYS_HASHMAP_OA_LP_DEFINE_STATIC_ADVANCED(_name, _hash_func, _alloc_func, ...) \
64 SYS_HASHMAP_DEFINE_STATIC_ADVANCED(_name, &sys_hashmap_oa_lp_api, sys_hashmap_config, \
65 sys_hashmap_oa_lp_data, _hash_func, _alloc_func, \
66 __VA_ARGS__)
67
75#define SYS_HASHMAP_OA_LP_DEFINE_STATIC(_name) \
76 SYS_HASHMAP_OA_LP_DEFINE_STATIC_ADVANCED( \
77 _name, sys_hash32, SYS_HASHMAP_DEFAULT_ALLOCATOR, \
78 SYS_HASHMAP_CONFIG(SIZE_MAX, SYS_HASHMAP_DEFAULT_LOAD_FACTOR))
79
87#define SYS_HASHMAP_OA_LP_DEFINE(_name) \
88 SYS_HASHMAP_OA_LP_DEFINE_ADVANCED( \
89 _name, sys_hash32, SYS_HASHMAP_DEFAULT_ALLOCATOR, \
90 SYS_HASHMAP_CONFIG(SIZE_MAX, SYS_HASHMAP_DEFAULT_LOAD_FACTOR))
91
92#ifdef CONFIG_SYS_HASH_MAP_CHOICE_OA_LP
93#define SYS_HASHMAP_DEFAULT_DEFINE(_name) SYS_HASHMAP_OA_LP_DEFINE(_name)
94#define SYS_HASHMAP_DEFAULT_DEFINE_STATIC(_name) SYS_HASHMAP_OA_LP_DEFINE_STATIC(_name)
95#define SYS_HASHMAP_DEFAULT_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, ...) \
96 SYS_HASHMAP_OA_LP_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, __VA_ARGS__)
97#define SYS_HASHMAP_DEFAULT_DEFINE_STATIC_ADVANCED(_name, _hash_func, _alloc_func, ...) \
98 SYS_HASHMAP_OA_LP_DEFINE_STATIC_ADVANCED(_name, _hash_func, _alloc_func, __VA_ARGS__)
99#endif
100
101extern const struct sys_hashmap_api sys_hashmap_oa_lp_api;
102
103#ifdef __cplusplus
104}
105#endif
106
107#endif /* ZEPHYR_INCLUDE_SYS_HASH_MAP_OA_LP_H_ */
Hashmap (Hash Table) API.
const struct sys_hashmap_api sys_hashmap_oa_lp_api
Generic Hashmap API.
Definition: hash_map_api.h:173
Definition: hash_map_oa_lp.h:26
size_t size
Definition: hash_map_oa_lp.h:29
size_t n_tombstones
Definition: hash_map_oa_lp.h:30
void * buckets
Definition: hash_map_oa_lp.h:27
size_t n_buckets
Definition: hash_map_oa_lp.h:28