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
214typedef enum : int8_t {
223} CCC_Order;
224
244typedef struct {
248 size_t count;
249} CCC_Count;
250
261typedef struct {
263 void *const type;
265 void *const context;
267
278typedef struct {
280 void *const input;
282 size_t bytes;
284 void *const context;
286
332
376typedef struct {
380 void *context;
382
396typedef struct {
398 void const *const type_left;
400 void const *const type_right;
402 void *const context;
404
412
416typedef struct {
420 void *context;
422
432
436typedef struct {
440 void *context;
442
460
464typedef struct {
468 void *context;
470
493typedef struct {
495 void const *const key_left;
497 void const *const type_right;
499 void *const context;
501
508
512typedef struct {
516 void *context;
518
530typedef struct {
532 void const *const key;
534 void *const context;
536
542
550typedef struct {
556 void *context;
557} CCC_Hasher;
558
569
577
584
595void *CCC_entry_unwrap(CCC_Entry const *entry);
596
601
609
616
628
642void *CCC_range_begin(CCC_Range const *range);
643
653void *CCC_range_end(CCC_Range const *range);
654
664
675
684
695
706
718
733char const *CCC_result_message(CCC_Result result);
734
741
748
761
774
779#ifdef TYPES_USING_NAMESPACE_CCC
780/* NOLINTBEGIN(readability-identifier-naming) */
781typedef CCC_Range Range;
782typedef CCC_Range_reverse Range_reverse;
783typedef CCC_Handle_range Handle_range;
784typedef CCC_Handle_range_reverse Handle_range_reverse;
785typedef CCC_Entry Entry;
786typedef CCC_Handle Handle;
787typedef CCC_Handle_index Handle_index;
788typedef CCC_Result Result;
789typedef CCC_Order Order;
790typedef CCC_Arguments Arguments;
791typedef CCC_Comparator_arguments Comparator_arguments;
792typedef CCC_Key_arguments Key_arguments;
793typedef CCC_Key_comparator_arguments Key_comparator_arguments;
794typedef CCC_Allocator_interface Allocator_interface;
795typedef CCC_Comparator_interface Comparator_interface;
796typedef CCC_Modifier_interface Modifier_interface;
797typedef CCC_Destructor_interface Destructor_interface;
798typedef CCC_Key_comparator_interface Key_comparator_interface;
799typedef CCC_Key_hasher_interface Key_hasher_interface;
800# define entry_occupied(entry_pointer) CCC_entry_occupied(entry_pointer)
801# define entry_insert_error(entry_pointer) \
802 CCC_entry_insert_error(entry_pointer)
803# define entry_argument_error(entry_pointer) \
804 CCC_entry_argument_error(entry_pointer)
805# define handle_argument_error(handle_pointer) \
806 CCC_handle_argument_error(handle_pointer)
807# define entry_unwrap(entry_pointer) CCC_entry_unwrap(entry_pointer)
808# define entry_status(entry_pointer) CCC_entry_status(entry_pointer)
809# define entry_status_message(status) CCC_entry_status_message(status)
810# define handle_occupied(array_pointer) CCC_handle_occupied(array_pointer)
811# define handle_insert_error(array_pointer) \
812 CCC_handle_insert_error(array_pointer)
813# define handle_unwrap(array_pointer) CCC_handle_unwrap(array_pointer)
814# define handle_status(array_pointer) CCC_handle_status(array_pointer)
815# define handle_status_message(status) CCC_handle_status_message(status)
816# ifndef range_begin
817# define range_begin(range_pointer) CCC_range_begin(range_pointer)
818# endif
819# ifndef range_end
820# define range_end(range_pointer) CCC_range_end(range_pointer)
821# endif
822# ifndef range_reverse_begin
823# define range_reverse_begin(range_pointer) \
824 CCC_range_reverse_begin(range_pointer)
825# endif
826# ifndef range_reverse_end
827# define range_reverse_end(range_pointer) \
828 CCC_range_reverse_end(range_pointer)
829# endif
830# define handle_range_begin(handle_range_pointer) \
831 CCC_handle_range_begin(handle_range_pointer)
832# define handle_range_end(handle_range_pointer) \
833 CCC_handle_range_end(handle_range_pointer)
834# define handle_range_reverse_begin(handle_range_pointer) \
835 CCC_handle_range_reverse_begin(handle_range_pointer)
836# define handle_range_reverse_end(handle_range_pointer) \
837 CCC_handle_range_reverse_end(handle_range_pointer)
838# define result_message(res) CCC_result_message(res)
839/* NOLINTEND(readability-identifier-naming) */
840#endif /* TYPES_USING_NAMESPACE_CCC */
841
842#endif /* CCC_TYPES_H */
A bundle of arguments to pass to the user-implemented Allocator_interface function interface....
Definition: types.h:278
size_t bytes
Definition: types.h:282
void *const context
Definition: types.h:284
void *const input
Definition: types.h:280
The type passed by reference to any container function that may need to allocate memory....
Definition: types.h:376
CCC_Allocator_interface * allocate
Definition: types.h:378
void * context
Definition: types.h:380
A reference to a user type within the container.
Definition: types.h:261
void *const context
Definition: types.h:265
void *const type
Definition: types.h:263
An element comparison helper.
Definition: types.h:396
void *const context
Definition: types.h:402
void const *const type_left
Definition: types.h:398
void const *const type_right
Definition: types.h:400
The type passed by reference to any container function that may need to compare elements....
Definition: types.h:416
void * context
Definition: types.h:420
CCC_Comparator_interface * compare
Definition: types.h:418
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:244
size_t count
Definition: types.h:248
CCC_Result error
Definition: types.h:246
The type passed by reference to any container function that may need to destroy elements....
Definition: types.h:464
CCC_Destructor_interface * destroy
Definition: types.h:466
void * context
Definition: types.h:468
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:550
void * context
Definition: types.h:556
CCC_Key_comparator_interface * compare
Definition: types.h:554
CCC_Key_hasher_interface * hash
Definition: types.h:552
A read only reference to a key type matching the key field type used for hash containers.
Definition: types.h:530
void *const context
Definition: types.h:534
void const *const key
Definition: types.h:532
A key comparison helper to avoid argument swapping.
Definition: types.h:493
void const *const type_right
Definition: types.h:497
void *const context
Definition: types.h:499
void const *const key_left
Definition: types.h:495
The type passed by reference to any container function that may need to compare keys....
Definition: types.h:512
CCC_Key_comparator_interface * compare
Definition: types.h:514
void * context
Definition: types.h:516
The type passed by reference to any container function that may need to modify elements....
Definition: types.h:436
CCC_Modifier_interface * modify
Definition: types.h:438
void * context
Definition: types.h:440
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:541
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:411
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)
An allocation function at the core of all containers.
Definition: types.h:331
CCC_Order
A three-way comparison for comparison functions.
Definition: types.h:214
@ CCC_ORDER_ERROR
Definition: types.h:222
@ CCC_ORDER_EQUAL
Definition: types.h:218
@ CCC_ORDER_LESSER
Definition: types.h:216
@ CCC_ORDER_GREATER
Definition: types.h:220
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:431
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:507
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:459
char const * CCC_handle_status_message(CCC_Handle_status status)
Obtain a string message with a description of the handle status.