C Container Collection (CCC)
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
24#ifndef CCC_TYPES_H
25#define CCC_TYPES_H
26
28#include <stddef.h>
29#include <stdint.h>
42typedef struct {
44 void *begin;
46 void *end;
47} CCC_Range;
48
55typedef struct {
61
72typedef size_t CCC_Handle_index;
73
82typedef struct {
88
97typedef struct {
103
112typedef enum : uint8_t {
127
135typedef struct {
137 void *type;
140} CCC_Entry;
141
150typedef struct {
155} CCC_Handle;
156
166
178typedef enum : int8_t {
186
192typedef enum : uint8_t {
205} CCC_Result;
206
213typedef enum : int8_t {
222} CCC_Order;
223
243typedef struct {
247 size_t count;
248} CCC_Count;
249
260typedef struct {
262 void *const type;
264 void *const context;
266
277typedef struct {
279 void *const input;
281 size_t bytes;
283 size_t alignment;
285 void *const context;
287
340
384typedef struct {
388 void *context;
390
404typedef struct {
406 void const *const type_left;
408 void const *const type_right;
410 void *const context;
412
420
424typedef struct {
428 void *context;
430
440
444typedef struct {
448 void *context;
450
468
472typedef struct {
476 void *context;
478
501typedef struct {
503 void const *const key_left;
505 void const *const type_right;
507 void *const context;
509
516
520typedef struct {
524 void *context;
526
538typedef struct {
540 void const *const key;
542 void *const context;
544
550
558typedef struct {
564 void *context;
565} CCC_Hasher;
566
577
585
592
603void *CCC_entry_unwrap(CCC_Entry const *entry);
604
609
617
624
636
650void *CCC_range_begin(CCC_Range const *range);
651
661void *CCC_range_end(CCC_Range const *range);
662
672
683
692
703
714
726
741char const *CCC_result_message(CCC_Result result);
742
749
756
769
782
787#ifdef TYPES_USING_NAMESPACE_CCC
788/* NOLINTBEGIN(readability-identifier-naming) */
789typedef CCC_Range Range;
790typedef CCC_Range_reverse Range_reverse;
791typedef CCC_Handle_range Handle_range;
792typedef CCC_Handle_range_reverse Handle_range_reverse;
793typedef CCC_Entry Entry;
794typedef CCC_Handle Handle;
795typedef CCC_Handle_index Handle_index;
796typedef CCC_Result Result;
797typedef CCC_Order Order;
798typedef CCC_Arguments Arguments;
799typedef CCC_Comparator_arguments Comparator_arguments;
800typedef CCC_Key_arguments Key_arguments;
801typedef CCC_Key_comparator_arguments Key_comparator_arguments;
802typedef CCC_Allocator_interface Allocator_interface;
803typedef CCC_Comparator_interface Comparator_interface;
804typedef CCC_Modifier_interface Modifier_interface;
805typedef CCC_Destructor_interface Destructor_interface;
806typedef CCC_Key_comparator_interface Key_comparator_interface;
807typedef CCC_Key_hasher_interface Key_hasher_interface;
808# define entry_occupied(entry_pointer) CCC_entry_occupied(entry_pointer)
809# define entry_insert_error(entry_pointer) \
810 CCC_entry_insert_error(entry_pointer)
811# define entry_argument_error(entry_pointer) \
812 CCC_entry_argument_error(entry_pointer)
813# define handle_argument_error(handle_pointer) \
814 CCC_handle_argument_error(handle_pointer)
815# define entry_unwrap(entry_pointer) CCC_entry_unwrap(entry_pointer)
816# define entry_status(entry_pointer) CCC_entry_status(entry_pointer)
817# define entry_status_message(status) CCC_entry_status_message(status)
818# define handle_occupied(array_pointer) CCC_handle_occupied(array_pointer)
819# define handle_insert_error(array_pointer) \
820 CCC_handle_insert_error(array_pointer)
821# define handle_unwrap(array_pointer) CCC_handle_unwrap(array_pointer)
822# define handle_status(array_pointer) CCC_handle_status(array_pointer)
823# define handle_status_message(status) CCC_handle_status_message(status)
824# ifndef range_begin
825# define range_begin(range_pointer) CCC_range_begin(range_pointer)
826# endif
827# ifndef range_end
828# define range_end(range_pointer) CCC_range_end(range_pointer)
829# endif
830# ifndef range_reverse_begin
831# define range_reverse_begin(range_pointer) \
832 CCC_range_reverse_begin(range_pointer)
833# endif
834# ifndef range_reverse_end
835# define range_reverse_end(range_pointer) \
836 CCC_range_reverse_end(range_pointer)
837# endif
838# define handle_range_begin(handle_range_pointer) \
839 CCC_handle_range_begin(handle_range_pointer)
840# define handle_range_end(handle_range_pointer) \
841 CCC_handle_range_end(handle_range_pointer)
842# define handle_range_reverse_begin(handle_range_pointer) \
843 CCC_handle_range_reverse_begin(handle_range_pointer)
844# define handle_range_reverse_end(handle_range_pointer) \
845 CCC_handle_range_reverse_end(handle_range_pointer)
846# define result_message(res) CCC_result_message(res)
847/* NOLINTEND(readability-identifier-naming) */
848#endif /* TYPES_USING_NAMESPACE_CCC */
849
850#endif /* CCC_TYPES_H */
A bundle of arguments to pass to the user-implemented Allocator_interface function interface....
Definition: types.h:277
size_t bytes
Definition: types.h:281
void *const context
Definition: types.h:285
void *const input
Definition: types.h:279
size_t alignment
Definition: types.h:283
The type passed by reference to any container function that may need to allocate memory....
Definition: types.h:384
CCC_Allocator_interface * allocate
Definition: types.h:386
void * context
Definition: types.h:388
A reference to a user type within the container.
Definition: types.h:260
void *const context
Definition: types.h:264
void *const type
Definition: types.h:262
An element comparison helper.
Definition: types.h:404
void *const context
Definition: types.h:410
void const *const type_left
Definition: types.h:406
void const *const type_right
Definition: types.h:408
The type passed by reference to any container function that may need to compare elements....
Definition: types.h:424
void * context
Definition: types.h:428
CCC_Comparator_interface * compare
Definition: types.h:426
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:243
size_t count
Definition: types.h:247
CCC_Result error
Definition: types.h:245
The type passed by reference to any container function that may need to destroy elements....
Definition: types.h:472
CCC_Destructor_interface * destroy
Definition: types.h:474
void * context
Definition: types.h:476
An Occupied or Vacant position in a searchable container.
Definition: types.h:135
void * type
Definition: types.h:137
CCC_Entry_status status
Definition: types.h:139
The result of a range_reverse query on iterable containers. Handles are stable indices into an array ...
Definition: types.h:97
CCC_Handle_index reverse_begin
Definition: types.h:99
CCC_Handle_index reverse_end
Definition: types.h:101
The result of a range query on iterable containers. Handles are stable indices into an array until re...
Definition: types.h:82
CCC_Handle_index begin
Definition: types.h:84
CCC_Handle_index end
Definition: types.h:86
An Occupied or Vacant handle to a flat searchable container entry.
Definition: types.h:150
CCC_Entry_status status
Definition: types.h:154
CCC_Handle_index index
Definition: types.h:152
The type passed by reference to a hash map that needs a hash function and key comparison function....
Definition: types.h:558
void * context
Definition: types.h:564
CCC_Key_comparator_interface * compare
Definition: types.h:562
CCC_Key_hasher_interface * hash
Definition: types.h:560
A read only reference to a key type matching the key field type used for hash containers.
Definition: types.h:538
void *const context
Definition: types.h:542
void const *const key
Definition: types.h:540
A key comparison helper to avoid argument swapping.
Definition: types.h:501
void const *const type_right
Definition: types.h:505
void *const context
Definition: types.h:507
void const *const key_left
Definition: types.h:503
The type passed by reference to any container function that may need to compare keys....
Definition: types.h:520
CCC_Key_comparator_interface * compare
Definition: types.h:522
void * context
Definition: types.h:524
The type passed by reference to any container function that may need to modify elements....
Definition: types.h:444
CCC_Modifier_interface * modify
Definition: types.h:446
void * context
Definition: types.h:448
The result of a range_reverse query on iterable containers.
Definition: types.h:55
void * reverse_end
Definition: types.h:59
void * reverse_begin
Definition: types.h:57
The result of a range query on iterable containers.
Definition: types.h:42
void * end
Definition: types.h:46
void * begin
Definition: types.h:44
#define CCC_range_end(range_pointer)
Obtain the end of the range iterator.
Definition: traits.h:440
#define CCC_range_reverse_end(range_reverse_pointer)
Obtain the end of the reverse range iterator.
Definition: traits.h:453
#define CCC_range_reverse_begin(range_reverse_pointer)
Obtain the beginning of the reverse range iterator.
Definition: traits.h:446
#define CCC_range_begin(range_pointer)
Obtain the beginning of the range iterator.
Definition: traits.h:434
char const * CCC_result_message(CCC_Result result)
Obtain a string message with a description of the error returned from a container operation,...
uint64_t CCC_Key_hasher_interface(CCC_Key_arguments)
A callback function to hash the key type used in a container.
Definition: types.h:549
CCC_Tribool CCC_entry_argument_error(CCC_Entry const *entry)
Determine if an input error has occurred for a function that generates an entry.
CCC_Tribool CCC_entry_insert_error(CCC_Entry const *entry)
Determine if an insertion error has occurred when a function that attempts to insert a value in a con...
CCC_Handle_index CCC_handle_range_reverse_begin(CCC_Handle_range_reverse const *range)
Obtain a handle to the reverse beginning user element stored in a container in the provided range.
CCC_Tribool CCC_entry_occupied(CCC_Entry const *entry)
Determine if an entry is Occupied in the container.
CCC_Order CCC_Comparator_interface(CCC_Comparator_arguments)
A callback function for comparing two elements in a container.
Definition: types.h:419
CCC_Handle_index CCC_handle_range_reverse_end(CCC_Handle_range_reverse const *range)
Obtain a handle to the reverse end user element stored in a container in the provided range.
void * CCC_entry_unwrap(CCC_Entry const *entry)
Unwraps the provided entry providing a reference to the user type obtained from the operation that pr...
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_Handle_index CCC_handle_unwrap(CCC_Handle const *handle)
Unwraps the provided handle providing a reference to the user type obtained from the operation that p...
CCC_Tribool CCC_handle_occupied(CCC_Handle const *handle)
Determine if an handle is Occupied in the container.
void * CCC_Allocator_interface(CCC_Allocator_arguments)
The function interface for allocating, resizing, and freeing memory.
Definition: types.h:339
CCC_Order
A three-way comparison for comparison functions.
Definition: types.h:213
@ CCC_ORDER_ERROR
Definition: types.h:221
@ CCC_ORDER_EQUAL
Definition: types.h:217
@ CCC_ORDER_LESSER
Definition: types.h:215
@ CCC_ORDER_GREATER
Definition: types.h:219
CCC_Handle_index CCC_handle_range_begin(CCC_Handle_range const *range)
Obtain a handle to the beginning user element stored in a container in the provided range.
CCC_Entry_status
The status monitoring and entry state once it is obtained.
Definition: types.h:112
@ CCC_ENTRY_NO_UNWRAP
Definition: types.h:125
@ CCC_ENTRY_VACANT
Definition: types.h:114
@ CCC_ENTRY_ARGUMENT_ERROR
Definition: types.h:121
@ CCC_ENTRY_OCCUPIED
Definition: types.h:116
@ CCC_ENTRY_INSERT_ERROR
Definition: types.h:119
CCC_Tribool CCC_handle_insert_error(CCC_Handle const *handle)
Determine if an insertion error has occurred when a function that attempts to insert a value in a con...
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_TRIBOOL_ERROR
Definition: types.h:180
@ CCC_TRUE
Definition: types.h:184
@ CCC_FALSE
Definition: types.h:182
void CCC_Modifier_interface(CCC_Arguments)
A callback function for modifying an element in the container.
Definition: types.h:439
CCC_Result
A result of actions on containers.
Definition: types.h:192
@ CCC_PRIVATE_RESULT_COUNT
Definition: types.h:204
@ CCC_RESULT_NO_ALLOCATION_FUNCTION
Definition: types.h:198
@ CCC_RESULT_ARGUMENT_ERROR
Definition: types.h:202
@ CCC_RESULT_ALLOCATOR_ERROR
Definition: types.h:200
@ CCC_RESULT_FAIL
Definition: types.h:196
@ CCC_RESULT_OK
Definition: types.h:194
CCC_Entry_status CCC_Handle_status
The status monitoring and handle state once it is obtained.
Definition: types.h:165
char const * CCC_entry_status_message(CCC_Entry_status status)
Obtain a string message with a description of the entry status.
CCC_Handle_index CCC_handle_range_end(CCC_Handle_range const *range)
Obtain a handle to the end user element stored in a container in the provided range.
CCC_Tribool CCC_handle_argument_error(CCC_Handle const *handle)
Determine if an input error has occurred for a function that generates an handle.
CCC_Handle_status CCC_handle_status(CCC_Handle const *handle)
Obtain the handle status from a generic handle.
CCC_Order CCC_Key_comparator_interface(CCC_Key_comparator_arguments)
A callback function for three-way comparing two stored keys.
Definition: types.h:515
CCC_Entry_status CCC_entry_status(CCC_Entry const *entry)
Obtain the entry status from a generic entry.
void CCC_Destructor_interface(CCC_Arguments)
A callback function for destroying an element in the container.
Definition: types.h:467
char const * CCC_handle_status_message(CCC_Handle_status status)
Obtain a string message with a description of the handle status.