Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions include/zephyr/sys/hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,49 @@
extern "C" {
#endif

/**
* @brief Declare a Hashmap (advanced)
*
* Declare a Hashmap with control over advanced parameters.
*
* @param _name Name of the Hashmap.
* @param _config_type Variant of @ref sys_hashmap_config.
* @param _data_type Variant of @ref sys_hashmap_data.
*/
#define SYS_HASHMAP_DECLARE_ADVANCED(_name, _config_type, _data_type) \
struct _config_type _name##_config; \
struct _data_type _name##_data; \
struct sys_hashmap _name;

Check notice on line 43 in include/zephyr/sys/hash_map.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map.h:43 -#define SYS_HASHMAP_DECLARE_ADVANCED(_name, _config_type, _data_type) \ - struct _config_type _name##_config; \ - struct _data_type _name##_data; \ +#define SYS_HASHMAP_DECLARE_ADVANCED(_name, _config_type, _data_type) \ + struct _config_type _name##_config; \ + struct _data_type _name##_data; \

Check notice on line 43 in include/zephyr/sys/hash_map.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map.h:43 -#define SYS_HASHMAP_DECLARE_ADVANCED(_name, _config_type, _data_type) \ - struct _config_type _name##_config; \ - struct _data_type _name##_data; \ +#define SYS_HASHMAP_DECLARE_ADVANCED(_name, _config_type, _data_type) \ + struct _config_type _name##_config; \ + struct _data_type _name##_data; \
/**
* @brief Init a Hashmap (advanced)
*
* Init a Hashmap with control over advanced parameters.
*
* @note The allocator @p _alloc is used for allocating internal Hashmap
* entries and does not interact with any user-provided keys or values.
*
* @param _name Name of the Hashmap.
* @param _api API pointer of type @ref sys_hashmap_api.
* @param _hash_func Hash function pointer of type @ref sys_hash_func32_t.
* @param _alloc_func Allocator function pointer of type @ref sys_hashmap_allocator_t.
* @param _max_size Maximum number of entries
* @param _load_factor Maximum load factor of expressed in hundredths
*/
#define SYS_HASHMAP_INIT_ADVANCED(_name, _api, _hash_func, _alloc_func, \
_max_size, _load_factor) \
{ \
SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \

Check warning on line 62 in include/zephyr/sys/hash_map.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

include/zephyr/sys/hash_map.h:62 please, no spaces at the start of a line

Check warning on line 62 in include/zephyr/sys/hash_map.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

include/zephyr/sys/hash_map.h:62 please, no spaces at the start of a line
memset(&_name##_data, 0, sizeof(_name##_data)); \
memset(&_name, 0, sizeof(_name)); \
_name.api = (const struct sys_hashmap_api *)(_api); \
_name.config = (const struct sys_hashmap_config *)&_name##_config; \
_name.data = (struct sys_hashmap_data *)&_name##_data; \
_name.hash_func = (_hash_func); \
_name.alloc_func = (_alloc_func); \
}

Check warning on line 71 in include/zephyr/sys/hash_map.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

include/zephyr/sys/hash_map.h:71 please, no spaces at the start of a line

Check warning on line 71 in include/zephyr/sys/hash_map.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

include/zephyr/sys/hash_map.h:71 please, no spaces at the start of a line
/**

Check notice on line 72 in include/zephyr/sys/hash_map.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map.h:72 -#define SYS_HASHMAP_INIT_ADVANCED(_name, _api, _hash_func, _alloc_func, \ - _max_size, _load_factor) \ - { \ - SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \ - memset(&_name##_data, 0, sizeof(_name##_data)); \ - memset(&_name, 0, sizeof(_name)); \ - _name.api = (const struct sys_hashmap_api *)(_api); \ - _name.config = (const struct sys_hashmap_config *)&_name##_config; \ - _name.data = (struct sys_hashmap_data *)&_name##_data; \ - _name.hash_func = (_hash_func); \ - _name.alloc_func = (_alloc_func); \ - } +#define SYS_HASHMAP_INIT_ADVANCED(_name, _api, _hash_func, _alloc_func, _max_size, _load_factor) \ + { \ + SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \ + memset(&_name##_data, 0, sizeof(_name##_data)); \ + memset(&_name, 0, sizeof(_name)); \ + _name.api = (const struct sys_hashmap_api *)(_api); \ + _name.config = (const struct sys_hashmap_config *)&_name##_config; \ + _name.data = (struct sys_hashmap_data *)&_name##_data; \ + _name.hash_func = (_hash_func); \ + _name.alloc_func = (_alloc_func); \ + }

Check notice on line 72 in include/zephyr/sys/hash_map.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map.h:72 -#define SYS_HASHMAP_INIT_ADVANCED(_name, _api, _hash_func, _alloc_func, \ - _max_size, _load_factor) \ - { \ - SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \ - memset(&_name##_data, 0, sizeof(_name##_data)); \ - memset(&_name, 0, sizeof(_name)); \ - _name.api = (const struct sys_hashmap_api *)(_api); \ - _name.config = (const struct sys_hashmap_config *)&_name##_config; \ - _name.data = (struct sys_hashmap_data *)&_name##_data; \ - _name.hash_func = (_hash_func); \ - _name.alloc_func = (_alloc_func); \ - } +#define SYS_HASHMAP_INIT_ADVANCED(_name, _api, _hash_func, _alloc_func, _max_size, _load_factor) \ + { \ + SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \ + memset(&_name##_data, 0, sizeof(_name##_data)); \ + memset(&_name, 0, sizeof(_name)); \ + _name.api = (const struct sys_hashmap_api *)(_api); \ + _name.config = (const struct sys_hashmap_config *)&_name##_config; \ + _name.data = (struct sys_hashmap_data *)&_name##_data; \ + _name.hash_func = (_hash_func); \ + _name.alloc_func = (_alloc_func); \ + }
* @brief Declare a Hashmap (advanced)
*
* Declare a Hashmap with control over advanced parameters.
Expand Down
17 changes: 17 additions & 0 deletions include/zephyr/sys/hash_map_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,23 @@
.initial_n_buckets = NHPOT(DIV_ROUND_UP(100, _load_factor)), \
}

/**
* @brief Initialize @p sys_hashmap_config
*
* This macro helps to initialize a structure of type @p sys_hashmap_config.
*
* @param _name Name of the Hashmap

Check warning on line 225 in include/zephyr/sys/hash_map_api.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

BLOCK_COMMENT_STYLE

include/zephyr/sys/hash_map_api.h:225 Block comments should align the * on each line

Check warning on line 225 in include/zephyr/sys/hash_map_api.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

BLOCK_COMMENT_STYLE

include/zephyr/sys/hash_map_api.h:225 Block comments should align the * on each line
* @param _max_size Maximum number of entries

Check warning on line 226 in include/zephyr/sys/hash_map_api.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

BLOCK_COMMENT_STYLE

include/zephyr/sys/hash_map_api.h:226 Block comments should align the * on each line

Check warning on line 226 in include/zephyr/sys/hash_map_api.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

BLOCK_COMMENT_STYLE

include/zephyr/sys/hash_map_api.h:226 Block comments should align the * on each line
* @param _load_factor Maximum load factor of expressed in hundredths
*/
#define SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \
{ \
memset(&_name##_config, 0, sizeof(_name##_config)); \
_name##_config.max_size = (size_t)_max_size; \
_name##_config.load_factor = (uint8_t)_load_factor; \
_name##_config.initial_n_buckets = NHPOT(DIV_ROUND_UP(100, _load_factor)); \
}

Check notice on line 235 in include/zephyr/sys/hash_map_api.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_api.h:235 -* @param _name Name of the Hashmap + * @param _name Name of the Hashmap * @param _max_size Maximum number of entries * @param _load_factor Maximum load factor of expressed in hundredths */ -#define SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \ - { \ - memset(&_name##_config, 0, sizeof(_name##_config)); \ - _name##_config.max_size = (size_t)_max_size; \ - _name##_config.load_factor = (uint8_t)_load_factor; \ - _name##_config.initial_n_buckets = NHPOT(DIV_ROUND_UP(100, _load_factor)); \ +#define SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \ + { \ + memset(&_name##_config, 0, sizeof(_name##_config)); \ + _name##_config.max_size = (size_t)_max_size; \ + _name##_config.load_factor = (uint8_t)_load_factor; \ + _name##_config.initial_n_buckets = NHPOT(DIV_ROUND_UP(100, _load_factor)); \

Check notice on line 235 in include/zephyr/sys/hash_map_api.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_api.h:235 -* @param _name Name of the Hashmap + * @param _name Name of the Hashmap * @param _max_size Maximum number of entries * @param _load_factor Maximum load factor of expressed in hundredths */ -#define SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \ - { \ - memset(&_name##_config, 0, sizeof(_name##_config)); \ - _name##_config.max_size = (size_t)_max_size; \ - _name##_config.load_factor = (uint8_t)_load_factor; \ - _name##_config.initial_n_buckets = NHPOT(DIV_ROUND_UP(100, _load_factor)); \ +#define SYS_HASHMAP_CONFIG_INIT(_name, _max_size, _load_factor) \ + { \ + memset(&_name##_config, 0, sizeof(_name##_config)); \ + _name##_config.max_size = (size_t)_max_size; \ + _name##_config.load_factor = (uint8_t)_load_factor; \ + _name##_config.initial_n_buckets = NHPOT(DIV_ROUND_UP(100, _load_factor)); \

/**
* @brief Generic Hashmap data
*
Expand Down
31 changes: 31 additions & 0 deletions include/zephyr/sys/hash_map_cxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,34 @@
extern "C" {
#endif

/**
* @brief Declare a C++ Hashmap (advanced)
*
* Declare a C++ Hashmap with control over advanced parameters.
*
* @note The allocator @p _alloc is used for allocating internal Hashmap
* entries and does not interact with any user-provided keys or values.
*
* @param _name Name of the Hashmap.
*/
#define SYS_HASHMAP_CXX_DECLARE(_name) \
SYS_HASHMAP_DECLARE_ADVANCED(_name, sys_hashmap_config, sys_hashmap_data)

Check notice on line 41 in include/zephyr/sys/hash_map_cxx.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_cxx.h:41 -#define SYS_HASHMAP_CXX_DECLARE(_name) \ +#define SYS_HASHMAP_CXX_DECLARE(_name) \

Check notice on line 41 in include/zephyr/sys/hash_map_cxx.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_cxx.h:41 -#define SYS_HASHMAP_CXX_DECLARE(_name) \ +#define SYS_HASHMAP_CXX_DECLARE(_name) \

/**
* @brief Init a C++ Hashmap (advanced)
*
* Init a C++ Hashmap with control over advanced parameters.
*
* @note The allocator @p _alloc is used for allocating internal Hashmap
* entries and does not interact with any user-provided keys or values.
*
* @param _name Name of the Hashmap.
* @param _hash_func Hash function pointer of type @ref sys_hash_func32_t.
* @param _alloc_func Allocator function pointer of type @ref sys_hashmap_allocator_t.
*/
#define SYS_HASHMAP_CXX_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \
SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_cxx_api, _hash_func, _alloc_func, _max_size, _load_factor)

Check warning on line 56 in include/zephyr/sys/hash_map_cxx.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

include/zephyr/sys/hash_map_cxx.h:56 line length of 112 exceeds 100 columns

Check warning on line 56 in include/zephyr/sys/hash_map_cxx.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

include/zephyr/sys/hash_map_cxx.h:56 line length of 112 exceeds 100 columns

Check notice on line 57 in include/zephyr/sys/hash_map_cxx.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_cxx.h:57 -#define SYS_HASHMAP_CXX_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \ - SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_cxx_api, _hash_func, _alloc_func, _max_size, _load_factor) +#define SYS_HASHMAP_CXX_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \ + SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_cxx_api, _hash_func, _alloc_func, _max_size, \ + _load_factor)

Check notice on line 57 in include/zephyr/sys/hash_map_cxx.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_cxx.h:57 -#define SYS_HASHMAP_CXX_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \ - SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_cxx_api, _hash_func, _alloc_func, _max_size, _load_factor) +#define SYS_HASHMAP_CXX_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \ + SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_cxx_api, _hash_func, _alloc_func, _max_size, \ + _load_factor)
/**
* @brief Declare a C++ Hashmap (advanced)
*
Expand Down Expand Up @@ -86,8 +114,11 @@
SYS_HASHMAP_CONFIG(SIZE_MAX, SYS_HASHMAP_DEFAULT_LOAD_FACTOR))

#ifdef CONFIG_SYS_HASH_MAP_CHOICE_CXX
#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_CXX_DECLARE(_name)
#define SYS_HASHMAP_DEFAULT_DEFINE(_name) SYS_HASHMAP_CXX_DEFINE(_name)

Check notice on line 118 in include/zephyr/sys/hash_map_cxx.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_cxx.h:118 -#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_CXX_DECLARE(_name) +#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_CXX_DECLARE(_name)

Check notice on line 118 in include/zephyr/sys/hash_map_cxx.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_cxx.h:118 -#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_CXX_DECLARE(_name) +#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_CXX_DECLARE(_name)
#define SYS_HASHMAP_DEFAULT_DEFINE_STATIC(_name) SYS_HASHMAP_CXX_DEFINE_STATIC(_name)
#define SYS_HASHMAP_DEFAULT_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \
SYS_HASHMAP_CXX_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor)
#define SYS_HASHMAP_DEFAULT_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, ...) \
SYS_HASHMAP_CXX_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, __VA_ARGS__)
#define SYS_HASHMAP_DEFAULT_DEFINE_STATIC_ADVANCED(_name, _hash_func, _alloc_func, ...) \
Expand Down
29 changes: 29 additions & 0 deletions include/zephyr/sys/hash_map_oa_lp.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@
size_t n_tombstones;
};

/**
* @brief Declare a Open Addressing Linear Probe Hashmap
*
* Declare a Open Addressing Linear Probe Hashmap
*
* @param _name Name of the Hashmap.
*/
#define SYS_HASHMAP_OA_LP_DECLARE(_name) \
SYS_HASHMAP_DECLARE_ADVANCED(_name, sys_hashmap_config, sys_hashmap_oa_lp_data)

Check notice on line 42 in include/zephyr/sys/hash_map_oa_lp.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_oa_lp.h:42 -#define SYS_HASHMAP_OA_LP_DECLARE(_name) \ +#define SYS_HASHMAP_OA_LP_DECLARE(_name) \

Check notice on line 42 in include/zephyr/sys/hash_map_oa_lp.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_oa_lp.h:42 -#define SYS_HASHMAP_OA_LP_DECLARE(_name) \ +#define SYS_HASHMAP_OA_LP_DECLARE(_name) \

/**
* @brief Init a Open Addressing Linear Probe Hashmap (advanced)
*
* Init a Open Addressing Linear Probe Hashmap with control over advanced parameters.
*
* @note The allocator @p _alloc is used for allocating internal Hashmap
* entries and does not interact with any user-provided keys or values.
*
* @param _name Name of the Hashmap.
* @param _hash_func Hash function pointer of type @ref sys_hash_func32_t.
* @param _alloc_func Allocator function pointer of type @ref sys_hashmap_allocator_t.
* @param ... Variant-specific details for @ref sys_hashmap_config.
*/
#define SYS_HASHMAP_OA_LP_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \
SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_oa_lp_api, _hash_func, _alloc_func, _max_size, _load_factor)

