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 "impl/impl_types.h"
33
44typedef union ccc_range ccc_range;
45
52typedef union ccc_rrange ccc_rrange;
53
61typedef union ccc_entry ccc_entry;
62
71typedef enum ccc_entry_status ccc_entry_status;
72
81typedef union ccc_handle ccc_handle;
82
93typedef size_t ccc_handle_i;
94
103typedef enum ccc_entry_status ccc_handle_status;
104
116typedef enum : int8_t
117{
125
131typedef enum : uint8_t
132{
145} ccc_result;
146
152typedef enum : int8_t
153{
163
183typedef struct
184{
188 size_t count;
189} ccc_ucount;
190
199typedef struct
200{
202 void const *const any_type_lhs;
204 void const *const any_type_rhs;
206 void *aux;
208
227typedef struct
228{
230 void const *const any_key_lhs;
232 void const *const any_type_rhs;
234 void *aux;
236
241typedef struct
242{
244 void *any_type;
246 void *aux;
248
254typedef struct
255{
257 void const *const any_key;
259 void *aux;
261
309typedef void *ccc_any_alloc_fn(void *ptr, size_t size, void *aux);
310
318
327
345
353
360
365typedef uint64_t ccc_any_key_hash_fn(ccc_any_key to_hash);
366
377
385
392
404
409
417
424
436
451
461void *ccc_end_range(ccc_range const *r);
462
472
483
498char const *ccc_result_msg(ccc_result res);
499
505ccc_entry_status ccc_get_entry_status(ccc_entry const *e);
506
513
525char const *ccc_entry_status_msg(ccc_entry_status status);
526
539
544#ifdef TYPES_USING_NAMESPACE_CCC
545typedef ccc_range range;
546typedef ccc_rrange rrange;
547typedef ccc_entry entry;
548typedef ccc_handle handle;
549typedef ccc_handle_i handle_i;
550typedef ccc_result result;
551typedef ccc_threeway_cmp threeway_cmp;
552typedef ccc_any_type any_type;
553typedef ccc_any_type_cmp any_type_cmp;
554typedef ccc_any_key any_key;
555typedef ccc_any_key_cmp any_key_cmp;
556typedef ccc_any_alloc_fn any_alloc_fn;
557typedef ccc_any_type_cmp_fn any_type_cmp_fn;
558typedef ccc_any_type_update_fn any_type_update_fn;
559typedef ccc_any_type_destructor_fn any_type_destructor_fn;
560typedef ccc_any_key_eq_fn any_key_eq_fn;
561typedef ccc_any_key_cmp_fn any_key_cmp_fn;
562typedef ccc_any_key_hash_fn any_key_hash_fn;
563# define entry_occupied(entry_ptr) ccc_entry_occupied(entry_ptr)
564# define entry_insert_error(entry_ptr) ccc_entry_insert_error(entry_ptr)
565# define entry_unwrap(entry_ptr) ccc_entry_unwrap(entry_ptr)
566# define get_entry_status(entry_ptr) ccc_get_entry_status(entry_ptr)
567# define entry_status_msg(status) ccc_entry_status_msg(status)
568# define handle_occupied(handle_ptr) ccc_handle_occupied(handle_ptr)
569# define handle_insert_error(handle_ptr) ccc_handle_insert_error(handle_ptr)
570# define handle_unwrap(handle_ptr) ccc_handle_unwrap(handle_ptr)
571# define get_handle_status(handle_ptr) ccc_get_handle_status(handle_ptr)
572# define handle_status_msg(status) ccc_handle_status_msg(status)
573# define begin_range(range_ptr) ccc_begin_range(range_ptr)
574# define end_range(range_ptr) ccc_end_range(range_ptr)
575# define rbegin_rrange(range_ptr) ccc_rbegin_rrange(range_ptr)
576# define rend_rrange(range_ptr) ccc_rend_rrange(range_ptr)
577# define result_msg(res) ccc_result_msg(res)
578#endif /* TYPES_USING_NAMESPACE_CCC */
579
580#endif /* CCC_TYPES_H */
A key comparison helper to avoid argument swapping.
Definition: types.h:228
void * aux
Definition: types.h:234
void const *const any_key_lhs
Definition: types.h:230
void const *const any_type_rhs
Definition: types.h:232
A read only reference to a key type matching the key field type used for hash containers.
Definition: types.h:255
void const *const any_key
Definition: types.h:257
void * aux
Definition: types.h:259
An element comparison helper.
Definition: types.h:200
void const *const any_type_lhs
Definition: types.h:202
void const *const any_type_rhs
Definition: types.h:204
void * aux
Definition: types.h:206
A reference to a user type within the container.
Definition: types.h:242
void * any_type
Definition: types.h:244
void * aux
Definition: types.h:246
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:184
size_t count
Definition: types.h:188
ccc_result error
Definition: types.h:186
void * ccc_entry_unwrap(ccc_entry const *e)
Unwraps the provided entry providing a reference to the user type obtained from the operation that pr...
char const * ccc_result_msg(ccc_result res)
Obtain a string message with a description of the error returned from a container operation,...
ccc_tribool ccc_entry_occupied(ccc_entry const *e)
Determine if an entry is Occupied in the container.
ccc_tribool ccc_handle_insert_error(ccc_handle const *e)
Determine if an insertion error has occurred when a function that attempts to insert a value in a con...
ccc_threeway_cmp ccc_any_type_cmp_fn(ccc_any_type_cmp)
A callback function for comparing two elements in a container.
Definition: types.h:317
size_t ccc_handle_i
A stable index to user data in a container that uses a flat array as the underlying storage method.
Definition: types.h:93
void * ccc_any_alloc_fn(void *ptr, size_t size, void *aux)
An allocation function at the core of all containers.
Definition: types.h:309
ccc_tribool ccc_handle_input_error(ccc_handle const *e)
Determine if an input error has occurred for a function that generates an handle.
enum ccc_entry_status ccc_handle_status
The status monitoring and handle state once it is obtained.
Definition: types.h:103
void * ccc_begin_range(ccc_range const *r)
Obtain a reference to the beginning user element stored in a container in the provided range.
ccc_result
A result of actions on containers.
Definition: types.h:132
@ CCC_RESULT_ARG_ERROR
Definition: types.h:142
@ CCC_RESULT_MEM_ERROR
Definition: types.h:140
@ CCC_RESULT_FAIL
Definition: types.h:136
@ CCC_RESULT_COUNT
Definition: types.h:144
@ CCC_RESULT_OK
Definition: types.h:134
@ CCC_RESULT_NO_ALLOC
Definition: types.h:138
ccc_handle_status ccc_get_handle_status(ccc_handle const *e)
Obtain the handle status from a generic handle.
ccc_handle_i ccc_handle_unwrap(ccc_handle const *e)
Unwraps the provided handle providing a reference to the user type obtained from the operation that p...
union ccc_handle ccc_handle
An Occupied or Vacant handle to a flat searchable container entry.
Definition: types.h:81
union ccc_range ccc_range
The result of a range query on iterable containers.
Definition: types.h:44
union ccc_rrange ccc_rrange
The result of a rrange query on iterable containers.
Definition: types.h:52
ccc_tribool ccc_entry_input_error(ccc_entry const *e)
Determine if an input error has occurred for a function that generates an entry.
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:117
@ CCC_TRIBOOL_ERROR
Definition: types.h:119
@ CCC_TRUE
Definition: types.h:123
@ CCC_FALSE
Definition: types.h:121
void * ccc_rend_rrange(ccc_rrange const *r)
Obtain a reference to the reverse end user element stored in a container in the provided range.
void * ccc_end_range(ccc_range const *r)
Obtain a reference to the end user element stored in a container in the provided range.
enum ccc_entry_status ccc_entry_status
The status monitoring and entry state once it is obtained.
Definition: types.h:71
void ccc_any_type_destructor_fn(ccc_any_type)
A callback function for destroying an element in the container.
Definition: types.h:344
union ccc_entry ccc_entry
An Occupied or Vacant position in a searchable container.
Definition: types.h:61
char const * ccc_entry_status_msg(ccc_entry_status status)
Obtain a string message with a description of the entry status.
char const * ccc_handle_status_msg(ccc_handle_status status)
Obtain a string message with a description of the handle status.
ccc_tribool ccc_any_key_eq_fn(ccc_any_key_cmp)
A callback function to determining equality between two stored keys.
Definition: types.h:352
ccc_threeway_cmp ccc_any_key_cmp_fn(ccc_any_key_cmp)
A callback function for three-way comparing two stored keys.
Definition: types.h:359
uint64_t ccc_any_key_hash_fn(ccc_any_key to_hash)
A callback function to hash the key type used in a container.
Definition: types.h:365
ccc_tribool ccc_entry_insert_error(ccc_entry const *e)
Determine if an insertion error has occurred when a function that attempts to insert a value in a con...
ccc_tribool ccc_handle_occupied(ccc_handle const *e)
Determine if an handle is Occupied in the container.
void ccc_any_type_update_fn(ccc_any_type)
A callback function for modifying an element in the container.
Definition: types.h:326
ccc_entry_status ccc_get_entry_status(ccc_entry const *e)
Obtain the entry status from a generic entry.
void * ccc_rbegin_rrange(ccc_rrange const *r)
Obtain a reference to the reverse beginning user element stored in a container in the provided range.
ccc_threeway_cmp
A three-way comparison for comparison functions.
Definition: types.h:153
@ CCC_EQL
Definition: types.h:157
@ CCC_GRT
Definition: types.h:159
@ CCC_LES
Definition: types.h:155
@ CCC_CMP_ERROR
Definition: types.h:161