From 5f955749eb99e53304338453e351c9f8e5f5a2f7 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Sun, 22 Mar 2026 13:49:46 +0100 Subject: finishing wrapper --- cheesemap.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cheesemap.h') diff --git a/cheesemap.h b/cheesemap.h index 423ec17..d1f72ef 100644 --- a/cheesemap.h +++ b/cheesemap.h @@ -140,6 +140,11 @@ void cm_new(struct cheesemap* map, uintptr_t key_size, uintptr_t value_size, uint8_t* mem_usr, cm_malloc_fn malloc, cm_free_fn free, uint8_t* map_usr, cm_hash_fn hash, cm_compare_fn compare); void cm_drop(struct cheesemap* map); +bool cm_insert(struct cheesemap* map, const uint8_t* key, + const uint8_t* value); +bool cm_lookup(struct cheesemap* map, const uint8_t* key, uint8_t** out_value); +bool cm_remove(struct cheesemap* map, const uint8_t* key, uint8_t* out_value); +bool cm_reserve(struct cheesemap* map, uintptr_t additional); //////////////////////////////// // cheesemap iterators @@ -159,6 +164,14 @@ void cm_raw_iter_init(struct cheesemap_raw_iter* iter, bool cheesemap_raw_iter_next(struct cheesemap_raw_iter* iter, uintptr_t entry_size, uintptr_t* out_index); +struct cheesemap_iter { + uintptr_t key_size, value_size; + struct cheesemap_raw_iter raw; +}; + +void cm_iter_init(struct cheesemap_iter* iter, const struct cheesemap* map); +bool cm_iter_next(struct cheesemap_iter* iter, const struct cheesemap* map, + uint8_t** out_key, uint8_t** out_value); #ifdef __cplusplus } -- cgit v1.2.3