91#ifndef CCC_FLAT_HASH_MAP_H
92#define CCC_FLAT_HASH_MAP_H
182#define CCC_flat_hash_map_declare_fixed(fixed_map_type_name, type_name, \
184 CCC_private_flat_hash_map_declare_fixed(fixed_map_type_name, type_name, \
191#define CCC_flat_hash_map_fixed_capacity(fixed_map_type_name) \
192 CCC_private_flat_hash_map_fixed_capacity(fixed_map_type_name)
256#define CCC_flat_hash_map_initialize(type_name, key_field, hash, compare, \
257 allocate, context_data, capacity, \
259 CCC_private_flat_hash_map_initialize(type_name, key_field, hash, compare, \
260 allocate, context_data, capacity, \
321#define CCC_flat_hash_map_from(key_field, hash, compare, allocate, \
322 context_data, optional_capacity, \
323 array_compound_literal...) \
324 CCC_private_flat_hash_map_from(key_field, hash, compare, allocate, \
325 context_data, optional_capacity, \
326 array_compound_literal)
375#define CCC_flat_hash_map_with_capacity(type_name, key_field, hash, compare, \
376 allocate, context_data, capacity) \
377 CCC_private_flat_hash_map_with_capacity( \
378 type_name, key_field, hash, compare, allocate, context_data, capacity)
413#define CCC_flat_hash_map_with_compound_literal(key_field, hash, compare, \
415 CCC_private_flat_hash_map_with_compound_literal(key_field, hash, compare, \
453#define CCC_flat_hash_map_with_context_compound_literal( \
454 key_field, hash, compare, context, compound_literal) \
455 CCC_private_flat_hash_map_with_context_compound_literal( \
456 key_field, hash, compare, context, compound_literal)
489#define CCC_flat_hash_map_with_allocator(type_name, key_field, hash, compare, \
491 CCC_private_flat_hash_map_with_allocator(type_name, key_field, hash, \
525#define CCC_flat_hash_map_with_context_allocator(type_name, key_field, hash, \
526 compare, allocate, context) \
527 CCC_private_flat_hash_map_with_context_allocator( \
528 type_name, key_field, hash, compare, allocate, context)
745#define CCC_flat_hash_map_entry_wrap(map_pointer, key_pointer) \
746 &(CCC_Flat_hash_map_entry) \
748 CCC_flat_hash_map_entry(map_pointer, key_pointer).private \
812#define CCC_flat_hash_map_and_modify_with(map_entry_pointer, type_name, \
814 &(CCC_Flat_hash_map_entry) \
816 CCC_private_flat_hash_map_and_modify_with(map_entry_pointer, \
817 type_name, closure_over_T) \
844#define CCC_flat_hash_map_or_insert_with(map_entry_pointer, \
845 type_compound_literal...) \
846 CCC_private_flat_hash_map_or_insert_with(map_entry_pointer, \
847 type_compound_literal)
870#define CCC_flat_hash_map_insert_entry_with(map_entry_pointer, \
871 type_compound_literal...) \
872 CCC_private_flat_hash_map_insert_entry_with(map_entry_pointer, \
873 type_compound_literal)
901#define CCC_flat_hash_map_swap_entry_wrap(map_pointer, type_pointer) \
904 CCC_flat_hash_map_swap_entry(map_pointer, type_pointer).private \
919#define CCC_flat_hash_map_remove_entry_wrap(map_entry_pointer) \
922 CCC_flat_hash_map_remove_entry(map_entry_pointer).private \
948#define CCC_flat_hash_map_try_insert_wrap(map_pointer, type_pointer) \
951 CCC_flat_hash_map_try_insert(map_pointer, type_pointer).private \
970#define CCC_flat_hash_map_try_insert_with(map_pointer, key, \
971 type_compound_literal...) \
974 CCC_private_flat_hash_map_try_insert_with(map_pointer, key, \
975 type_compound_literal) \
998#define CCC_flat_hash_map_insert_or_assign_wrap(map_pointer, type_pointer) \
1001 CCC_flat_hash_map_insert_or_assign(map_pointer, type_pointer).private \
1016#define CCC_flat_hash_map_insert_or_assign_with(map_pointer, key, \
1017 type_compound_literal...) \
1020 CCC_private_flat_hash_map_insert_or_assign_with(map_pointer, key, \
1021 type_compound_literal) \
1052#define CCC_flat_hash_map_remove_key_value_wrap(map_pointer, \
1053 type_output_pointer) \
1056 CCC_flat_hash_map_remove_key_value(map_pointer, type_output_pointer) \
1099[[nodiscard]] CCC_Entry_status
1184 void const *type_iterator);
1226#ifdef FLAT_HASH_MAP_USING_NAMESPACE_CCC
1229# define flat_hash_map_declare_fixed(arguments...) \
1230 CCC_flat_hash_map_declare_fixed(arguments)
1231# define flat_hash_map_fixed_capacity(arguments...) \
1232 CCC_flat_hash_map_fixed_capacity(arguments)
1233# define flat_hash_map_reserve(arguments...) \
1234 CCC_flat_hash_map_reserve(arguments)
1235# define flat_hash_map_initialize(arguments...) \
1236 CCC_flat_hash_map_initialize(arguments)
1237# define flat_hash_map_from(arguments...) CCC_flat_hash_map_from(arguments)
1238# define flat_hash_map_with_capacity(arguments...) \
1239 CCC_flat_hash_map_with_capacity(arguments)
1240# define flat_hash_map_with_compound_literal(arguments...) \
1241 CCC_flat_hash_map_with_compound_literal(arguments)
1242# define flat_hash_map_with_context_compound_literal(arguments...) \
1243 CCC_flat_hash_map_with_context_compound_literal(arguments)
1244# define flat_hash_map_with_allocator(arguments...) \
1245 CCC_flat_hash_map_with_allocator(arguments)
1246# define flat_hash_map_with_context_allocator(arguments...) \
1247 CCC_flat_hash_map_with_context_allocator(arguments)
1248# define flat_hash_map_copy(arguments...) CCC_flat_hash_map_copy(arguments)
1249# define flat_hash_map_and_modify_with(arguments...) \
1250 CCC_flat_hash_map_and_modify_with(arguments)
1251# define flat_hash_map_or_insert_with(arguments...) \
1252 CCC_flat_hash_map_or_insert_with(arguments)
1253# define flat_hash_map_insert_entry_with(arguments...) \
1254 CCC_flat_hash_map_insert_entry_with(arguments)
1255# define flat_hash_map_try_insert_with(arguments...) \
1256 CCC_flat_hash_map_try_insert_with(arguments)
1257# define flat_hash_map_insert_or_assign_with(arguments...) \
1258 CCC_flat_hash_map_insert_or_assign_with(arguments)
1259# define flat_hash_map_contains(arguments...) \
1260 CCC_flat_hash_map_contains(arguments)
1261# define flat_hash_map_get_key_value(arguments...) \
1262 CCC_flat_hash_map_get_key_value(arguments)
1263# define flat_hash_map_remove_key_value_wrap(arguments...) \
1264 CCC_flat_hash_map_remove_key_value_wrap(arguments)
1265# define flat_hash_map_swap_entry_wrap(arguments...) \
1266 CCC_flat_hash_map_swap_entry_wrap(arguments)
1267# define flat_hash_map_try_insert_wrap(arguments...) \
1268 CCC_flat_hash_map_try_insert_wrap(arguments)
1269# define flat_hash_map_insert_or_assign_wrap(arguments...) \
1270 CCC_flat_hash_map_insert_or_assign_wrap(arguments)
1271# define flat_hash_map_remove_entry_wrap(arguments...) \
1272 CCC_flat_hash_map_remove_entry_wrap(arguments)
1273# define flat_hash_map_remove_key_value(arguments...) \
1274 CCC_flat_hash_map_remove_key_value(arguments)
1275# define flat_hash_map_swap_entry(arguments...) \
1276 CCC_flat_hash_map_swap_entry(arguments)
1277# define flat_hash_map_try_insert(arguments...) \
1278 CCC_flat_hash_map_try_insert(arguments)
1279# define flat_hash_map_insert_or_assign(arguments...) \
1280 CCC_flat_hash_map_insert_or_assign(arguments)
1281# define flat_hash_map_remove_entry(arguments...) \
1282 CCC_flat_hash_map_remove_entry(arguments)
1283# define flat_hash_map_entry_wrap(arguments...) \
1284 CCC_flat_hash_map_entry_wrap(arguments)
1285# define flat_hash_map_entry(arguments...) CCC_flat_hash_map_entry(arguments)
1286# define flat_hash_map_and_modify(arguments...) \
1287 CCC_flat_hash_map_and_modify(arguments)
1288# define flat_hash_map_and_modify_context(arguments...) \
1289 CCC_flat_hash_map_and_modify_context(arguments)
1290# define flat_hash_map_or_insert(arguments...) \
1291 CCC_flat_hash_map_or_insert(arguments)
1292# define flat_hash_map_insert_entry(arguments...) \
1293 CCC_flat_hash_map_insert_entry(arguments)
1294# define flat_hash_map_unwrap(arguments...) \
1295 CCC_flat_hash_map_unwrap(arguments)
1296# define flat_hash_map_occupied(arguments...) \
1297 CCC_flat_hash_map_occupied(arguments)
1298# define flat_hash_map_insert_error(arguments...) \
1299 CCC_flat_hash_map_insert_error(arguments)
1300# define flat_hash_map_begin(arguments...) CCC_flat_hash_map_begin(arguments)
1301# define flat_hash_map_next(arguments...) CCC_flat_hash_map_next(arguments)
1302# define flat_hash_map_end(arguments...) CCC_flat_hash_map_end(arguments)
1303# define flat_hash_map_is_empty(arguments...) \
1304 CCC_flat_hash_map_is_empty(arguments)
1305# define flat_hash_map_count(arguments...) CCC_flat_hash_map_count(arguments)
1306# define flat_hash_map_clear(arguments...) CCC_flat_hash_map_clear(arguments)
1307# define flat_hash_map_clear_and_free(arguments...) \
1308 CCC_flat_hash_map_clear_and_free(arguments)
1309# define flat_hash_map_clear_and_free_reserve(arguments...) \
1310 CCC_flat_hash_map_clear_and_free_reserve(arguments)
1311# define flat_hash_map_capacity(arguments...) \
1312 CCC_flat_hash_map_capacity(arguments)
1313# define flat_hash_map_validate(arguments...) \
1314 CCC_flat_hash_map_validate(arguments)
CCC_Entry CCC_flat_hash_map_remove_entry(CCC_Flat_hash_map_entry const *entry)
Remove the entry from the table if Occupied.
void * CCC_flat_hash_map_get_key_value(CCC_Flat_hash_map const *map, void const *key)
Returns a reference into the table at entry key.
CCC_Entry CCC_flat_hash_map_insert_or_assign(CCC_Flat_hash_map *map, void const *type)
Invariantly inserts or overwrites a user struct into the table.
CCC_Entry_status CCC_flat_hash_map_entry_status(CCC_Flat_hash_map_entry const *entry)
Obtain the entry status from a container entry.
void * CCC_flat_hash_map_begin(CCC_Flat_hash_map const *map)
Obtains a pointer to the first element in the table.
CCC_Entry CCC_flat_hash_map_remove_key_value(CCC_Flat_hash_map *map, void *type_output)
Removes the key value in the map storing the old value, if present, in the struct containing out_hand...
void * CCC_flat_hash_map_end(CCC_Flat_hash_map const *map)
Check the current iterator against the end for loop termination.
void * CCC_flat_hash_map_next(CCC_Flat_hash_map const *map, void const *type_iterator)
Advances the iterator to the next occupied table slot.
void * CCC_flat_hash_map_or_insert(CCC_Flat_hash_map_entry const *entry, void const *type)
Inserts the struct with handle elem if the entry is Vacant.
CCC_Tribool CCC_flat_hash_map_is_empty(CCC_Flat_hash_map const *map)
Returns the size status of the table.
CCC_Entry CCC_flat_hash_map_swap_entry(CCC_Flat_hash_map *map, void *type_output)
Invariantly inserts the key value wrapping out_handle.
CCC_Result CCC_flat_hash_map_clear_and_free(CCC_Flat_hash_map *map, CCC_Type_destructor *destroy)
Frees all slots in the table and frees the underlying buffer.
CCC_Tribool CCC_flat_hash_map_validate(CCC_Flat_hash_map const *map)
Validation of invariants for the hash table.
CCC_Flat_hash_map_entry * CCC_flat_hash_map_and_modify(CCC_Flat_hash_map_entry *entry, CCC_Type_modifier *modify)
Modifies the provided entry if it is Occupied.
CCC_Tribool CCC_flat_hash_map_contains(CCC_Flat_hash_map const *map, void const *key)
Searches the table for the presence of key.
void * CCC_flat_hash_map_insert_entry(CCC_Flat_hash_map_entry const *entry, void const *type)
Inserts the provided entry invariantly.
void * CCC_flat_hash_map_unwrap(CCC_Flat_hash_map_entry const *entry)
Unwraps the provided entry to obtain a view into the table element.
CCC_Flat_hash_map_entry * CCC_flat_hash_map_and_modify_context(CCC_Flat_hash_map_entry *entry, CCC_Type_modifier *modify, void *context)
Modifies the provided entry if it is Occupied.
CCC_Result CCC_flat_hash_map_clear_and_free_reserve(CCC_Flat_hash_map *map, CCC_Type_destructor *destroy, CCC_Allocator *allocate)
Frees all slots in the table and frees the underlying Buffer that was previously dynamically reserved...
CCC_Result CCC_flat_hash_map_reserve(CCC_Flat_hash_map *map, size_t to_add, CCC_Allocator *allocate)
Reserve space required to add a specified number of elements to the map. If the current capacity is s...
CCC_Flat_hash_map_entry CCC_flat_hash_map_entry(CCC_Flat_hash_map *map, void const *key)
Obtains an entry for the provided key in the table for future use.
CCC_Result CCC_flat_hash_map_copy(CCC_Flat_hash_map *destination, CCC_Flat_hash_map const *source, CCC_Allocator *allocate)
Copy the map at source to destination.
CCC_Tribool CCC_flat_hash_map_occupied(CCC_Flat_hash_map_entry const *entry)
Returns the Vacant or Occupied status of the entry.
CCC_Count CCC_flat_hash_map_capacity(CCC_Flat_hash_map const *map)
Return the full capacity of the backing storage.
CCC_Count CCC_flat_hash_map_count(CCC_Flat_hash_map const *map)
Returns the count of table occupied slots.
CCC_Result CCC_flat_hash_map_clear(CCC_Flat_hash_map *map, CCC_Type_destructor *destroy)
Frees all slots in the table for use without affecting capacity.
CCC_Tribool CCC_flat_hash_map_insert_error(CCC_Flat_hash_map_entry const *entry)
Provides the status of the entry should an insertion follow.
CCC_Entry CCC_flat_hash_map_try_insert(CCC_Flat_hash_map *map, void const *type)
Attempts to insert the key value wrapping key_val_handle.
Private Flat Hash Map Interface.
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:202
Definition: private_types.h:53
Definition: private_flat_hash_map.h:172
Definition: private_flat_hash_map.h:144
The C Container Collection Fundamental Types.
CCC_Tribool
A three state boolean to allow for an error state. Error is -1, False is 0, and True is 1.
Definition: types.h:133
void CCC_Type_destructor(CCC_Type_context)
A callback function for destroying an element in the container.
Definition: types.h:376
CCC_Result
A result of actions on containers.
Definition: types.h:148
void * CCC_Allocator(CCC_Allocator_context)
An allocation function at the core of all containers.
Definition: types.h:340
void CCC_Type_modifier(CCC_Type_context)
A callback function for modifying an element in the container.
Definition: types.h:358
Definition: private_flat_hash_map.h:190