55#ifndef CCC_ARRAY_TREE_MAP_H
56#define CCC_ARRAY_TREE_MAP_H
62#include "private/private_array_tree_map.h"
151#define CCC_array_tree_map_declare_fixed(fixed_map_type_name, type_name, \
153 CCC_private_array_tree_map_declare_fixed(fixed_map_type_name, type_name, \
159#define CCC_array_tree_map_fixed_capacity(fixed_map_type_name) \
160 CCC_private_array_tree_map_fixed_capacity(fixed_map_type_name)
173#define CCC_array_tree_map_initialize(type_name, type_key_field, compare, \
174 allocate, context_data, capacity, \
176 CCC_private_array_tree_map_initialize(type_name, type_key_field, compare, \
177 allocate, context_data, capacity, \
236#define CCC_array_tree_map_from(type_key_field, compare, allocate, \
237 context_data, optional_capacity, \
238 type_compound_literal_array...) \
239 CCC_private_array_tree_map_from(type_key_field, compare, allocate, \
240 context_data, optional_capacity, \
241 type_compound_literal_array)
288#define CCC_array_tree_map_with_capacity(type_name, type_key_field, compare, \
289 allocate, context_data, capacity) \
290 CCC_private_array_tree_map_with_capacity( \
291 type_name, type_key_field, compare, allocate, context_data, capacity)
320#define CCC_array_tree_map_with_compound_literal(type_key_field, compare, \
322 CCC_private_array_tree_map_with_compound_literal(type_key_field, compare, \
354#define CCC_array_tree_map_with_context_compound_literal( \
355 type_key_field, compare, context, compound_literal) \
356 CCC_private_array_tree_map_with_context_compound_literal( \
357 type_key_field, compare, context, compound_literal)
387#define CCC_array_tree_map_with_allocator(type_name, type_key_field, compare, \
389 CCC_private_array_tree_map_with_allocator(type_name, type_key_field, \
422#define CCC_array_tree_map_with_context_allocator(type_name, type_key_field, \
423 compare, allocate, context) \
424 CCC_private_array_tree_map_with_context_allocator( \
425 type_name, type_key_field, compare, allocate, context)
604#define CCC_array_tree_map_as(array_tree_map_pointer, type_name, \
606 CCC_private_array_tree_map_as(array_tree_map_pointer, type_name, \
654#define CCC_array_tree_map_swap_handle_wrap(array_tree_map_pointer, \
655 type_output_pointer) \
658 CCC_array_tree_map_swap_handle((array_tree_map_pointer), \
659 (type_output_pointer)) \
680#define CCC_array_tree_map_try_insert_wrap(array_tree_map_pointer, \
684 CCC_array_tree_map_try_insert((array_tree_map_pointer), \
702#define CCC_array_tree_map_try_insert_with(array_tree_map_pointer, key, \
703 type_compound_literal...) \
706 CCC_private_array_tree_map_try_insert_with(array_tree_map_pointer, \
707 key, type_compound_literal) \
734#define CCC_array_tree_map_insert_or_assign_with(array_tree_map_pointer, key, \
735 type_compound_literal...) \
738 CCC_private_array_tree_map_insert_or_assign_with( \
739 array_tree_map_pointer, key, type_compound_literal) \
764#define CCC_array_tree_map_remove_key_value_wrap(array_tree_map_pointer, \
765 type_output_pointer) \
768 CCC_array_tree_map_remove_key_value((array_tree_map_pointer), \
769 (type_output_pointer)) \
807#define CCC_array_tree_map_handle_wrap(array_tree_map_pointer, key_pointer) \
808 &(CCC_Array_tree_map_handle) \
810 CCC_array_tree_map_handle((array_tree_map_pointer), (key_pointer)) \
876#define CCC_array_tree_map_and_modify_with(map_array_pointer, type_name, \
878 &(CCC_Array_tree_map_handle) \
880 CCC_private_array_tree_map_and_modify_with(map_array_pointer, \
881 type_name, closure_over_T) \
911#define CCC_array_tree_map_or_insert_with(map_array_pointer, \
912 type_compound_literal...) \
913 CCC_private_array_tree_map_or_insert_with(map_array_pointer, \
914 type_compound_literal)
934#define CCC_array_tree_map_insert_array_with(map_array_pointer, \
935 type_compound_literal...) \
936 CCC_private_array_tree_map_insert_array_with(map_array_pointer, \
937 type_compound_literal)
957#define CCC_array_tree_map_remove_handle_wrap(map_array_pointer) \
960 CCC_array_tree_map_remove_handle((map_array_pointer)).private \
1090 void const *begin_key,
void const *end_key);
1098#define CCC_array_tree_map_equal_range_wrap(array_tree_map_pointer, \
1099 begin_and_end_key_pointers...) \
1100 &(CCC_Handle_range) \
1102 CCC_array_tree_map_equal_range((array_tree_map_pointer), \
1103 (begin_and_end_key_pointers)) \
1132 void const *reverse_begin_key,
1133 void const *reverse_end_key);
1142#define CCC_array_tree_map_equal_range_reverse_wrap( \
1143 array_tree_map_pointer, reverse_begin_and_reverse_end_key_pointers...) \
1144 &(CCC_Handle_range_reverse) \
1146 CCC_array_tree_map_equal_range_reverse( \
1147 (array_tree_map_pointer), \
1148 (reverse_begin_and_reverse_end_key_pointers)) \
1235#ifdef ARRAY_TREE_MAP_USING_NAMESPACE_CCC
1238# define array_tree_map_declare_fixed(arguments...) \
1239 CCC_array_tree_map_declare_fixed(arguments)
1240# define array_tree_map_initialize(arguments...) \
1241 CCC_array_tree_map_initialize(arguments)
1242# define array_tree_map_from(arguments...) CCC_array_tree_map_from(arguments)
1243# define array_tree_map_with_capacity(arguments...) \
1244 CCC_array_tree_map_with_capacity(arguments)
1245# define array_tree_map_with_compound_literal(arguments...) \
1246 CCC_array_tree_map_with_compound_literal(arguments)
1247# define array_tree_map_with_context_compound_literal(arguments...) \
1248 CCC_array_tree_map_with_context_compound_literal(arguments)
1249# define array_tree_map_with_allocator(arguments...) \
1250 CCC_array_tree_map_with_allocator(arguments)
1251# define array_tree_map_with_context_allocator(arguments...) \
1252 CCC_array_tree_map_with_context_allocator(arguments)
1253# define array_tree_map_fixed_capacity(arguments...) \
1254 CCC_array_tree_map_fixed_capacity(arguments)
1255# define array_tree_map_copy(arguments...) CCC_array_tree_map_copy(arguments)
1256# define array_tree_map_reserve(arguments...) \
1257 CCC_array_tree_map_reserve(arguments)
1258# define array_tree_map_at(arguments...) CCC_array_tree_map_at(arguments)
1259# define array_tree_map_as(arguments...) CCC_array_tree_map_as(arguments)
1260# define array_tree_map_and_modify_with(arguments...) \
1261 CCC_array_tree_map_and_modify_with(arguments)
1262# define array_tree_map_or_insert_with(arguments...) \
1263 CCC_array_tree_map_or_insert_with(arguments)
1264# define array_tree_map_insert_array_with(arguments...) \
1265 CCC_array_tree_map_insert_array_with(arguments)
1266# define array_tree_map_try_insert_with(arguments...) \
1267 CCC_array_tree_map_try_insert_with(arguments)
1268# define array_tree_map_insert_or_assign_with(arguments...) \
1269 CCC_array_tree_map_insert_or_assign_with(arguments)
1270# define array_tree_map_contains(arguments...) \
1271 CCC_array_tree_map_contains(arguments)
1272# define array_tree_map_get_key_value(arguments...) \
1273 CCC_array_tree_map_get_key_value(arguments)
1274# define array_tree_map_swap_handle(arguments...) \
1275 CCC_array_tree_map_swap_handle(arguments)
1276# define array_tree_map_swap_handle_wrap(arguments...) \
1277 CCC_array_tree_map_swap_handle_wrap(arguments)
1278# define array_tree_map_begin(arguments...) \
1279 CCC_array_tree_map_begin(arguments)
1280# define array_tree_map_reverse_begin(arguments...) \
1281 CCC_array_tree_map_reverse_begin(arguments)
1282# define array_tree_map_next(arguments...) CCC_array_tree_map_next(arguments)
1283# define array_tree_map_reverse_next(arguments...) \
1284 CCC_array_tree_map_reverse_next(arguments)
1285# define array_tree_map_end(arguments...) CCC_array_tree_map_end(arguments)
1286# define array_tree_map_reverse_end(arguments...) \
1287 CCC_array_tree_map_reverse_end(arguments)
1288# define array_tree_map_is_empty(arguments...) \
1289 CCC_array_tree_map_is_empty(arguments)
1290# define array_tree_map_count(arguments...) \
1291 CCC_array_tree_map_count(arguments)
1292# define array_tree_map_capacity(arguments...) \
1293 CCC_array_tree_map_capacity(arguments)
1294# define array_tree_map_clear(arguments...) \
1295 CCC_array_tree_map_clear(arguments)
1296# define array_tree_map_clear_and_free(arguments...) \
1297 CCC_array_tree_map_clear_and_free(arguments)
1298# define array_tree_map_clear_and_free_reserve(arguments...) \
1299 CCC_array_tree_map_clear_and_free_reserve(arguments)
1300# define array_tree_map_validate(arguments...) \
1301 CCC_array_tree_map_validate(arguments)
CCC_Handle CCC_array_tree_map_swap_handle(CCC_Array_tree_map *map, void *type_output)
Invariantly inserts the key value in type_output.
CCC_Handle_index CCC_array_tree_map_reverse_begin(CCC_Array_tree_map const *map)
Return the start of a reverse inorder traversal of the map. O(lg N).
CCC_Handle_index CCC_array_tree_map_reverse_next(CCC_Array_tree_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_tree_map_copy(CCC_Array_tree_map *destination, CCC_Array_tree_map const *source, CCC_Allocator *allocate)
Copy the map at source to destination.
CCC_Tribool CCC_array_tree_map_validate(CCC_Array_tree_map const *map)
Validation of invariants for the map.
CCC_Handle_range_reverse CCC_array_tree_map_equal_range_reverse(CCC_Array_tree_map const *map, void const *reverse_begin_key, void const *reverse_end_key)
Return an iterable range_reverse of values from [begin_key, end_key). O(lg N).
CCC_Array_tree_map_handle * CCC_array_tree_map_and_modify(CCC_Array_tree_map_handle *handle, CCC_Type_modifier *modify)
Modifies the provided handle if it is Occupied.
CCC_Result CCC_array_tree_map_clear_and_free_reserve(CCC_Array_tree_map *map, CCC_Type_destructor *destroy, CCC_Allocator *allocate)
Frees all slots in the map and frees the underlying Buffer that was previously dynamically reserved w...
CCC_Result CCC_array_tree_map_reserve(CCC_Array_tree_map *map, size_t to_add, CCC_Allocator *allocate)
Reserves space for at least to_add more elements.
CCC_Count CCC_array_tree_map_count(CCC_Array_tree_map const *map)
Returns the count of map occupied slots.
CCC_Tribool CCC_array_tree_map_occupied(CCC_Array_tree_map_handle const *handle)
Returns the Vacant or Occupied status of the handle.
CCC_Array_tree_map_handle * CCC_array_tree_map_and_modify_context(CCC_Array_tree_map_handle *handle, CCC_Type_modifier *modify, void *context)
Modifies the provided handle if it is Occupied.
CCC_Handle_index CCC_array_tree_map_begin(CCC_Array_tree_map const *map)
Return the start of an inorder traversal of the map. O(lg N).
CCC_Array_tree_map_handle CCC_array_tree_map_handle(CCC_Array_tree_map const *map, void const *key)
Obtains a handle for the provided key in the map for future use.
CCC_Result CCC_array_tree_map_clear(CCC_Array_tree_map *map, CCC_Type_destructor *destroy)
Frees all slots in the map for use without affecting capacity.
CCC_Handle CCC_array_tree_map_try_insert(CCC_Array_tree_map *map, void const *type)
Attempts to insert the key value in type.
CCC_Handle_index CCC_array_tree_map_get_key_value(CCC_Array_tree_map const *map, void const *key)
Returns a reference into the map at handle key.
CCC_Handle CCC_array_tree_map_remove_key_value(CCC_Array_tree_map *map, void *type_output)
Removes the key value in the map storing the old value, if present, in the struct containing type_out...
void * CCC_array_tree_map_at(CCC_Array_tree_map const *handle, CCC_Handle_index index)
Returns a reference to the user data at the provided handle.
CCC_Handle CCC_array_tree_map_insert_or_assign(CCC_Array_tree_map *map, void const *type)
Invariantly inserts or overwrites a user struct into the map.
CCC_Tribool CCC_array_tree_map_is_empty(CCC_Array_tree_map const *map)
Returns the size status of the map.
CCC_Count CCC_array_tree_map_capacity(CCC_Array_tree_map const *map)
Returns the capacity of the map representing total available slots.
CCC_Handle_index CCC_array_tree_map_or_insert(CCC_Array_tree_map_handle const *handle, void const *type)
Inserts the provided user type if the handle is Vacant.
CCC_Handle_index CCC_array_tree_map_next(CCC_Array_tree_map const *map, CCC_Handle_index iterator)
Return the next element in an inorder traversal of the map. O(1).
CCC_Handle CCC_array_tree_map_remove_handle(CCC_Array_tree_map_handle const *handle)
Remove the handle from the map if Occupied.
CCC_Handle_index CCC_array_tree_map_unwrap(CCC_Array_tree_map_handle const *handle)
Unwraps the provided handle to obtain a view into the map element.
CCC_Tribool CCC_array_tree_map_insert_error(CCC_Array_tree_map_handle const *handle)
Provides the status of the handle should an insertion follow.
CCC_Result CCC_array_tree_map_clear_and_free(CCC_Array_tree_map *map, CCC_Type_destructor *destroy)
Frees all slots in the map and frees the underlying buffer.
CCC_Handle_range CCC_array_tree_map_equal_range(CCC_Array_tree_map const *map, void const *begin_key, void const *end_key)
Return an iterable range of values from [begin_key, end_key). O(lgN).
CCC_Handle_index CCC_array_tree_map_reverse_end(CCC_Array_tree_map const *map)
Return the reverse_end of a reverse inorder traversal of the map. O(1).
CCC_Handle_index CCC_array_tree_map_insert_handle(CCC_Array_tree_map_handle const *handle, void const *type)
Inserts the provided user type invariantly.
CCC_Handle_status CCC_array_tree_map_handle_status(CCC_Array_tree_map_handle const *handle)
Obtain the handle status from a container handle.
CCC_Handle_index CCC_array_tree_map_end(CCC_Array_tree_map const *map)
Return the end of an inorder traversal of the map. O(1).
CCC_Tribool CCC_array_tree_map_contains(CCC_Array_tree_map const *map, void const *key)
Searches the map for the presence of key.
Definition: private_array_tree_map.h:166
Definition: private_array_tree_map.h:137
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_tree_map.h:179
Definition: private_types.h:221