93#ifndef CCC_FLAT_HASH_MAP_H
94#define CCC_FLAT_HASH_MAP_H
174#define CCC_flat_hash_map_storage_for( \
175 user_type_compound_literal_array, optional_storage_specifier... \
177 CCC_private_flat_hash_map_storage_for( \
178 user_type_compound_literal_array, optional_storage_specifier \
188#define CCC_flat_hash_map_default(type_name, key_field, hasher...) \
189 CCC_private_flat_hash_map_default(type_name, key_field, hasher)
221#define CCC_flat_hash_map_for( \
222 type_name, key_field, hasher, capacity, map_pointer \
224 CCC_private_flat_hash_map_for( \
225 type_name, key_field, hasher, capacity, map_pointer \
283#define CCC_flat_hash_map_from( \
284 key_field, hasher, allocator, optional_capacity, array_compound_literal... \
286 CCC_private_flat_hash_map_from( \
291 array_compound_literal \
337#define CCC_flat_hash_map_with_capacity( \
338 type_name, key_field, hasher, allocator, capacity \
340 CCC_private_flat_hash_map_with_capacity( \
341 type_name, key_field, hasher, allocator, capacity \
378#define CCC_flat_hash_map_with_storage( \
379 key_field, hasher, compound_literal, optional_storage_specifier... \
381 CCC_private_flat_hash_map_with_storage( \
382 key_field, hasher, compound_literal, optional_storage_specifier \
544#define CCC_flat_hash_map_entry_wrap( \
545 map_pointer, key_pointer, allocator_pointer... \
547 &(struct { CCC_Flat_hash_map_entry private; }){ \
548 CCC_flat_hash_map_entry(map_pointer, key_pointer, allocator_pointer)} \
594#define CCC_flat_hash_map_and_modify_with( \
595 map_entry_pointer, closure_parameter, closure_over_closure_parameter... \
598 struct { CCC_Flat_hash_map_entry private; } \
599 ){CCC_private_flat_hash_map_and_modify_with( \
600 map_entry_pointer, closure_parameter, closure_over_closure_parameter \
628#define CCC_flat_hash_map_or_insert_with( \
629 map_entry_pointer, type_compound_literal... \
631 CCC_private_flat_hash_map_or_insert_with( \
632 map_entry_pointer, type_compound_literal \
656#define CCC_flat_hash_map_insert_entry_with( \
657 map_entry_pointer, type_compound_literal... \
659 CCC_private_flat_hash_map_insert_entry_with( \
660 map_entry_pointer, type_compound_literal \
693#define CCC_flat_hash_map_swap_entry_wrap( \
694 map_pointer, type_pointer, allocator_pointer \
696 &(struct { CCC_Entry private; }){ \
697 CCC_flat_hash_map_swap_entry( \
698 map_pointer, type_pointer, allocator_pointer \
714#define CCC_flat_hash_map_remove_entry_wrap(map_entry_pointer) \
715 &(struct { CCC_Entry private; }){ \
716 CCC_flat_hash_map_remove_entry(map_entry_pointer)} \
746#define CCC_flat_hash_map_try_insert_wrap( \
747 map_pointer, type_pointer, allocator_pointer... \
749 &(struct { CCC_Entry private; }){ \
750 CCC_flat_hash_map_try_insert( \
751 map_pointer, type_pointer, allocator_pointer \
773#define CCC_flat_hash_map_try_insert_with( \
774 map_pointer, key, allocator_pointer, type_compound_literal... \
776 &(struct { CCC_Entry private; }){ \
777 CCC_private_flat_hash_map_try_insert_with( \
778 map_pointer, key, allocator_pointer, type_compound_literal \
806#define CCC_flat_hash_map_insert_or_assign_wrap( \
807 map_pointer, type_pointer, allocator_pointer... \
809 &(struct { CCC_Entry private; }){ \
810 CCC_flat_hash_map_insert_or_assign( \
811 map_pointer, type_pointer, allocator_pointer \
829#define CCC_flat_hash_map_insert_or_assign_with( \
830 map_pointer, key, allocator_pointer, type_compound_literal... \
832 &(struct { CCC_Entry private; }){ \
833 CCC_private_flat_hash_map_insert_or_assign_with( \
834 map_pointer, key, allocator_pointer, type_compound_literal \
866#define CCC_flat_hash_map_remove_key_value_wrap( \
867 map_pointer, type_output_pointer \
869 &(struct { CCC_Entry private; }){ \
870 CCC_flat_hash_map_remove_key_value(map_pointer, type_output_pointer)} \
1007#ifdef FLAT_HASH_MAP_USING_NAMESPACE_CCC
1011# define flat_hash_map_storage_for(arguments...) \
1012 CCC_flat_hash_map_storage_for(arguments)
1013# define flat_hash_map_reserve(arguments...) \
1014 CCC_flat_hash_map_reserve(arguments)
1015# define flat_hash_map_default(arguments...) \
1016 CCC_flat_hash_map_default(arguments)
1017# define flat_hash_map_for(arguments...) CCC_flat_hash_map_for(arguments)
1018# define flat_hash_map_from(arguments...) CCC_flat_hash_map_from(arguments)
1019# define flat_hash_map_with_capacity(arguments...) \
1020 CCC_flat_hash_map_with_capacity(arguments)
1021# define flat_hash_map_with_storage(arguments...) \
1022 CCC_flat_hash_map_with_storage(arguments)
1023# define flat_hash_map_copy(arguments...) CCC_flat_hash_map_copy(arguments)
1024# define flat_hash_map_and_modify_with(arguments...) \
1025 CCC_flat_hash_map_and_modify_with(arguments)
1026# define flat_hash_map_or_insert_with(arguments...) \
1027 CCC_flat_hash_map_or_insert_with(arguments)
1028# define flat_hash_map_insert_entry_with(arguments...) \
1029 CCC_flat_hash_map_insert_entry_with(arguments)
1030# define flat_hash_map_try_insert_with(arguments...) \
1031 CCC_flat_hash_map_try_insert_with(arguments)
1032# define flat_hash_map_insert_or_assign_with(arguments...) \
1033 CCC_flat_hash_map_insert_or_assign_with(arguments)
1034# define flat_hash_map_contains(arguments...) \
1035 CCC_flat_hash_map_contains(arguments)
1036# define flat_hash_map_get_key_value(arguments...) \
1037 CCC_flat_hash_map_get_key_value(arguments)
1038# define flat_hash_map_remove_key_value_wrap(arguments...) \
1039 CCC_flat_hash_map_remove_key_value_wrap(arguments)
1040# define flat_hash_map_swap_entry_wrap(arguments...) \
1041 CCC_flat_hash_map_swap_entry_wrap(arguments)
1042# define flat_hash_map_try_insert_wrap(arguments...) \
1043 CCC_flat_hash_map_try_insert_wrap(arguments)
1044# define flat_hash_map_insert_or_assign_wrap(arguments...) \
1045 CCC_flat_hash_map_insert_or_assign_wrap(arguments)
1046# define flat_hash_map_remove_entry_wrap(arguments...) \
1047 CCC_flat_hash_map_remove_entry_wrap(arguments)
1048# define flat_hash_map_remove_key_value(arguments...) \
1049 CCC_flat_hash_map_remove_key_value(arguments)
1050# define flat_hash_map_swap_entry(arguments...) \
1051 CCC_flat_hash_map_swap_entry(arguments)
1052# define flat_hash_map_try_insert(arguments...) \
1053 CCC_flat_hash_map_try_insert(arguments)
1054# define flat_hash_map_insert_or_assign(arguments...) \
1055 CCC_flat_hash_map_insert_or_assign(arguments)
1056# define flat_hash_map_remove_entry(arguments...) \
1057 CCC_flat_hash_map_remove_entry(arguments)
1058# define flat_hash_map_entry_wrap(arguments...) \
1059 CCC_flat_hash_map_entry_wrap(arguments)
1060# define flat_hash_map_entry(arguments...) CCC_flat_hash_map_entry(arguments)
1061# define flat_hash_map_and_modify(arguments...) \
1062 CCC_flat_hash_map_and_modify(arguments)
1063# define flat_hash_map_or_insert(arguments...) \
1064 CCC_flat_hash_map_or_insert(arguments)
1065# define flat_hash_map_insert_entry(arguments...) \
1066 CCC_flat_hash_map_insert_entry(arguments)
1067# define flat_hash_map_unwrap(arguments...) \
1068 CCC_flat_hash_map_unwrap(arguments)
1069# define flat_hash_map_occupied(arguments...) \
1070 CCC_flat_hash_map_occupied(arguments)
1071# define flat_hash_map_insert_error(arguments...) \
1072 CCC_flat_hash_map_insert_error(arguments)
1073# define flat_hash_map_begin(arguments...) CCC_flat_hash_map_begin(arguments)
1074# define flat_hash_map_next(arguments...) CCC_flat_hash_map_next(arguments)
1075# define flat_hash_map_end(arguments...) CCC_flat_hash_map_end(arguments)
1076# define flat_hash_map_is_empty(arguments...) \
1077 CCC_flat_hash_map_is_empty(arguments)
1078# define flat_hash_map_count(arguments...) CCC_flat_hash_map_count(arguments)
1079# define flat_hash_map_clear(arguments...) CCC_flat_hash_map_clear(arguments)
1080# define flat_hash_map_clear_and_free(arguments...) \
1081 CCC_flat_hash_map_clear_and_free(arguments)
1082# define flat_hash_map_capacity(arguments...) \
1083 CCC_flat_hash_map_capacity(arguments)
1084# define flat_hash_map_validate(arguments...) \
1085 CCC_flat_hash_map_validate(arguments)
CCC_Result CCC_flat_hash_map_clear(CCC_Flat_hash_map *map, CCC_Destructor const *destructor)
Frees all slots in the table for use without affecting capacity.
CCC_Entry CCC_flat_hash_map_remove_entry(CCC_Flat_hash_map_entry const *entry)
Remove the entry from the table if Occupied.
CCC_Entry CCC_flat_hash_map_try_insert(CCC_Flat_hash_map *map, void const *type, CCC_Allocator const *allocator)
Attempts to insert the key value wrapping key_val_handle.
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_Result CCC_flat_hash_map_clear_and_free(CCC_Flat_hash_map *map, CCC_Destructor const *destructor, CCC_Allocator const *allocator)
Frees all slots in the table and frees the underlying buffer.
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.
CCC_Entry CCC_flat_hash_map_insert_or_assign(CCC_Flat_hash_map *map, void const *type, CCC_Allocator const *allocator)
Invariantly inserts or overwrites a user struct into the table.
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_Tribool CCC_flat_hash_map_validate(CCC_Flat_hash_map const *map)
Validation of invariants for the hash table.
CCC_Result CCC_flat_hash_map_copy(CCC_Flat_hash_map *destination, CCC_Flat_hash_map const *source, CCC_Allocator const *allocator)
Copy the map at source to destination.
CCC_Tribool CCC_flat_hash_map_contains(CCC_Flat_hash_map const *map, void const *key)
Searches the table for the presence of key.
CCC_Flat_hash_map_entry * CCC_flat_hash_map_and_modify(CCC_Flat_hash_map_entry *entry, CCC_Modifier const *modifier)
Modifies the provided entry if it is Occupied.
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_Result CCC_flat_hash_map_reserve(CCC_Flat_hash_map *map, size_t to_add, CCC_Allocator const *allocator)
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, CCC_Allocator const *allocator)
Obtains an entry for the provided key in the table for future use.
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_Entry CCC_flat_hash_map_swap_entry(CCC_Flat_hash_map *map, void *type_output, CCC_Allocator const *allocator)
Invariantly inserts the key value wrapping out_handle.
CCC_Count CCC_flat_hash_map_count(CCC_Flat_hash_map const *map)
Returns the count of table occupied slots.
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.
Private Flat Hash Map Interface.
The type passed by reference to any container function that may need to allocate memory....
Definition: types.h:369
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:243
The type passed by reference to any container function that may need to destroy elements....
Definition: types.h:457
An Occupied or Vacant position in a searchable container.
Definition: types.h:135
Definition: private_flat_hash_map.h:162
struct CCC_Flat_hash_map * map
Definition: private_flat_hash_map.h:164
Definition: private_flat_hash_map.h:141
The type passed by reference to any container function that may need to modify elements....
Definition: types.h:429
The C Container Collection Fundamental Types.
CCC_Entry_status
The status monitoring and entry state once it is obtained.
Definition: types.h:112
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:178
CCC_Result
A result of actions on containers.
Definition: types.h:192