Check warning on line 58 in include/zephyr/sys/hash_map_oa_lp.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

include/zephyr/sys/hash_map_oa_lp.h:58 line length of 114 exceeds 100 columns

Check warning on line 58 in include/zephyr/sys/hash_map_oa_lp.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

include/zephyr/sys/hash_map_oa_lp.h:58 line length of 114 exceeds 100 columns

Check notice on line 59 in include/zephyr/sys/hash_map_oa_lp.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_oa_lp.h:59 -#define SYS_HASHMAP_OA_LP_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \ - SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_oa_lp_api, _hash_func, _alloc_func, _max_size, _load_factor) +#define SYS_HASHMAP_OA_LP_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \ + SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_oa_lp_api, _hash_func, _alloc_func, \ + _max_size, _load_factor)

Check notice on line 59 in include/zephyr/sys/hash_map_oa_lp.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_oa_lp.h:59 -#define SYS_HASHMAP_OA_LP_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \ - SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_oa_lp_api, _hash_func, _alloc_func, _max_size, _load_factor) +#define SYS_HASHMAP_OA_LP_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \ + SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_oa_lp_api, _hash_func, _alloc_func, \ + _max_size, _load_factor)
/**
* @brief Declare a Open Addressing Linear Probe Hashmap (advanced)
*
Expand Down Expand Up @@ -91,8 +117,11 @@
SYS_HASHMAP_CONFIG(SIZE_MAX, SYS_HASHMAP_DEFAULT_LOAD_FACTOR))

#ifdef CONFIG_SYS_HASH_MAP_CHOICE_OA_LP
#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_OA_LP_DECLARE(_name)
#define SYS_HASHMAP_DEFAULT_DEFINE(_name) SYS_HASHMAP_OA_LP_DEFINE(_name)

Check notice on line 121 in include/zephyr/sys/hash_map_oa_lp.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_oa_lp.h:121 -#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_OA_LP_DECLARE(_name) +#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_OA_LP_DECLARE(_name)

Check notice on line 121 in include/zephyr/sys/hash_map_oa_lp.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_oa_lp.h:121 -#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_OA_LP_DECLARE(_name) +#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_OA_LP_DECLARE(_name)
#define SYS_HASHMAP_DEFAULT_DEFINE_STATIC(_name) SYS_HASHMAP_OA_LP_DEFINE_STATIC(_name)
#define SYS_HASHMAP_DEFAULT_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \
SYS_HASHMAP_OA_LP_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor)
#define SYS_HASHMAP_DEFAULT_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, ...) \
SYS_HASHMAP_OA_LP_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, __VA_ARGS__)
#define SYS_HASHMAP_DEFAULT_DEFINE_STATIC_ADVANCED(_name, _hash_func, _alloc_func, ...) \
Expand Down
29 changes: 29 additions & 0 deletions include/zephyr/sys/hash_map_sc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,32 @@
extern "C" {
#endif

/**
* @brief Declare a Separate Chaining Hashmap
*
* Declare a Separate Chaining Hashmap
*
* @param _name Name of the Hashmap.
*/
#define SYS_HASHMAP_SC_DECLARE(_name) \
SYS_HASHMAP_DECLARE_ADVANCED(_name, sys_hashmap_config, sys_hashmap_data)

