40#ifndef CCC_DOUBLY_LINKED_LIST_H
41#define CCC_DOUBLY_LINKED_LIST_H
47#include "private/private_doubly_linked_list.h"
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)
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)
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)
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)
462#ifdef DOUBLY_LINKED_LIST_USING_NAMESPACE_CCC
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)
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