55#ifndef CCC_ARRAY_TREE_MAP_H
56#define CCC_ARRAY_TREE_MAP_H
62#include "private/private_array_tree_map.h"
160#define CCC_array_tree_map_declare_fixed(fixed_map_type_name, type_name, \
162 CCC_private_array_tree_map_declare_fixed(fixed_map_type_name, type_name, \
168#define CCC_array_tree_map_fixed_capacity(fixed_map_type_name) \
169 CCC_private_array_tree_map_fixed_capacity(fixed_map_type_name)
184#define CCC_array_tree_map_initialize(memory_pointer, type_name, \
185 type_key_field, compare, allocate, \
186 context_data, capacity) \
187 CCC_private_array_tree_map_initialize(memory_pointer, type_name, \
188 type_key_field, compare, allocate, \
189 context_data, capacity)
247#define CCC_array_tree_map_from(type_key_field, compare, allocate, \
248 context_data, optional_capacity, \
249 type_compound_literal_array...) \
250 CCC_private_array_tree_map_from(type_key_field, compare, allocate, \
251 context_data, optional_capacity, \
252 type_compound_literal_array)
299#define CCC_array_tree_map_with_capacity(type_name, type_key_field, compare, \
300 allocate, context_data, capacity) \
301 CCC_private_array_tree_map_with_capacity( \
302 type_name, type_key_field, compare, allocate, context_data, capacity)
331#define CCC_array_tree_map_with_compound_literal(type_key_field, compare, \
333 CCC_private_array_tree_map_with_compound_literal(type_key_field, compare, \
365#define CCC_array_tree_map_with_context_compound_literal( \
366 type_key_field, compare, context, compound_literal) \
367 CCC_private_array_tree_map_with_context_compound_literal( \
368 type_key_field, compare, context, compound_literal)
547#define CCC_array_tree_map_as(array_tree_map_pointer, type_name, \
549 CCC_private_array_tree_map_as(array_tree_map_pointer, type_name, \
597#define CCC_array_tree_map_swap_handle_wrap(array_tree_map_pointer, \
598 type_output_pointer) \
601 CCC_array_tree_map_swap_handle((array_tree_map_pointer), \
602 (type_output_pointer)) \
623#define CCC_array_tree_map_try_insert_wrap(array_tree_map_pointer, \
627 CCC_array_tree_map_try_insert((array_tree_map_pointer), \
645#define CCC_array_tree_map_try_insert_with(array_tree_map_pointer, key, \
646 type_compound_literal...) \
649 CCC_private_array_tree_map_try_insert_with(array_tree_map_pointer, \
650 key, type_compound_literal) \
677#define CCC_array_tree_map_insert_or_assign_with(array_tree_map_pointer, key, \
678 type_compound_literal...) \
681 CCC_private_array_tree_map_insert_or_assign_with( \
682 array_tree_map_pointer, key, type_compound_literal) \
707#define CCC_array_tree_map_remove_key_value_wrap(array_tree_map_pointer, \
708 type_output_pointer) \
711 CCC_array_tree_map_remove_key_value((array_tree_map_pointer), \
712 (type_output_pointer)) \
750#define CCC_array_tree_map_handle_wrap(array_tree_map_pointer, key_pointer) \
751 &(CCC_Array_tree_map_handle) \
753 CCC_array_tree_map_handle((array_tree_map_pointer), (key_pointer)) \
819#define CCC_array_tree_map_and_modify_with(map_array_pointer, type_name, \
821 &(CCC_Array_tree_map_handle) \
823 CCC_private_array_tree_map_and_modify_with(map_array_pointer, \
824 type_name, closure_over_T) \
854#define CCC_array_tree_map_or_insert_with(map_array_pointer, \
855 type_compound_literal...) \
856 CCC_private_array_tree_map_or_insert_with(map_array_pointer, \
857 type_compound_literal)
877#define CCC_array_tree_map_insert_array_with(map_array_pointer, \
878 type_compound_literal...) \
879 CCC_private_array_tree_map_insert_array_with(map_array_pointer, \
880 type_compound_literal)
900#define CCC_array_tree_map_remove_handle_wrap(map_array_pointer) \
903 CCC_array_tree_map_remove_handle((map_array_pointer)).private \
1033 void const *begin_key,
void const *end_key);
1041#define CCC_array_tree_map_equal_range_wrap(array_tree_map_pointer, \
1042 begin_and_end_key_pointers...) \
1043 &(CCC_Handle_range) \
1045 CCC_array_tree_map_equal_range((array_tree_map_pointer), \
1046 (begin_and_end_key_pointers)) \
1075 void const *reverse_begin_key,
1076 void const *reverse_end_key);
1085#define CCC_array_tree_map_equal_range_reverse_wrap( \
1086 array_tree_map_pointer, reverse_begin_and_reverse_end_key_pointers...) \
1087 &(CCC_Handle_range_reverse) \
1089 CCC_array_tree_map_equal_range_reverse( \
1090 (array_tree_map_pointer), \
1091 (reverse_begin_and_reverse_end_key_pointers)) \
1178#ifdef ARRAY_TREE_MAP_USING_NAMESPACE_CCC
1181# define array_tree_map_declare_fixed(args...) \
1182 CCC_array_tree_map_declare_fixed(args)
1183# define array_tree_map_initialize(args...) \
1184 CCC_array_tree_map_initialize(args)
1185# define array_tree_map_from(args...) CCC_array_tree_map_from(args)
1186# define array_tree_map_with_capacity(args...) \
1187 CCC_array_tree_map_with_capacity(args)
1188# define array_tree_map_with_compound_literal(args...) \
1189 CCC_array_tree_map_with_compound_literal(args)
1190# define array_tree_map_with_context_compound_literal(args...) \
1191 CCC_array_tree_map_with_context_compound_literal(args)
1192# define array_tree_map_fixed_capacity(args...) \
1193 CCC_array_tree_map_fixed_capacity(args)
1194# define array_tree_map_copy(args...) CCC_array_tree_map_copy(args)
1195# define array_tree_map_reserve(args...) CCC_array_tree_map_reserve(args)
1196# define array_tree_map_at(args...) CCC_array_tree_map_at(args)
1197# define array_tree_map_as(args...) CCC_array_tree_map_as(args)
1198# define array_tree_map_and_modify_with(args...) \
1199 CCC_array_tree_map_and_modify_with(args)
1200# define array_tree_map_or_insert_with(args...) \
1201 CCC_array_tree_map_or_insert_with(args)
1202# define array_tree_map_insert_array_with(args...) \
1203 CCC_array_tree_map_insert_array_with(args)
1204# define array_tree_map_try_insert_with(args...) \
1205 CCC_array_tree_map_try_insert_with(args)
1206# define array_tree_map_insert_or_assign_with(args...) \
1207 CCC_array_tree_map_insert_or_assign_with(args)
1208# define array_tree_map_contains(args...) CCC_array_tree_map_contains(args)
1209# define array_tree_map_get_key_value(args...) \
1210 CCC_array_tree_map_get_key_value(args)
1211# define array_tree_map_swap_handle(args...) \
1212 CCC_array_tree_map_swap_handle(args)
1213# define array_tree_map_swap_handle_wrap(args...) \
1214 CCC_array_tree_map_swap_handle_wrap(args)
1215# define array_tree_map_begin(args...) CCC_array_tree_map_begin(args)
1216# define array_tree_map_reverse_begin(args...) \
1217 CCC_array_tree_map_reverse_begin(args)
1218# define array_tree_map_next(args...) CCC_array_tree_map_next(args)
1219# define array_tree_map_reverse_next(args...) \
1220 CCC_array_tree_map_reverse_next(args)
1221# define array_tree_map_end(args...) CCC_array_tree_map_end(args)
1222# define array_tree_map_reverse_end(args...) \
1223 CCC_array_tree_map_reverse_end(args)
1224# define array_tree_map_is_empty(args...) CCC_array_tree_map_is_empty(args)
1225# define array_tree_map_count(args...) CCC_array_tree_map_count(args)
1226# define array_tree_map_capacity(args...) CCC_array_tree_map_capacity(args)
1227# define array_tree_map_clear(args...) CCC_array_tree_map_clear(args)
1228# define array_tree_map_clear_and_free(args...) \
1229 CCC_array_tree_map_clear_and_free(args)
1230# define array_tree_map_clear_and_free_reserve(args...) \
1231 CCC_array_tree_map_clear_and_free_reserve(args)
1232# define array_tree_map_validate(args...) CCC_array_tree_map_validate(args)
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:161
Definition: private_array_tree_map.h:132
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:174
Definition: private_types.h:221