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 void *const context;
285
325
369typedef struct {
373 void *context;
375
389typedef struct {
391 void const *const type_left;
393 void const *const type_right;
395 void *const context;
397
405
409typedef struct {
413 void *context;
415
425
429typedef struct {
433 void *context;
435
453
457typedef struct {
461 void *context;
463
486typedef struct {
488 void const *const key_left;
490 void const *const type_right;
492 void *const context;
494
501
505typedef struct {
509 void *context;
511
523typedef struct {
525 void const *const key;
527 void *const context;
529
535
543typedef struct {
549 void *context;
550} CCC_Hasher;
551
562
570
577
588void *CCC_entry_unwrap(CCC_Entry const *entry);
589
594
602
609
621
635void *CCC_range_begin(CCC_Range const *range);
636
646void *CCC_range_end(CCC_Range const *range);
647
657
668
677
688
699
711
726char const *CCC_result_message(CCC_Result result);
727
734
741
754
767
772#ifdef TYPES_USING_NAMESPACE_CCC
773/* NOLINTBEGIN(readability-identifier-naming) */
774typedef CCC_Range Range;
775typedef CCC_Range_reverse Range_reverse;
776typedef CCC_Handle_range Handle_range;
777typedef CCC_Handle_range_reverse Handle_range_reverse;
778typedef CCC_Entry Entry;
779typedef CCC_Handle Handle;
780typedef CCC_Handle_index Handle_index;
781typedef CCC_Result Result;
782typedef CCC_Order Order;
783typedef CCC_Arguments Arguments;
784typedef CCC_Comparator_arguments Comparator_arguments;
785typedef CCC_Key_arguments Key_arguments;
786typedef CCC_Key_comparator_arguments Key_comparator_arguments;
787typedef CCC_Allocator_interface Allocator_interface;
788typedef CCC_Comparator_interface Comparator_interface;
789typedef CCC_Modifier_interface Modifier_interface;
790typedef CCC_Destructor_interface Destructor_interface;
791typedef CCC_Key_comparator_interface Key_comparator_interface;
792typedef CCC_Key_hasher_interface Key_hasher_interface;
793# define entry_occupied(entry_pointer) CCC_entry_occupied(entry_pointer)
794# define entry_insert_error(entry_pointer) \
795 CCC_entry_insert_error(entry_pointer)
796# define entry_argument_error(entry_pointer) \
797 CCC_entry_argument_error(entry_pointer)
798# define handle_argument_error(handle_pointer) \
799 CCC_handle_argument_error(handle_pointer)
800# define entry_unwrap(entry_pointer) CCC_entry_unwrap(entry_pointer)
801# define entry_status(entry_pointer) CCC_entry_status(entry_pointer)
802# define entry_status_message(status) CCC_entry_status_message(status)
803# define handle_occupied(array_pointer) CCC_handle_occupied(array_pointer)
804# define handle_insert_error(array_pointer) \
805 CCC_handle_insert_error(array_pointer)
806# define handle_unwrap(array_pointer) CCC_handle_unwrap(array_pointer)
807# define handle_status(array_pointer) CCC_handle_status(array_pointer)
808# define handle_status_message(status) CCC_handle_status_message(status)
809# ifndef range_begin
810# define range_begin(range_pointer) CCC_range_begin(range_pointer)
811# endif
812# ifndef range_end
813# define range_end(range_pointer) CCC_range_end(range_pointer)
814# endif
815# ifndef range_reverse_begin
816# define range_reverse_begin(range_pointer) \
817 CCC_range_reverse_begin(range_pointer)
818# endif
819# ifndef range_reverse_end
820# define range_reverse_end(range_pointer) \
821 CCC_range_reverse_end(range_pointer)
822# endif
823# define handle_range_begin(handle_range_pointer) \
824 CCC_handle_range_begin(handle_range_pointer)
825# define handle_range_end(handle_range_pointer) \
826 CCC_handle_range_end(handle_range_pointer)
827# define handle_range_reverse_begin(handle_range_pointer) \
828 CCC_handle_range_reverse_begin(handle_range_pointer)
829# define handle_range_reverse_end(handle_range_pointer) \
830 CCC_handle_range_reverse_end(handle_range_pointer)
831# define result_message(res) CCC_result_message(res)
832/* NOLINTEND(readability-identifier-naming) */
833#endif /* TYPES_USING_NAMESPACE_CCC */
834
835#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:283
void *const input
Definition: types.h:279
The type passed by reference to any container function that may need to allocate memory....
Definition: types.h:369
CCC_Allocator_interface * allocate
Definition: types.h:371
void * context
Definition: types.h:373
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:389
void *const context
Definition: types.h:395
void const *const type_left
Definition: types.h:391
void const *const type_right
Definition: types.h:393
The type passed by reference to any container function that may need to compare elements....
Definition: types.h:409
void * context
Definition: types.h:413
CCC_Comparator_interface * compare
Definition: types.h:411
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:457
CCC_Destructor_interface * destroy
Definition: types.h:459
void * context
Definition: types.h:461
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:543
void * context
Definition: types.h:549
CCC_Key_comparator_interface * compare
Definition: types.h:547
CCC_Key_hasher_interface * hash
Definition: types.h:545
A read only reference to a key type matching the key field type used for hash containers.
Definition: types.h:523
void *const context
Definition: types.h:527
void const *const key
Definition: types.h:525
A key comparison helper to avoid argument swapping.
Definition: types.h:486
void const *const type_right
Definition: types.h:490
void *const context
Definition: types.h:492
void const *const key_left
Definition: types.h:488
The type passed by reference to any container function that may need to compare keys....
Definition: types.h:505
CCC_Key_comparator_interface * compare
Definition: types.h:507
void * context
Definition: types.h:509
The type passed by reference to any container function that may need to modify elements....
Definition: types.h:429
CCC_Modifier_interface * modify
Definition: types.h:431
void * context
Definition: types.h:433
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:534
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:404
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:324
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:424
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:500
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:452
char const * CCC_handle_status_message(CCC_Handle_status status)
Obtain a string message with a description of the handle status.