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>
32#include "private/private_types.h"
33
45
53
61
69
78
87typedef enum CCC_Entry_status CCC_Entry_status;
88
98
109typedef size_t CCC_Handle_index;
110
119typedef enum CCC_Entry_status CCC_Handle_status;
120
132typedef enum : int8_t
133{
141
147typedef enum : uint8_t
148{
161} CCC_Result;
162
170typedef enum : int8_t
171{
180} CCC_Order;
181
201typedef struct
202{
206 size_t count;
207} CCC_Count;
208
217typedef struct
218{
220 void const *const type_left;
222 void const *const type_right;
224 void *context;
226
244typedef struct
245{
247 void const *const key_left;
249 void const *const type_right;
251 void *context;
253
258typedef struct
259{
261 void *type;
263 void *context;
265
271typedef struct
272{
274 void const *const key;
276 void *context;
278
283typedef struct
284{
286 void *input;
288 size_t bytes;
290 void *context;
292
341
349
359
377
384
390
401
409
416
427void *CCC_entry_unwrap(CCC_Entry const *entry);
428
433
441
448
460
474void *CCC_range_begin(CCC_Range const *range);
475
485void *CCC_range_end(CCC_Range const *range);
486
496
507
516
527
538
550
565char const *CCC_result_message(CCC_Result result);
566
572CCC_Entry_status CCC_get_entry_status(CCC_Entry const *entry);
573
580
592char const *CCC_entry_status_message(CCC_Entry_status status);
593
606
611#ifdef TYPES_USING_NAMESPACE_CCC
612typedef CCC_Range Range;
613typedef CCC_Range_reverse Range_reverse;
614typedef CCC_Handle_range Handle_range;
615typedef CCC_Handle_range_reverse Handle_range_reverse;
616typedef CCC_Entry Entry;
617typedef CCC_Handle Handle;
618typedef CCC_Handle_index Handle_index;
619typedef CCC_Result Result;
620typedef CCC_Order Order;
621typedef CCC_Type_context Type_context;
622typedef CCC_Type_comparator_context Type_comparator_context;
623typedef CCC_Key_context Key_context;
624typedef CCC_Key_comparator_context Key_comparator_context;
625typedef CCC_Allocator Allocator;
626typedef CCC_Type_comparator Type_comparator;
627typedef CCC_Type_modifier Type_modifier;
628typedef CCC_Type_destructor Type_destructor;
629typedef CCC_Key_comparator Key_comparator;
630typedef CCC_Key_hasher Key_hasher;
631# define entry_occupied(entry_pointer) CCC_entry_occupied(entry_pointer)
632# define entry_insert_error(entry_pointer) \
633 CCC_entry_insert_error(entry_pointer)
634# define entry_unwrap(entry_pointer) CCC_entry_unwrap(entry_pointer)
635# define get_entry_status(entry_pointer) CCC_get_entry_status(entry_pointer)
636# define entry_status_message(status) CCC_entry_status_message(status)
637# define handle_occupied(array_pointer) CCC_handle_occupied(array_pointer)
638# define handle_insert_error(array_pointer) \
639 CCC_handle_insert_error(array_pointer)
640# define handle_unwrap(array_pointer) CCC_handle_unwrap(array_pointer)
641# define get_handle_status(array_pointer) \
642 CCC_get_handle_status(array_pointer)
643# define handle_status_message(status) CCC_handle_status_message(status)
644# ifndef range_begin
645# define range_begin(range_pointer) CCC_range_begin(range_pointer)
646# endif
647# ifndef range_end
648# define range_end(range_pointer) CCC_range_end(range_pointer)
649# endif
650# ifndef range_reverse_begin
651# define range_reverse_begin(range_pointer) \
652 CCC_range_reverse_begin(range_pointer)
653# endif
654# ifndef range_reverse_end
655# define range_reverse_end(range_pointer) \
656 CCC_range_reverse_end(range_pointer)
657# endif
658# define array_range_begin(array_range_pointer) \
659 CCC_array_range_begin(array_range_pointer)
660# define array_range_end(array_range_pointer) \
661 CCC_array_range_end(array_range_pointer)
662# define array_range_reverse_begin(array_range_pointer) \
663 CCC_array_range_reverse_begin(array_range_pointer)
664# define array_range_reverse_end(array_range_pointer) \
665 CCC_array_range_reverse_end(array_range_pointer)
666# define result_message(res) CCC_result_message(res)
667#endif /* TYPES_USING_NAMESPACE_CCC */
668
669#endif /* CCC_TYPES_H */
A bundle of arguments to pass to the user-implemented Allocator function interface....
Definition: types.h:284
void * input
Definition: types.h:286
size_t bytes
Definition: types.h:288
void * context
Definition: types.h:290
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:202
size_t count
Definition: types.h:206
CCC_Result error
Definition: types.h:204
Definition: private_types.h:53
Definition: private_types.h:173
Definition: private_types.h:80
A key comparison helper to avoid argument swapping.
Definition: types.h:245
void const *const key_left
Definition: types.h:247
void const *const type_right
Definition: types.h:249
void * context
Definition: types.h:251
A read only reference to a key type matching the key field type used for hash containers.
Definition: types.h:272
void * context
Definition: types.h:276
void const *const key
Definition: types.h:274
Definition: private_types.h:112
An element comparison helper.
Definition: types.h:218
void const *const type_left
Definition: types.h:220
void * context
Definition: types.h:224
void const *const type_right
Definition: types.h:222
A reference to a user type within the container.
Definition: types.h:259
void * context
Definition: types.h:263
void * type
Definition: types.h:261
#define CCC_range_end(range_pointer)
Obtain the end of the range iterator.
Definition: traits.h:541
#define CCC_range_reverse_end(range_reverse_pointer)
Obtain the end of the reverse range iterator.
Definition: traits.h:554
#define CCC_range_reverse_begin(range_reverse_pointer)
Obtain the beginning of the reverse range iterator.
Definition: traits.h:547
#define CCC_range_begin(range_pointer)
Obtain the beginning of the range iterator.
Definition: traits.h:535
CCC_Entry_status CCC_get_entry_status(CCC_Entry const *entry)
Obtain the entry status from a generic entry.
CCC_Handle_index CCC_array_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_Handle_index CCC_array_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.
char const * CCC_result_message(CCC_Result result)
Obtain a string message with a description of the error returned from a container operation,...
enum CCC_Entry_status CCC_Entry_status
The status monitoring and entry state once it is obtained.
Definition: types.h:87
enum CCC_Entry_status CCC_Handle_status
The status monitoring and handle state once it is obtained.
Definition: types.h:119
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_Tribool CCC_entry_occupied(CCC_Entry const *entry)
Determine if an entry is Occupied in the container.
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:109
CCC_Handle_index CCC_array_range_begin(CCC_Handle_range const *range)
Obtain a handle to the beginning user element stored in a container in the provided range.
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.
CCC_Handle_index CCC_array_range_end(CCC_Handle_range const *range)
Obtain a handle to the end user element stored in a container in the provided range.
CCC_Order
A three-way comparison for comparison functions.
Definition: types.h:171
@ CCC_ORDER_ERROR
Definition: types.h:179
@ CCC_ORDER_EQUAL
Definition: types.h:175
@ CCC_ORDER_LESSER
Definition: types.h:173
@ CCC_ORDER_GREATER
Definition: types.h:177
CCC_Order CCC_Key_comparator(CCC_Key_comparator_context)
A callback function for three-way comparing two stored keys.
Definition: types.h:383
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:133
@ CCC_TRIBOOL_ERROR
Definition: types.h:135
@ CCC_TRUE
Definition: types.h:139
@ CCC_FALSE
Definition: types.h:137
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
@ CCC_PRIVATE_RESULT_COUNT
Definition: types.h:160
@ CCC_RESULT_NO_ALLOCATION_FUNCTION
Definition: types.h:154
@ CCC_RESULT_ARGUMENT_ERROR
Definition: types.h:158
@ CCC_RESULT_ALLOCATOR_ERROR
Definition: types.h:156
@ CCC_RESULT_FAIL
Definition: types.h:152
@ CCC_RESULT_OK
Definition: types.h:150
CCC_Order CCC_Type_comparator(CCC_Type_comparator_context)
A callback function for comparing two elements in a container.
Definition: types.h:348
void * CCC_Allocator(CCC_Allocator_context)
An allocation function at the core of all containers.
Definition: types.h:340
CCC_Tribool CCC_entry_input_error(CCC_Entry const *entry)
Determine if an input error has occurred for a function that generates an entry.
CCC_Tribool CCC_handle_input_error(CCC_Handle const *handle)
Determine if an input error has occurred for a function that generates an handle.
uint64_t CCC_Key_hasher(CCC_Key_context)
A callback function to hash the key type used in a container.
Definition: types.h:389
CCC_Handle_status CCC_get_handle_status(CCC_Handle const *handle)
Obtain the handle status from a generic handle.
char const * CCC_entry_status_message(CCC_Entry_status status)
Obtain a string message with a description of the entry status.
void CCC_Type_modifier(CCC_Type_context)
A callback function for modifying an element in the container.
Definition: types.h:358
char const * CCC_handle_status_message(CCC_Handle_status status)
Obtain a string message with a description of the handle status.
Definition: private_types.h:72
Definition: private_types.h:221
Definition: private_types.h:203
Definition: private_types.h:99
Definition: private_types.h:160
Definition: private_types.h:142