C Container Collection (CCC)
Loading...
Searching...
No Matches
doubly_linked_list.h
Go to the documentation of this file.
1
40#ifndef CCC_DOUBLY_LINKED_LIST_H
41#define CCC_DOUBLY_LINKED_LIST_H
42
44#include <stddef.h>
47#include "private/private_doubly_linked_list.h"
48#include "types.h"
49
61
71
94#define CCC_doubly_linked_list_initialize(struct_name, type_intruder_field, \
95 compare, allocate, context_data) \
96 CCC_private_doubly_linked_list_initialize( \
97 struct_name, type_intruder_field, compare, allocate, context_data)
98
113#define CCC_doubly_linked_list_from(type_intruder_field, compare, allocate, \
114 destroy, context_data, \
115 compound_literal_array...) \
116 CCC_private_doubly_linked_list_from(type_intruder_field, compare, \
117 allocate, destroy, context_data, \
118 compound_literal_array)
119
139#define CCC_doubly_linked_list_emplace_back(list_pointer, \
140 type_compound_literal...) \
141 CCC_private_doubly_linked_list_emplace_back(list_pointer, \
142 type_compound_literal)
143
157#define CCC_doubly_linked_list_emplace_front(list_pointer, \
158 type_compound_literal...) \
159 CCC_private_doubly_linked_list_emplace_front(list_pointer, \
160 type_compound_literal)
161
167[[nodiscard]] void *
169 CCC_Doubly_linked_list_node *type_intruder);
170
176[[nodiscard]] void *
178 CCC_Doubly_linked_list_node *type_intruder);
179
187[[nodiscard]] void *
189 CCC_Doubly_linked_list_node *position_node,
190 CCC_Doubly_linked_list_node *type_intruder);
191
197
203
212void *
214 CCC_Doubly_linked_list_node *type_intruder);
215
223 CCC_Doubly_linked_list_node *type_intruder);
224
243 CCC_Doubly_linked_list_node *type_intruder_begin,
244 CCC_Doubly_linked_list_node *type_intruder_end);
245
262 CCC_Doubly_linked_list_node *type_intruder_begin,
263 CCC_Doubly_linked_list_node *type_intruder_end);
264
273 CCC_Doubly_linked_list *position_doubly_linked_list,
274 CCC_Doubly_linked_list_node *type_intruder_position,
275 CCC_Doubly_linked_list *to_cut_doubly_linked_list,
276 CCC_Doubly_linked_list_node *type_intruder_to_cut);
277
289 CCC_Doubly_linked_list *position_doubly_linked_list,
290 CCC_Doubly_linked_list_node *type_intruder_position,
291 CCC_Doubly_linked_list *to_cut_doubly_linked_list,
292 CCC_Doubly_linked_list_node *type_intruder_to_cut_begin,
293 CCC_Doubly_linked_list_node *type_intruder_to_cut_exclusive_end);
294
308
323 CCC_Doubly_linked_list *doubly_linked_list,
324 CCC_Doubly_linked_list_node *type_intruder);
325
336 CCC_Doubly_linked_list const *doubly_linked_list);
337
361 CCC_Type_destructor *destroy);
362
372[[nodiscard]] void *
374
378[[nodiscard]] void *
380
387[[nodiscard]] void *
389 CCC_Doubly_linked_list_node const *type_intruder);
390
398 CCC_Doubly_linked_list const *list,
399 CCC_Doubly_linked_list_node const *type_intruder);
400
404[[nodiscard]] void *
406
410[[nodiscard]] void *
412
422[[nodiscard]] void *
424
428[[nodiscard]] void *
430
436[[nodiscard]] CCC_Doubly_linked_list_node *
438
442[[nodiscard]] CCC_Count
444
448[[nodiscard]] CCC_Tribool
450
454[[nodiscard]] CCC_Tribool
456
462#ifdef DOUBLY_LINKED_LIST_USING_NAMESPACE_CCC
463typedef CCC_Doubly_linked_list_node Doubly_linked_list_node;
464typedef CCC_Doubly_linked_list Doubly_linked_list;
465# define doubly_linked_list_initialize(args...) \
466 CCC_doubly_linked_list_initialize(args)
467# define doubly_linked_list_from(args...) CCC_doubly_linked_list_from(args)
468# define doubly_linked_list_emplace_back(args...) \
469 CCC_doubly_linked_list_emplace_back(args)
470# define doubly_linked_list_emplace_front(args...) \
471 CCC_doubly_linked_list_emplace_front(args)
472# define doubly_linked_list_push_front(args...) \
473 CCC_doubly_linked_list_push_front(args)
474# define doubly_linked_list_push_back(args...) \
475 CCC_doubly_linked_list_push_back(args)
476# define doubly_linked_list_front(args...) CCC_doubly_linked_list_front(args)
477# define doubly_linked_list_back(args...) CCC_doubly_linked_list_back(args)
478# define doubly_linked_list_pop_front(args...) \
479 CCC_doubly_linked_list_pop_front(args)
480# define doubly_linked_list_pop_back(args...) \
481 CCC_doubly_linked_list_pop_back(args)
482# define doubly_linked_list_extract(args...) \
483 CCC_doubly_linked_list_extract(args)
484# define doubly_linked_list_extract_range(args...) \
485 CCC_doubly_linked_list_extract_range(args)
486# define doubly_linked_list_erase(args...) CCC_doubly_linked_list_erase(args)
487# define doubly_linked_list_erase_range(args...) \
488 CCC_doubly_linked_list_erase_range(args)
489# define doubly_linked_list_splice(args...) \
490 CCC_doubly_linked_list_splice(args)
491# define doubly_linked_list_splice_range(args...) \
492 CCC_doubly_linked_list_splice_range(args)
493# define doubly_linked_list_sort(args...) CCC_doubly_linked_list_sort(args)
494# define doubly_linked_list_insert_sorted(args...) \
495 CCC_doubly_linked_list_insert_sorted(args)
496# define doubly_linked_list_is_sorted(args...) \
497 CCC_doubly_linked_list_is_sorted(args)
498# define doubly_linked_list_begin(args...) CCC_doubly_linked_list_begin(args)
499# define doubly_linked_list_next(args...) CCC_doubly_linked_list_next(args)
500# define doubly_linked_list_reverse_begin(args...) \
501 CCC_doubly_linked_list_reverse_begin(args)
502# define doubly_linked_list_reverse_next(args...) \
503 CCC_doubly_linked_list_reverse_next(args)
504# define doubly_linked_list_end(args...) CCC_doubly_linked_list_end(args)
505# define doubly_linked_list_reverse_end(args...) \
506 CCC_doubly_linked_list_reverse_end(args)
507# define doubly_linked_list_node_begin(args...) \
508 CCC_doubly_linked_list_node_begin(args)
509# define doubly_linked_list_count(args...) CCC_doubly_linked_list_count(args)
510# define doubly_linked_list_is_empty(args...) \
511 CCC_doubly_linked_list_is_empty(args)
512# define doubly_linked_list_clear(args...) CCC_doubly_linked_list_clear(args)
513# define doubly_linked_list_validate(args...) \
514 CCC_doubly_linked_list_validate(args)
515#endif /* DOUBLY_LINKED_LIST_USING_NAMESPACE_CCC */
516
517#endif /* CCC_LIST_H */
CCC_Result CCC_doubly_linked_list_pop_front(CCC_Doubly_linked_list *list)
Pop the user type at the front of the list. O(1).
void * CCC_doubly_linked_list_erase_range(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder_begin, CCC_Doubly_linked_list_node *type_intruder_end)
Returns the element following an extracted range of elements from the list. O(N).
void * CCC_doubly_linked_list_next(CCC_Doubly_linked_list const *list, CCC_Doubly_linked_list_node const *type_intruder)
Return the user type following the element known to be in the list. O(1).
CCC_Result CCC_doubly_linked_list_splice(CCC_Doubly_linked_list *position_doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder_position, CCC_Doubly_linked_list *to_cut_doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder_to_cut)
Repositions to_cut before pos. Only list pointers are modified. O(1).
CCC_Count CCC_doubly_linked_list_count(CCC_Doubly_linked_list const *list)
Return the count of elements in the list. O(1).
void * CCC_doubly_linked_list_extract(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder)
Returns the element following an extracted element from the list without deallocating regardless of a...
CCC_Tribool CCC_doubly_linked_list_validate(CCC_Doubly_linked_list const *list)
Validates internal state of the list.
CCC_Tribool CCC_doubly_linked_list_is_sorted(CCC_Doubly_linked_list const *doubly_linked_list)
Returns true if the list is sorted in non-decreasing order according to the user provided comparison ...
CCC_Result CCC_doubly_linked_list_splice_range(CCC_Doubly_linked_list *position_doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder_position, CCC_Doubly_linked_list *to_cut_doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder_to_cut_begin, CCC_Doubly_linked_list_node *type_intruder_to_cut_exclusive_end)
Splices the list to cut before the specified position. The range being cut is exclusive from [start,...
void * CCC_doubly_linked_list_insert_sorted(CCC_Doubly_linked_list *doubly_linked_list, CCC_Doubly_linked_list_node *type_intruder)
Inserts type_intruder in sorted position according to the non-decreasing order of the list determined...
CCC_Result CCC_doubly_linked_list_sort(CCC_Doubly_linked_list *doubly_linked_list)
Sorts the doubly linked list in non-decreasing order as defined by the provided comparison function....
CCC_Result CCC_doubly_linked_list_clear(CCC_Doubly_linked_list *list, CCC_Type_destructor *destroy)
Clear the contents of the list freeing elements, if given allocation permission. O(N).
CCC_Doubly_linked_list_node * CCC_doubly_linked_list_node_begin(CCC_Doubly_linked_list const *list)
Return a handle to the list element at the front of the list which may be the sentinel....
void * CCC_doubly_linked_list_end(CCC_Doubly_linked_list const *list)
Return the end sentinel with no accessible fields. O(1).
void * CCC_doubly_linked_list_reverse_end(CCC_Doubly_linked_list const *list)
Return the start sentinel with no accessible fields. O(1).
void * CCC_doubly_linked_list_push_front(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder)
Push user type wrapping type_intruder to the front of the list. O(1).
void * CCC_doubly_linked_list_push_back(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder)
Push user type wrapping type_intruder to the back of the list. O(1).
void * CCC_doubly_linked_list_begin(CCC_Doubly_linked_list const *list)
Return the user type at the start of the list or NULL if empty. O(1).
void * CCC_doubly_linked_list_reverse_next(CCC_Doubly_linked_list const *list, CCC_Doubly_linked_list_node const *type_intruder)
Return the user type following the element known to be in the list moving from back to front....
CCC_Tribool CCC_doubly_linked_list_is_empty(CCC_Doubly_linked_list const *list)
Return if the size of the list is equal to 0. O(1).
void * CCC_doubly_linked_list_insert(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *position_node, CCC_Doubly_linked_list_node *type_intruder)
Insert user type wrapping type_intruder before position_node. O(1).
void * CCC_doubly_linked_list_erase(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder)
Returns the element following an erased element from the list. O(1).
void * CCC_doubly_linked_list_extract_range(CCC_Doubly_linked_list *list, CCC_Doubly_linked_list_node *type_intruder_begin, CCC_Doubly_linked_list_node *type_intruder_end)
Returns the element following an extracted range of elements from the list without deallocating regar...
CCC_Result CCC_doubly_linked_list_pop_back(CCC_Doubly_linked_list *list)
Pop the user type at the back of the list. O(1).
void * CCC_doubly_linked_list_front(CCC_Doubly_linked_list const *list)
Returns the user type at the front of the list. O(1).
void * CCC_doubly_linked_list_back(CCC_Doubly_linked_list const *list)
Returns the user type at the back of the list. O(1).
void * CCC_doubly_linked_list_reverse_begin(CCC_Doubly_linked_list const *list)
Return the user type at the end of the list or NULL if empty. O(1).
A type for returning an unsigned integer from a container for counting. Intended to count sizes,...
Definition: types.h:202
Definition: private_doubly_linked_list.h:34
Definition: private_doubly_linked_list.h:69
The C Container Collection Fundamental Types.
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
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