Check notice on line 38 in include/zephyr/sys/hash_map_sc.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_sc.h:38 -#define SYS_HASHMAP_SC_DECLARE(_name) \ +#define SYS_HASHMAP_SC_DECLARE(_name) \

Check notice on line 38 in include/zephyr/sys/hash_map_sc.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/sys/hash_map_sc.h:38 -#define SYS_HASHMAP_SC_DECLARE(_name) \ +#define SYS_HASHMAP_SC_DECLARE(_name) \

/**
* @brief Init a Separate Chaining Hashmap (advanced)
*
* Init a Separate Chaining Hashmap with control over advanced parameters.
*
* @note The allocator @p _alloc_func is used for allocating internal Hashmap
* entries and does not interact with any user-provided keys or values.
*
* @param _name Name of the Hashmap.
* @param _hash_func Hash function pointer of type @ref sys_hash_func32_t.
* @param _alloc_func Allocator function pointer of type @ref sys_hashmap_allocator_t.
* @param ... Details for @ref sys_hashmap_config.
*/
#define SYS_HASHMAP_SC_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \
SYS_HASHMAP_INIT_ADVANCED(_name, &sys_hashmap_sc_api, _hash_func, _alloc_func, _max_size, _load_factor)

Check warning on line 54 in include/zephyr/sys/hash_map_sc.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

