diff --git a/include/zephyr/sys/hash_map_api.h b/include/zephyr/sys/hash_map_api.h index c677bd4c53..9e2b88c675 100644 --- a/include/zephyr/sys/hash_map_api.h +++ b/include/zephyr/sys/hash_map_api.h @@ -37,22 +37,21 @@ extern "C" { * * @note @a next should not be used without first checking * @ref sys_hashmap_iterator_has_next - * - * @param map Pointer to the associated Hashmap - * @param next Modify the iterator in-place to point to the next Hashmap entry - * @param state Implementation-specific iterator state - * @param key Key associated with the current entry - * @param value Value associated with the current entry - * @param size Number of entries in the map - * @param pos Number of entries already iterated */ struct sys_hashmap_iterator { + /** Pointer to the associated Hashmap */ const struct sys_hashmap *map; + /** Modify the iterator in-place to point to the next Hashmap entry */ void (*next)(struct sys_hashmap_iterator *it); + /** Implementation-specific iterator state */ void *state; + /** Key associated with the current entry */ uint64_t key; + /** Value associated with the current entry */ uint64_t value; + /** Number of entries in the map */ const size_t size; + /** Number of entries already iterated */ size_t pos; }; @@ -162,18 +161,17 @@ typedef bool (*sys_hashmap_get_t)(const struct sys_hashmap *map, uint64_t key, u /** * @brief Generic Hashmap API - * - * @param iter Iterator constructor (in-place) - * @param clear Clear the hash table, freeing all resources - * @param insert Insert a key-value pair into the Hashmap - * @param remove Remove a key-value pair from the Hashmap - * @param get Retrieve a the value associated with a given key from the Hashmap */ struct sys_hashmap_api { + /** Iterator constructor (in-place) */ sys_hashmap_iterator_t iter; + /** Clear the hash table, freeing all resources */ sys_hashmap_clear_t clear; + /** Insert a key-value pair into the Hashmap */ sys_hashmap_insert_t insert; + /** Remove a key-value pair from the Hashmap */ sys_hashmap_remove_t remove; + /** Retrieve the value associated with a given key from the Hashmap */ sys_hashmap_get_t get; }; @@ -192,14 +190,13 @@ struct sys_hashmap_api { * The @a initial_n_buckets is defined as the number of buckets to allocate * when moving from size 0 to size 1 such that the maximum @a load_factor * property is preserved. - * - * @param max_size Maximum number of entries - * @param load_factor Maximum load factor of expressed in hundredths - * @param initial_n_buckets Initial number of buckets to allocate */ struct sys_hashmap_config { + /** Maximum number of entries */ size_t max_size; + /** Maximum load factor expressed in hundredths */ uint8_t load_factor; + /** Initial number of buckets to allocate */ uint8_t initial_n_buckets; }; @@ -221,14 +218,13 @@ struct sys_hashmap_config { * @brief Generic Hashmap data * * @note When @a size is zero, @a buckets should be `NULL`. - * - * @param buckets Pointer for implementation-specific Hashmap storage - * @param n_buckets The number of buckets currently allocated - * @param size The number of entries currently in the Hashmap */ struct sys_hashmap_data { + /** Pointer for implementation-specific Hashmap storage */ void *buckets; + /** The number of buckets currently allocated */ size_t n_buckets; + /** The number of entries currently in the Hashmap */ size_t size; };