57#ifndef CCC_ARRAY_ADAPTIVE_MAP_H
58#define CCC_ARRAY_ADAPTIVE_MAP_H
109#define CCC_array_adaptive_map_storage_for( \
110 user_type_compound_literal_array, optional_storage_specifier... \
112 CCC_private_array_adaptive_map_storage_for( \
113 user_type_compound_literal_array, optional_storage_specifier \
121#define CCC_array_adaptive_map_default( \
122 type_name, type_key_field, comparator... \
124 CCC_private_array_adaptive_map_default( \
125 type_name, type_key_field, comparator \
135#define CCC_array_adaptive_map_for( \
136 type_name, type_key_field, comparator, capacity, memory_pointer \
138 CCC_private_array_adaptive_map_for( \
139 type_name, type_key_field, comparator, capacity, memory_pointer \
195#define CCC_array_adaptive_map_from( \
200 type_compound_literal_array... \
202 CCC_private_array_adaptive_map_from( \
207 type_compound_literal_array \
251#define CCC_array_adaptive_map_with_capacity( \
252 type_name, type_key_field, comparator, allocator, capacity \
254 CCC_private_array_adaptive_map_with_capacity( \
255 type_name, type_key_field, comparator, allocator, capacity \
287#define CCC_array_adaptive_map_with_storage( \
291 optional_storage_specifier... \
293 CCC_private_array_adaptive_map_with_storage( \
297 optional_storage_specifier \
311#define CCC_array_adaptive_map_with_allocator_storage( \
312 key_field, comparator, allocator, compound_literal \
314 CCC_private_array_adaptive_map_with_allocator_storage( \
315 key_field, comparator, allocator, compound_literal \
431#define CCC_array_adaptive_map_as(map_pointer, type_name, array_index...) \
432 CCC_private_array_adaptive_map_as(map_pointer, type_name, array_index)
486#define CCC_array_adaptive_map_swap_handle_wrap( \
487 map_pointer, type_output_pointer, allocator_pointer... \
489 &(struct { CCC_Handle private; }){ \
490 CCC_array_adaptive_map_swap_handle( \
491 (map_pointer), (type_output_pointer), allocator_pointer \
517#define CCC_array_adaptive_map_try_insert_wrap( \
518 map_pointer, type_pointer, allocator_pointer... \
520 &(struct { CCC_Handle private; }){ \
521 CCC_array_adaptive_map_try_insert( \
522 (map_pointer), (type_pointer), allocator_pointer \
540#define CCC_array_adaptive_map_try_insert_with( \
541 map_pointer, key, allocator_pointer, type_compound_literal... \
543 &(struct { CCC_Handle private; }){ \
544 CCC_private_array_adaptive_map_try_insert_with( \
545 map_pointer, key, allocator_pointer, type_compound_literal \
573#define CCC_array_adaptive_map_insert_or_assign_wrap( \
574 map_pointer, type_pointer, allocator_pointer... \
576 &(struct { CCC_Handle private; }){ \
577 CCC_array_adaptive_map_insert_or_assign( \
578 (map_pointer), (type_pointer), allocator_pointer \
596#define CCC_array_adaptive_map_insert_or_assign_with( \
597 map_pointer, key, allocator_pointer, type_compound_literal... \
599 &(struct { CCC_Handle private; }){ \
600 CCC_private_array_adaptive_map_insert_or_assign_with( \
601 map_pointer, key, allocator_pointer, type_compound_literal \
630#define CCC_array_adaptive_map_remove_key_value_wrap( \
631 map_pointer, type_output_pointer \
633 &(struct { CCC_Handle private; }){CCC_array_adaptive_map_remove_key_value( \
634 (map_pointer), (type_output_pointer) \
672#define CCC_array_adaptive_map_handle_wrap(handle_pointer, key_pointer) \
673 &(struct { CCC_Array_adaptive_map_handle private; }){ \
674 CCC_array_adaptive_map_handle((handle_pointer), (key_pointer))} \
720#define CCC_array_adaptive_map_and_modify_with( \
721 handle_pointer, closure_parameter, closure_over_closure_parameter... \
723 &(struct { CCC_Array_adaptive_map_handle private; }){ \
724 CCC_private_array_adaptive_map_and_modify_with( \
725 handle_pointer, closure_parameter, closure_over_closure_parameter \
759#define CCC_array_adaptive_map_or_insert_with( \
760 handle_pointer, allocator_pointer, type_compound_literal... \
762 CCC_private_array_adaptive_map_or_insert_with( \
763 handle_pointer, allocator_pointer, type_compound_literal \
787#define CCC_array_adaptive_map_insert_handle_with( \
788 handle_pointer, allocator_pointer, type_compound_literal... \
790 CCC_private_array_adaptive_map_insert_handle_with( \
791 handle_pointer, allocator_pointer, type_compound_literal \
807#define CCC_array_adaptive_map_remove_handle_wrap(handle_pointer) \
808 &(struct { CCC_Handle private; }){ \
809 CCC_array_adaptive_map_remove_handle((handle_pointer))} \
884#define CCC_array_adaptive_map_equal_range_wrap( \
885 map_pointer, begin_and_end_key_pointers... \
887 &(struct { CCC_Handle_range private; }){ \
888 CCC_array_adaptive_map_equal_range( \
889 map_pointer, begin_and_end_key_pointers \
919 void const *reverse_begin_key,
920 void const *reverse_end_key
930#define CCC_array_adaptive_map_equal_range_reverse_wrap( \
931 map_pointer, reverse_begin_and_reverse_end_key_pointers... \
933 &(struct { CCC_Handle_range_reverse private; }){ \
934 CCC_array_adaptive_map_equal_range_reverse( \
935 map_pointer, reverse_begin_and_reverse_end_key_pointers \
1058#ifdef ARRAY_ADAPTIVE_MAP_USING_NAMESPACE_CCC
1062# define array_adaptive_map_storage_for(arguments...) \
1063 CCC_array_adaptive_map_storage_for(arguments)
1064# define array_adaptive_map_default(arguments...) \
1065 CCC_array_adaptive_map_default(arguments)
1066# define array_adaptive_map_for(arguments...) \
1067 CCC_array_adaptive_map_for(arguments)
1068# define array_adaptive_map_from(arguments...) \
1069 CCC_array_adaptive_map_from(arguments)
1070# define array_adaptive_map_with_capacity(arguments...) \
1071 CCC_array_adaptive_map_with_capacity(arguments)
1072# define array_adaptive_map_with_storage(arguments...) \
1073 CCC_array_adaptive_map_with_storage(arguments)
1074# define array_adaptive_map_with_allocator_storage(arguments...) \
1075 CCC_array_adaptive_map_with_allocator_storage(arguments)
1076# define array_adaptive_map_at(arguments...) \
1077 CCC_array_adaptive_map_at(arguments)
1078# define array_adaptive_map_as(arguments...) \
1079 CCC_array_adaptive_map_as(arguments)
1080# define array_adaptive_map_and_modify_with(arguments...) \
1081 CCC_array_adaptive_map_and_modify_with(arguments)
1082# define array_adaptive_map_or_insert_with(arguments...) \
1083 CCC_array_adaptive_map_or_insert_with(arguments)
1084# define array_adaptive_map_insert_handle_with(arguments...) \
1085 CCC_array_adaptive_map_insert_handle_with(arguments)
1086# define array_adaptive_map_try_insert_with(arguments...) \
1087 CCC_array_adaptive_map_try_insert_with(arguments)
1088# define array_adaptive_map_copy(arguments...) \
1089 CCC_array_adaptive_map_copy(arguments)
1090# define array_adaptive_map_reserve(arguments...) \
1091 CCC_array_adaptive_map_reserve(arguments)
1092# define array_adaptive_map_contains(arguments...) \
1093 CCC_array_adaptive_map_contains(arguments)
1094# define array_adaptive_map_get_key_value(arguments...) \
1095 CCC_array_adaptive_map_get_key_value(arguments)
1096# define array_adaptive_map_swap_handle_wrap(arguments...) \
1097 CCC_array_adaptive_map_swap_handle_wrap(arguments)
1098# define array_adaptive_map_try_insert_wrap(arguments...) \
1099 CCC_array_adaptive_map_try_insert_wrap(arguments)
1100# define array_adaptive_map_remove_key_value_wrap(arguments...) \
1101 CCC_array_adaptive_map_remove_key_value_wrap(arguments)
1102# define array_adaptive_map_remove_handle_wrap(arguments...) \
1103 CCC_array_adaptive_map_remove_handle_wrap(arguments)
1104# define array_adaptive_map_swap_handle(arguments...) \
1105 CCC_array_adaptive_map_swap_handle(arguments)
1106# define array_adaptive_map_try_insert(arguments...) \
1107 CCC_array_adaptive_map_try_insert(arguments)
1108# define array_adaptive_map_insert_or_assign(arguments...) \
1109 CCC_array_adaptive_map_insert_or_assign(arguments)
1110# define array_adaptive_map_insert_or_assign_wrap(arguments...) \
1111 CCC_array_adaptive_map_insert_or_assign_wrap(arguments)
1112# define array_adaptive_map_insert_or_assign_with(arguments...) \
1113 CCC_array_adaptive_map_insert_or_assign_with(arguments)
1114# define array_adaptive_map_remove_key_value(arguments...) \
1115 CCC_array_adaptive_map_remove_key_value(arguments)
1116# define array_adaptive_map_remove_handle(arguments...) \
1117 CCC_array_adaptive_map_remove_handle(arguments)
1118# define array_adaptive_map_handle_wrap(arguments...) \
1119 CCC_array_adaptive_map_handle_wrap(arguments)
1120# define array_adaptive_map_handle(arguments...) \
1121 CCC_array_adaptive_map_handle(arguments)
1122# define array_adaptive_map_and_modify(arguments...) \
1123 CCC_array_adaptive_map_and_modify(arguments)
1124# define array_adaptive_map_or_insert(arguments...) \
1125 CCC_array_adaptive_map_or_insert(arguments)
1126# define array_adaptive_map_insert_handle(arguments...) \
1127 CCC_array_adaptive_map_insert_handle(arguments)
1128# define array_adaptive_map_unwrap(arguments...) \
1129 CCC_array_adaptive_map_unwrap(arguments)
1130# define array_adaptive_map_insert_error(arguments...) \
1131 CCC_array_adaptive_map_insert_error(arguments)
1132# define array_adaptive_map_handle_status(arguments...) \
1133 CCC_array_adaptive_map_handle_status(arguments)
1134# define array_adaptive_map_occupied(arguments...) \
1135 CCC_array_adaptive_map_occupied(arguments)
1136# define array_adaptive_map_clear(arguments...) \
1137 CCC_array_adaptive_map_clear(arguments)
1138# define array_adaptive_map_clear_and_free(arguments...) \
1139 CCC_array_adaptive_map_clear_and_free(arguments)
1140# define array_adaptive_map_begin(arguments...) \
1141 CCC_array_adaptive_map_begin(arguments)
1142# define array_adaptive_map_reverse_begin(arguments...) \
1143 CCC_array_adaptive_map_reverse_begin(arguments)
1144# define array_adaptive_map_end(arguments...) \
1145 CCC_array_adaptive_map_end(arguments)
1146# define array_adaptive_map_reverse_end(arguments...) \
1147 CCC_array_adaptive_map_reverse_end(arguments)
1148# define array_adaptive_map_next(arguments...) \
1149 CCC_array_adaptive_map_next(arguments)
1150# define array_adaptive_map_reverse_next(arguments...) \
1151 CCC_array_adaptive_map_reverse_next(arguments)
1152# define array_adaptive_map_equal_range(arguments...) \
1153 CCC_array_adaptive_map_equal_range(arguments)
1154# define array_adaptive_map_equal_range_wrap(arguments...) \
1155 CCC_array_adaptive_map_equal_range_wrap(arguments)
1156# define array_adaptive_map_equal_range_reverse(arguments...) \
1157 CCC_array_adaptive_map_equal_range_reverse(arguments)
1158# define array_adaptive_map_equal_range_reverse_wrap(arguments...) \
1159 CCC_array_adaptive_map_equal_range_reverse_wrap(arguments)
1160# define array_adaptive_map_count(arguments...) \
1161 CCC_array_adaptive_map_count(arguments)
1162# define array_adaptive_map_capacity(arguments...) \
1163 CCC_array_adaptive_map_capacity(arguments)
1164# define array_adaptive_map_is_empty(arguments...) \
1165 CCC_array_adaptive_map_is_empty(arguments)
1166# define array_adaptive_map_validate(arguments...) \
1167 CCC_array_adaptive_map_validate(arguments)
CCC_Tribool CCC_array_adaptive_map_validate(CCC_Array_adaptive_map const *map)
Validation of invariants for the map.
CCC_Handle CCC_array_adaptive_map_insert_or_assign(CCC_Array_adaptive_map *map, void const *type, CCC_Allocator const *allocator)
Invariantly inserts or overwrites a user struct into the map.
CCC_Tribool CCC_array_adaptive_map_insert_error(CCC_Array_adaptive_map_handle const *handle)
Provides the status of the handle should an insertion follow.
CCC_Result CCC_array_adaptive_map_clear(CCC_Array_adaptive_map *map, CCC_Destructor const *destructor)
Frees all slots in the map for use without affecting capacity.
void * CCC_array_adaptive_map_at(CCC_Array_adaptive_map const *map, CCC_Handle_index index)
Returns a reference to the user data at the provided handle.
CCC_Array_adaptive_map_handle * CCC_array_adaptive_map_and_modify(CCC_Array_adaptive_map_handle *handle, CCC_Modifier const *modifier)
Modifies the provided handle if it is Occupied.
CCC_Result CCC_array_adaptive_map_copy(CCC_Array_adaptive_map *destination, CCC_Array_adaptive_map const *source, CCC_Allocator const *allocator)
Copy the map at source to destination.
CCC_Handle CCC_array_adaptive_map_remove_handle(CCC_Array_adaptive_map_handle *handle)
Remove the handle from the map if Occupied.
CCC_Handle_index CCC_array_adaptive_map_reverse_end(CCC_Array_adaptive_map const *map)
Return the reverse_end of a reverse inorder traversal of the map. O(1).
CCC_Count CCC_array_adaptive_map_count(CCC_Array_adaptive_map const *map)
Returns the count of map occupied slots.
CCC_Handle_status CCC_array_adaptive_map_handle_status(CCC_Array_adaptive_map_handle const *handle)
Obtain the handle status from a container handle.
CCC_Result CCC_array_adaptive_map_clear_and_free(CCC_Array_adaptive_map *map, CCC_Destructor const *destructor, CCC_Allocator const *allocator)
Frees all slots in the map and frees the underlying buffer.
CCC_Handle_index CCC_array_adaptive_map_get_key_value(CCC_Array_adaptive_map *map, void const *key)
Returns a reference into the map at handle key.
CCC_Handle_index CCC_array_adaptive_map_insert_handle(CCC_Array_adaptive_map_handle const *handle, void const *type, CCC_Allocator const *allocator)
Inserts the provided handle invariantly.
CCC_Tribool CCC_array_adaptive_map_is_empty(CCC_Array_adaptive_map const *map)
Returns the size status of the map.
CCC_Handle CCC_array_adaptive_map_remove_key_value(CCC_Array_adaptive_map *map, void *type_output)
Removes the key value in the map storing the old value, if present, in the struct containing type_out...
CCC_Handle CCC_array_adaptive_map_swap_handle(CCC_Array_adaptive_map *map, void *type_output, CCC_Allocator const *allocator)
Invariantly inserts the key value type.
CCC_Handle_index CCC_array_adaptive_map_end(CCC_Array_adaptive_map const *map)
Return the end of an inorder traversal of the map. O(1).
CCC_Handle_index CCC_array_adaptive_map_reverse_begin(CCC_Array_adaptive_map const *map)
Return the start of a reverse inorder traversal of the map. Amortized O(lg N).
CCC_Handle CCC_array_adaptive_map_try_insert(CCC_Array_adaptive_map *map, void const *type, CCC_Allocator const *allocator)
Attempts to insert the key value type.
CCC_Handle_index CCC_array_adaptive_map_unwrap(CCC_Array_adaptive_map_handle const *handle)
Unwraps the provided handle to obtain a view into the map element.
CCC_Handle_range_reverse CCC_array_adaptive_map_equal_range_reverse(CCC_Array_adaptive_map *map, void const *reverse_begin_key, void const *reverse_end_key)
Return an iterable range_reverse of values from [reverse_begin_key, end_key). Amortized O(lg N).
CCC_Result CCC_array_adaptive_map_reserve(CCC_Array_adaptive_map *map, size_t to_add, CCC_Allocator const *allocator)
Reserves space for at least to_add more elements.
CCC_Handle_range CCC_array_adaptive_map_equal_range(CCC_Array_adaptive_map *map, void const *begin_key, void const *end_key)
Return an iterable range of values from [begin_key, end_key). Amortized O(lg N).
CCC_Handle_index CCC_array_adaptive_map_or_insert(CCC_Array_adaptive_map_handle const *handle, void const *type, CCC_Allocator const *allocator)
Inserts the struct with user type if the handle is Vacant.
CCC_Tribool CCC_array_adaptive_map_contains(CCC_Array_adaptive_map *map, void const *key)
Searches the map for the presence of key.
CCC_Handle_index CCC_array_adaptive_map_next(CCC_Array_adaptive_map const *map, CCC_Handle_index iterator)
Return the next element in an inorder traversal of the map. O(1).
CCC_Handle_index CCC_array_adaptive_map_begin(CCC_Array_adaptive_map const *map)
Return the start of an inorder traversal of the map. Amortized O(lg N).
CCC_Array_adaptive_map_handle CCC_array_adaptive_map_handle(CCC_Array_adaptive_map *map, void const *key)
Obtains a handle for the provided key in the map for future use.
CCC_Count CCC_array_adaptive_map_capacity(CCC_Array_adaptive_map const *map)
Returns the capacity of the map representing total possible slots.
CCC_Handle_index CCC_array_adaptive_map_reverse_next(CCC_Array_adaptive_map const *map, CCC_Handle_index iterator)
Return the reverse_next element in a reverse inorder traversal of the map. O(1).
CCC_Tribool CCC_array_adaptive_map_occupied(CCC_Array_adaptive_map_handle const *handle)
Returns the Vacant or Occupied status of the handle.
The Private Array Adaptive Map Types and Interface.
The type passed by reference to any container function that may need to allocate memory....
Definition: types.h:384
Definition: private_array_adaptive_map.h:108
size_t index
Definition: private_array_adaptive_map.h:112
struct CCC_Array_adaptive_map * map
Definition: private_array_adaptive_map.h:110
Definition: private_array_adaptive_map.h:83
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:472
The result of a range_reverse query on iterable containers. Handles are stable indices into an array ...
Definition: types.h:97
The result of a range query on iterable containers. Handles are stable indices into an array until re...
Definition: types.h:82
An Occupied or Vacant handle to a flat searchable container entry.
Definition: types.h:150
The type passed by reference to any container function that may need to modify elements....
Definition: types.h:444
size_t CCC_Handle_index
A stable index to user data in a container that uses a flat array as the underlying storage method.
Definition: types.h:72
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