include/zephyr/sys/hash_map_sc.h:54 line length of 111 exceeds 100 columns

Check warning on line 54 in include/zephyr/sys/hash_map_sc.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

include/zephyr/sys/hash_map_sc.h:54 line length of 111 exceeds 100 columns

/**
* @brief Declare a Separate Chaining Hashmap (advanced)
*
Expand Down Expand Up @@ -86,8 +112,11 @@
SYS_HASHMAP_CONFIG(SIZE_MAX, SYS_HASHMAP_DEFAULT_LOAD_FACTOR))

#ifdef CONFIG_SYS_HASH_MAP_CHOICE_SC
#define SYS_HASHMAP_DEFAULT_DECLARE(_name) SYS_HASHMAP_SC_DECLARE(_name)
#define SYS_HASHMAP_DEFAULT_DEFINE(_name) SYS_HASHMAP_SC_DEFINE(_name)
#define SYS_HASHMAP_DEFAULT_DEFINE_STATIC(_name) SYS_HASHMAP_SC_DEFINE_STATIC(_name)
#define SYS_HASHMAP_DEFAULT_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor) \
SYS_HASHMAP_SC_INIT_ADVANCED(_name, _hash_func, _alloc_func, _max_size, _load_factor)
#define SYS_HASHMAP_DEFAULT_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, ...) \
SYS_HASHMAP_SC_DEFINE_ADVANCED(_name, _hash_func, _alloc_func, __VA_ARGS__)
#define SYS_HASHMAP_DEFAULT_DEFINE_STATIC_ADVANCED(_name, _hash_func, _alloc_func, ...) \
Expand Down
Loading