53#ifndef CCC_ARRAY_ADAPTIVE_MAP_H
54#define CCC_ARRAY_ADAPTIVE_MAP_H
60#include "private/private_array_adaptive_map.h"
144#define CCC_array_adaptive_map_declare_fixed(fixed_map_type_name, type_name, \
146 CCC_private_array_adaptive_map_declare_fixed(fixed_map_type_name, \
152#define CCC_array_adaptive_map_fixed_capacity(fixed_map_type_name) \
153 CCC_private_array_adaptive_map_fixed_capacity(fixed_map_type_name)
166#define CCC_array_adaptive_map_initialize(type_name, type_key_field, compare, \
167 allocate, context_data, capacity, \
169 CCC_private_array_adaptive_map_initialize(type_name, type_key_field, \
170 compare, allocate, context_data, \
171 capacity, memory_pointer)
229#define CCC_array_adaptive_map_from(type_key_field, compare, allocate, \
230 context_data, optional_capacity, \
231 type_compound_literal_array...) \
232 CCC_private_array_adaptive_map_from(type_key_field, compare, allocate, \
233 context_data, optional_capacity, \
234 type_compound_literal_array)
281#define CCC_array_adaptive_map_with_capacity( \
282 type_name, type_key_field, compare, allocate, context_data, capacity) \
283 CCC_private_array_adaptive_map_with_capacity( \
284 type_name, type_key_field, compare, allocate, context_data, capacity)
313#define CCC_array_adaptive_map_with_compound_literal(type_key_field, compare, \
315 CCC_private_array_adaptive_map_with_compound_literal( \
316 type_key_field, compare, compound_literal)
347#define CCC_array_adaptive_map_with_context_compound_literal( \
348 type_key_field, compare, context, compound_literal) \
349 CCC_private_array_adaptive_map_with_context_compound_literal( \
350 type_key_field, compare, context, compound_literal)
380#define CCC_array_adaptive_map_with_allocator(type_name, type_key_field, \
382 CCC_private_array_adaptive_map_with_allocator(type_name, type_key_field, \
415#define CCC_array_adaptive_map_with_context_allocator( \
416 type_name, type_key_field, compare, allocate, context) \
417 CCC_private_array_adaptive_map_with_context_allocator( \
418 type_name, type_key_field, compare, allocate, context)
598#define CCC_array_adaptive_map_as(map_pointer, type_name, array_index...) \
599 CCC_private_array_adaptive_map_as(map_pointer, type_name, array_index)
650#define CCC_array_adaptive_map_swap_handle_wrap(map_pointer, \
651 type_output_pointer) \
654 CCC_array_adaptive_map_swap_handle((map_pointer), \
655 (type_output_pointer)) \
677#define CCC_array_adaptive_map_try_insert_wrap(map_pointer, type_pointer) \
680 CCC_array_adaptive_map_try_insert((map_pointer), (type_pointer)) \
697#define CCC_array_adaptive_map_try_insert_with(map_pointer, key, \
698 type_compound_literal...) \
701 CCC_private_array_adaptive_map_try_insert_with(map_pointer, key, \
702 type_compound_literal) \
730#define CCC_array_adaptive_map_insert_or_assign_with(map_pointer, key, \
731 type_compound_literal...) \
734 CCC_private_array_adaptive_map_insert_or_assign_with( \
735 map_pointer, key, type_compound_literal) \
763#define CCC_array_adaptive_map_remove_key_value_wrap(map_pointer, \
764 type_output_pointer) \
767 CCC_array_adaptive_map_remove_key_value((map_pointer), \
768 (type_output_pointer)) \
806#define CCC_array_adaptive_map_handle_wrap(array_pointer, key_pointer) \
807 &(CCC_Array_adaptive_map_handle) \
809 CCC_array_adaptive_map_handle((array_pointer), (key_pointer)).private \
874#define CCC_array_adaptive_map_and_modify_with(array_pointer, type_name, \
876 &(CCC_Array_adaptive_map_handle) \
878 CCC_private_array_adaptive_map_and_modify_with( \
879 array_pointer, type_name, closure_over_T) \
908#define CCC_array_adaptive_map_or_insert_with(array_pointer, \
909 type_compound_literal...) \
910 CCC_private_array_adaptive_map_or_insert_with(array_pointer, \
911 type_compound_literal)
929#define CCC_array_adaptive_map_insert_array_with(array_pointer, \
930 type_compound_literal...) \
931 CCC_private_array_adaptive_map_insert_array_with(array_pointer, \
932 type_compound_literal)
947#define CCC_array_adaptive_map_remove_handle_wrap(array_pointer) \
950 CCC_array_adaptive_map_remove_handle((array_pointer)).private \
1014 void const *begin_key,
void const *end_key);
1023#define CCC_array_adaptive_map_equal_range_wrap(map_pointer, \
1024 begin_and_end_key_pointers...) \
1025 &(CCC_Handle_range) \
1027 CCC_array_adaptive_map_equal_range(map_pointer, \
1028 begin_and_end_key_pointers) \
1057 void const *reverse_begin_key,
1058 void const *reverse_end_key);
1067#define CCC_array_adaptive_map_equal_range_reverse_wrap( \
1068 map_pointer, reverse_begin_and_reverse_end_key_pointers...) \
1069 &(CCC_Handle_range_reverse) \
1071 CCC_array_adaptive_map_equal_range_reverse( \
1072 map_pointer, reverse_begin_and_reverse_end_key_pointers) \
1223#ifdef ARRAY_ADAPTIVE_MAP_USING_NAMESPACE_CCC
1226# define array_adaptive_map_declare_fixed(arguments...) \
1227 CCC_array_adaptive_map_declare_fixed(arguments)
1228# define array_adaptive_map_fixed_capacity(arguments...) \
1229 CCC_array_adaptive_map_fixed_capacity(arguments)
1230# define array_adaptive_map_initialize(arguments...) \
1231 CCC_array_adaptive_map_initialize(arguments)
1232# define array_adaptive_map_from(arguments...) \
1233 CCC_array_adaptive_map_from(arguments)
1234# define array_adaptive_map_with_capacity(arguments...) \
1235 CCC_array_adaptive_map_with_capacity(arguments)
1236# define array_adaptive_map_with_compound_literal(arguments...) \
1237 CCC_array_adaptive_map_with_compound_literal(arguments)
1238# define array_adaptive_map_with_context_compound_literal(arguments...) \
1239 CCC_array_adaptive_map_with_context_compound_literal(arguments)
1240# define array_adaptive_map_with_allocator(arguments...) \
1241 CCC_array_adaptive_map_with_allocator(arguments)
1242# define array_adaptive_map_with_context_allocator(arguments...) \
1243 CCC_array_adaptive_map_with_context_allocator(arguments)
1244# define array_adaptive_map_at(arguments...) \
1245 CCC_array_adaptive_map_at(arguments)
1246# define array_adaptive_map_as(arguments...) \
1247 CCC_array_adaptive_map_as(arguments)
1248# define array_adaptive_map_and_modify_with(arguments...) \
1249 CCC_array_adaptive_map_and_modify_with(arguments)
1250# define array_adaptive_map_or_insert_with(arguments...) \
1251 CCC_array_adaptive_map_or_insert_with(arguments)
1252# define array_adaptive_map_insert_array_with(arguments...) \
1253 CCC_array_adaptive_map_insert_array_with(arguments)
1254# define array_adaptive_map_try_insert_with(arguments...) \
1255 CCC_array_adaptive_map_try_insert_with(arguments)
1256# define array_adaptive_map_insert_or_assign_with(arguments...) \
1257 CCC_array_adaptive_map_insert_or_assign_with(arguments)
1258# define array_adaptive_map_copy(arguments...) \
1259 CCC_array_adaptive_map_copy(arguments)
1260# define array_adaptive_map_reserve(arguments...) \
1261 CCC_array_adaptive_map_reserve(arguments)
1262# define array_adaptive_map_contains(arguments...) \
1263 CCC_array_adaptive_map_contains(arguments)
1264# define array_adaptive_map_get_key_value(arguments...) \
1265 CCC_array_adaptive_map_get_key_value(arguments)
1266# define array_adaptive_map_swap_handle_wrap(arguments...) \
1267 CCC_array_adaptive_map_swap_handle_wrap(arguments)
1268# define array_adaptive_map_try_insert_wrap(arguments...) \
1269 CCC_array_adaptive_map_try_insert_wrap(arguments)
1270# define array_adaptive_map_remove_key_value_wrap(arguments...) \
1271 CCC_array_adaptive_map_remove_key_value_wrap(arguments)
1272# define array_adaptive_map_remove_handle_wrap(arguments...) \
1273 CCC_array_adaptive_map_remove_handle_wrap(arguments)
1274# define array_adaptive_map_swap_handle(arguments...) \
1275 CCC_array_adaptive_map_swap_handle(arguments)
1276# define array_adaptive_map_try_insert(arguments...) \
1277 CCC_array_adaptive_map_try_insert(arguments)
1278# define array_adaptive_map_insert_or_assign(arguments...) \
1279 CCC_array_adaptive_map_insert_or_assign(arguments)
1280# define array_adaptive_map_remove_key_value(arguments...) \
1281 CCC_array_adaptive_map_remove_key_value(arguments)
1282# define array_adaptive_map_remove_handle(arguments...) \
1283 CCC_array_adaptive_map_remove_handle(arguments)
1284# define array_adaptive_map_handle_wrap(arguments...) \
1285 CCC_array_adaptive_map_handle_wrap(arguments)
1286# define array_adaptive_map_handle(arguments...) \
1287 CCC_array_adaptive_map_handle(arguments)
1288# define array_adaptive_map_and_modify(arguments...) \
1289 CCC_array_adaptive_map_and_modify(arguments)
1290# define array_adaptive_map_and_modify_context(arguments...) \
1291 CCC_array_adaptive_map_and_modify_context(arguments)
1292# define array_adaptive_map_or_insert(arguments...) \
1293 CCC_array_adaptive_map_or_insert(arguments)
1294# define array_adaptive_map_insert_handle(arguments...) \
1295 CCC_array_adaptive_map_insert_handle(arguments)
1296# define array_adaptive_map_unwrap(arguments...) \
1297 CCC_array_adaptive_map_unwrap(arguments)
1298# define array_adaptive_map_insert_error(arguments...) \
1299 CCC_array_adaptive_map_insert_error(arguments)
1300# define array_adaptive_map_occupied(arguments...) \
1301 CCC_array_adaptive_map_occupied(arguments)
1302# define array_adaptive_map_clear(arguments...) \
1303 CCC_array_adaptive_map_clear(arguments)
1304# define array_adaptive_map_clear_and_free(arguments...) \
1305 CCC_array_adaptive_map_clear_and_free(arguments)
1306# define array_adaptive_map_clear_and_free_reserve(arguments...) \
1307 CCC_array_adaptive_map_clear_and_free_reserve(arguments)
1308# define array_adaptive_map_begin(arguments...) \
1309 CCC_array_adaptive_map_begin(arguments)
1310# define array_adaptive_map_reverse_begin(arguments...) \
1311 CCC_array_adaptive_map_reverse_begin(arguments)
1312# define array_adaptive_map_end(arguments...) \
1313 CCC_array_adaptive_map_end(arguments)
1314# define array_adaptive_map_reverse_end(arguments...) \
1315 CCC_array_adaptive_map_reverse_end(arguments)
1316# define array_adaptive_map_next(arguments...) \
1317 CCC_array_adaptive_map_next(arguments)
1318# define array_adaptive_map_reverse_next(arguments...) \
1319 CCC_array_adaptive_map_reverse_next(arguments)
1320# define array_adaptive_map_count(arguments...) \
1321 CCC_array_adaptive_map_count(arguments)
1322# define array_adaptive_map_capacity(arguments...) \
1323 CCC_array_adaptive_map_capacity(arguments)
1324# define array_adaptive_map_is_empty(arguments...) \
1325 CCC_array_adaptive_map_is_empty(arguments)
1326# define array_adaptive_map_validate(arguments...) \
1327 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_Result CCC_array_adaptive_map_reserve(CCC_Array_adaptive_map *map, size_t to_add, CCC_Allocator *allocate)
Reserves space for at least to_add more elements.
CCC_Result CCC_array_adaptive_map_copy(CCC_Array_adaptive_map *destination, CCC_Array_adaptive_map const *source, CCC_Allocator *allocate)
Copy the map at source to destination.
CCC_Array_adaptive_map_handle * CCC_array_adaptive_map_and_modify(CCC_Array_adaptive_map_handle *handle, CCC_Type_modifier *modify)
Modifies the provided handle if it is Occupied.
CCC_Handle CCC_array_adaptive_map_swap_handle(CCC_Array_adaptive_map *map, void *type_output)
Invariantly inserts the key value wrapping type.
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_Array_adaptive_map_handle * CCC_array_adaptive_map_and_modify_context(CCC_Array_adaptive_map_handle *handle, CCC_Type_modifier *modify, void *context)
Modifies the provided handle if it is Occupied.
CCC_Handle_index CCC_array_adaptive_map_or_insert(CCC_Array_adaptive_map_handle const *handle, void const *type)
Inserts the struct with user type if the handle is Vacant.
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_Result CCC_array_adaptive_map_clear_and_free_reserve(CCC_Array_adaptive_map *map, CCC_Type_destructor *destroy, CCC_Allocator *allocate)
Frees all slots in the array_adaptive_map and frees the underlying Buffer that was previously dynamic...
CCC_Handle CCC_array_adaptive_map_try_insert(CCC_Array_adaptive_map *map, void const *type)
Attempts to insert the key value wrapping type.
CCC_Result CCC_array_adaptive_map_clear(CCC_Array_adaptive_map *map, CCC_Type_destructor *destroy)
Frees all slots in the map for use without affecting capacity.
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_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_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_insert_or_assign(CCC_Array_adaptive_map *map, void const *type)
Invariantly inserts or overwrites a user struct into the map.
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_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_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_insert_handle(CCC_Array_adaptive_map_handle const *handle, void const *type)
Inserts the provided handle invariantly.
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_Result CCC_array_adaptive_map_clear_and_free(CCC_Array_adaptive_map *map, CCC_Type_destructor *destroy)
Frees all slots in the map and frees the underlying buffer.
CCC_Tribool CCC_array_adaptive_map_occupied(CCC_Array_adaptive_map_handle const *handle)
Returns the Vacant or Occupied status of the handle.
Definition: private_array_adaptive_map.h:100
Definition: private_array_adaptive_map.h:72
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:202
Definition: private_types.h:173
Definition: private_types.h:80
The C Container Collection Fundamental Types.
enum CCC_Entry_status CCC_Handle_status
The status monitoring and handle state once it is obtained.
Definition: types.h:119
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:109
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_array_adaptive_map.h:116
Definition: private_types.h:221