53#ifndef CCC_ARRAY_ADAPTIVE_MAP_H
54#define CCC_ARRAY_ADAPTIVE_MAP_H
60#include "private/private_array_adaptive_map.h"
152#define CCC_array_adaptive_map_declare_fixed(fixed_map_type_name, type_name, \
154 CCC_private_array_adaptive_map_declare_fixed(fixed_map_type_name, \
160#define CCC_array_adaptive_map_fixed_capacity(fixed_map_type_name) \
161 CCC_private_array_adaptive_map_fixed_capacity(fixed_map_type_name)
174#define CCC_array_adaptive_map_initialize(memory_pointer, type_name, \
175 type_intruder_field, compare, \
176 allocate, context_data, capacity) \
177 CCC_private_array_adaptive_map_initialize( \
178 memory_pointer, type_name, type_intruder_field, compare, allocate, \
179 context_data, capacity)
237#define CCC_array_adaptive_map_from(type_key_field, compare, allocate, \
238 context_data, optional_capacity, \
239 type_compound_literal_array...) \
240 CCC_private_array_adaptive_map_from(type_key_field, compare, allocate, \
241 context_data, optional_capacity, \
242 type_compound_literal_array)
289#define CCC_array_adaptive_map_with_capacity( \
290 type_name, type_key_field, compare, allocate, context_data, capacity) \
291 CCC_private_array_adaptive_map_with_capacity( \
292 type_name, type_key_field, compare, allocate, context_data, capacity)
321#define CCC_array_adaptive_map_with_compound_literal(type_key_field, compare, \
323 CCC_private_array_adaptive_map_with_compound_literal( \
324 type_key_field, compare, compound_literal)
355#define CCC_array_adaptive_map_with_context_compound_literal( \
356 type_key_field, compare, context, compound_literal) \
357 CCC_private_array_adaptive_map_with_context_compound_literal( \
358 type_key_field, compare, context, compound_literal)
538#define CCC_array_adaptive_map_as(map_pointer, type_name, array_index...) \
539 CCC_private_array_adaptive_map_as(map_pointer, type_name, array_index)
590#define CCC_array_adaptive_map_swap_handle_wrap(map_pointer, \
591 type_output_pointer) \
594 CCC_array_adaptive_map_swap_handle((map_pointer), \
595 (type_output_pointer)) \
617#define CCC_array_adaptive_map_try_insert_wrap(map_pointer, type_pointer) \
620 CCC_array_adaptive_map_try_insert((map_pointer), (type_pointer)) \
637#define CCC_array_adaptive_map_try_insert_with(map_pointer, key, \
638 type_compound_literal...) \
641 CCC_private_array_adaptive_map_try_insert_with(map_pointer, key, \
642 type_compound_literal) \
670#define CCC_array_adaptive_map_insert_or_assign_with(map_pointer, key, \
671 type_compound_literal...) \
674 CCC_private_array_adaptive_map_insert_or_assign_with( \
675 map_pointer, key, type_compound_literal) \
703#define CCC_array_adaptive_map_remove_key_value_wrap(map_pointer, \
704 type_output_pointer) \
707 CCC_array_adaptive_map_remove_key_value((map_pointer), \
708 (type_output_pointer)) \
746#define CCC_array_adaptive_map_handle_wrap(array_pointer, key_pointer) \
747 &(CCC_Array_adaptive_map_handle) \
749 CCC_array_adaptive_map_handle((array_pointer), (key_pointer)).private \
814#define CCC_array_adaptive_map_and_modify_with(array_pointer, type_name, \
816 &(CCC_Array_adaptive_map_handle) \
818 CCC_private_array_adaptive_map_and_modify_with( \
819 array_pointer, type_name, closure_over_T) \
848#define CCC_array_adaptive_map_or_insert_with(array_pointer, \
849 type_compound_literal...) \
850 CCC_private_array_adaptive_map_or_insert_with(array_pointer, \
851 type_compound_literal)
869#define CCC_array_adaptive_map_insert_array_with(array_pointer, \
870 type_compound_literal...) \
871 CCC_private_array_adaptive_map_insert_array_with(array_pointer, \
872 type_compound_literal)
887#define CCC_array_adaptive_map_remove_handle_wrap(array_pointer) \
890 CCC_array_adaptive_map_remove_handle((array_pointer)).private \
954 void const *begin_key,
void const *end_key);
963#define CCC_array_adaptive_map_equal_range_wrap(map_pointer, \
964 begin_and_end_key_pointers...) \
965 &(CCC_Handle_range) \
967 CCC_array_adaptive_map_equal_range(map_pointer, \
968 begin_and_end_key_pointers) \
997 void const *reverse_begin_key,
998 void const *reverse_end_key);
1007#define CCC_array_adaptive_map_equal_range_reverse_wrap( \
1008 map_pointer, reverse_begin_and_reverse_end_key_pointers...) \
1009 &(CCC_Handle_range_reverse) \
1011 CCC_array_adaptive_map_equal_range_reverse( \
1012 map_pointer, reverse_begin_and_reverse_end_key_pointers) \
1163#ifdef ARRAY_ADAPTIVE_MAP_USING_NAMESPACE_CCC
1166# define array_adaptive_map_declare_fixed(args...) \
1167 CCC_array_adaptive_map_declare_fixed(args)
1168# define array_adaptive_map_fixed_capacity(args...) \
1169 CCC_array_adaptive_map_fixed_capacity(args)
1170# define array_adaptive_map_initialize(args...) \
1171 CCC_array_adaptive_map_initialize(args)
1172# define array_adaptive_map_from(args...) CCC_array_adaptive_map_from(args)
1173# define array_adaptive_map_with_capacity(args...) \
1174 CCC_array_adaptive_map_with_capacity(args)
1175# define array_adaptive_map_with_compound_literal(args...) \
1176 CCC_array_adaptive_map_with_compound_literal(args)
1177# define array_adaptive_map_with_context_compound_literal(args...) \
1178 CCC_array_adaptive_map_with_context_compound_literal(args)
1179# define array_adaptive_map_at(args...) CCC_array_adaptive_map_at(args)
1180# define array_adaptive_map_as(args...) CCC_array_adaptive_map_as(args)
1181# define array_adaptive_map_and_modify_with(args...) \
1182 CCC_array_adaptive_map_and_modify_with(args)
1183# define array_adaptive_map_or_insert_with(args...) \
1184 CCC_array_adaptive_map_or_insert_with(args)
1185# define array_adaptive_map_insert_array_with(args...) \
1186 CCC_array_adaptive_map_insert_array_with(args)
1187# define array_adaptive_map_try_insert_with(args...) \
1188 CCC_array_adaptive_map_try_insert_with(args)
1189# define array_adaptive_map_insert_or_assign_with(args...) \
1190 CCC_array_adaptive_map_insert_or_assign_with(args)
1191# define array_adaptive_map_copy(args...) CCC_array_adaptive_map_copy(args)
1192# define array_adaptive_map_reserve(args...) \
1193 CCC_array_adaptive_map_reserve(args)
1194# define array_adaptive_map_contains(args...) \
1195 CCC_array_adaptive_map_contains(args)
1196# define array_adaptive_map_get_key_value(args...) \
1197 CCC_array_adaptive_map_get_key_value(args)
1198# define array_adaptive_map_swap_handle_wrap(args...) \
1199 CCC_array_adaptive_map_swap_handle_wrap(args)
1200# define array_adaptive_map_try_insert_wrap(args...) \
1201 CCC_array_adaptive_map_try_insert_wrap(args)
1202# define array_adaptive_map_remove_key_value_wrap(args...) \
1203 CCC_array_adaptive_map_remove_key_value_wrap(args)
1204# define array_adaptive_map_remove_handle_wrap(args...) \
1205 CCC_array_adaptive_map_remove_handle_wrap(args)
1206# define array_adaptive_map_swap_handle(args...) \
1207 CCC_array_adaptive_map_swap_handle(args)
1208# define array_adaptive_map_try_insert(args...) \
1209 CCC_array_adaptive_map_try_insert(args)
1210# define array_adaptive_map_insert_or_assign(args...) \
1211 CCC_array_adaptive_map_insert_or_assign(args)
1212# define array_adaptive_map_remove_key_value(args...) \
1213 CCC_array_adaptive_map_remove_key_value(args)
1214# define array_adaptive_map_remove_handle(args...) \
1215 CCC_array_adaptive_map_remove_handle(args)
1216# define array_adaptive_map_handle_wrap(args...) \
1217 CCC_array_adaptive_map_handle_wrap(args)
1218# define array_adaptive_map_handle(args...) \
1219 CCC_array_adaptive_map_handle(args)
1220# define array_adaptive_map_and_modify(args...) \
1221 CCC_array_adaptive_map_and_modify(args)
1222# define array_adaptive_map_and_modify_context(args...) \
1223 CCC_array_adaptive_map_and_modify_context(args)
1224# define array_adaptive_map_or_insert(args...) \
1225 CCC_array_adaptive_map_or_insert(args)
1226# define array_adaptive_map_insert_handle(args...) \
1227 CCC_array_adaptive_map_insert_handle(args)
1228# define array_adaptive_map_unwrap(args...) \
1229 CCC_array_adaptive_map_unwrap(args)
1230# define array_adaptive_map_insert_error(args...) \
1231 CCC_array_adaptive_map_insert_error(args)
1232# define array_adaptive_map_occupied(args...) \
1233 CCC_array_adaptive_map_occupied(args)
1234# define array_adaptive_map_clear(args...) CCC_array_adaptive_map_clear(args)
1235# define array_adaptive_map_clear_and_free(args...) \
1236 CCC_array_adaptive_map_clear_and_free(args)
1237# define array_adaptive_map_clear_and_free_reserve(args...) \
1238 CCC_array_adaptive_map_clear_and_free_reserve(args)
1239# define array_adaptive_map_begin(args...) CCC_array_adaptive_map_begin(args)
1240# define array_adaptive_map_reverse_begin(args...) \
1241 CCC_array_adaptive_map_reverse_begin(args)
1242# define array_adaptive_map_end(args...) CCC_array_adaptive_map_end(args)
1243# define array_adaptive_map_reverse_end(args...) \
1244 CCC_array_adaptive_map_reverse_end(args)
1245# define array_adaptive_map_next(args...) CCC_array_adaptive_map_next(args)
1246# define array_adaptive_map_reverse_next(args...) \
1247 CCC_array_adaptive_map_reverse_next(args)
1248# define array_adaptive_map_count(args...) CCC_array_adaptive_map_count(args)
1249# define array_adaptive_map_capacity(args...) \
1250 CCC_array_adaptive_map_capacity(args)
1251# define array_adaptive_map_is_empty(args...) \
1252 CCC_array_adaptive_map_is_empty(args)
1253# define array_adaptive_map_validate(args...) \
1254 CCC_array_adaptive_map_validate(args)
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:98
Definition: private_array_adaptive_map.h:70
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:114
Definition: private_types.h:221