40#ifndef CCC_DOUBLY_LINKED_LIST_H
41#define CCC_DOUBLY_LINKED_LIST_H
47#include "private/private_doubly_linked_list.h"
93#define CCC_doubly_linked_list_initialize(struct_name, type_intruder_field, \
94 compare, allocate, context_data) \
95 CCC_private_doubly_linked_list_initialize( \
96 struct_name, type_intruder_field, compare, allocate, context_data)
112#define CCC_doubly_linked_list_from(type_intruder_field, compare, allocate, \
113 destroy, context_data, \
114 compound_literal_array...) \
115 CCC_private_doubly_linked_list_from(type_intruder_field, compare, \
116 allocate, destroy, context_data, \
117 compound_literal_array)
145#define CCC_doubly_linked_list_with_allocator( \
146 struct_name, type_intruder_field, compare, allocate) \
147 CCC_private_doubly_linked_list_with_allocator( \
148 struct_name, type_intruder_field, compare, allocate)
177#define CCC_doubly_linked_list_with_context_allocator( \
178 struct_name, type_intruder_field, compare, allocate, context) \
179 CCC_private_doubly_linked_list_with_context_allocator( \
180 struct_name, type_intruder_field, compare, allocate, context)
201#define CCC_doubly_linked_list_emplace_back(list_pointer, \
202 type_compound_literal...) \
203 CCC_private_doubly_linked_list_emplace_back(list_pointer, \
204 type_compound_literal)
219#define CCC_doubly_linked_list_emplace_front(list_pointer, \
220 type_compound_literal...) \
221 CCC_private_doubly_linked_list_emplace_front(list_pointer, \
222 type_compound_literal)
524#ifdef DOUBLY_LINKED_LIST_USING_NAMESPACE_CCC
527# define doubly_linked_list_initialize(arguments...) \
528 CCC_doubly_linked_list_initialize(arguments)
529# define doubly_linked_list_from(arguments...) \
530 CCC_doubly_linked_list_from(arguments)
531# define doubly_linked_list_with_allocator(arguments...) \
532 CCC_doubly_linked_list_with_allocator(arguments)
533# define doubly_linked_list_with_context_allocator(arguments...) \
534 CCC_doubly_linked_list_with_context_allocator(arguments)
535# define doubly_linked_list_emplace_back(arguments...) \
536 CCC_doubly_linked_list_emplace_back(arguments)
537# define doubly_linked_list_emplace_front(arguments...) \
538 CCC_doubly_linked_list_emplace_front(arguments)
539# define doubly_linked_list_push_front(arguments...) \
540 CCC_doubly_linked_list_push_front(arguments)
541# define doubly_linked_list_push_back(arguments...) \
542 CCC_doubly_linked_list_push_back(arguments)
543# define doubly_linked_list_front(arguments...) \
544 CCC_doubly_linked_list_front(arguments)
545# define doubly_linked_list_back(arguments...) \
546 CCC_doubly_linked_list_back(arguments)
547# define doubly_linked_list_pop_front(arguments...) \
548 CCC_doubly_linked_list_pop_front(arguments)
549# define doubly_linked_list_pop_back(arguments...) \
550 CCC_doubly_linked_list_pop_back(arguments)
551# define doubly_linked_list_extract(arguments...) \
552 CCC_doubly_linked_list_extract(arguments)
553# define doubly_linked_list_extract_range(arguments...) \
554 CCC_doubly_linked_list_extract_range(arguments)
555# define doubly_linked_list_erase(arguments...) \
556 CCC_doubly_linked_list_erase(arguments)
557# define doubly_linked_list_erase_range(arguments...) \
558 CCC_doubly_linked_list_erase_range(arguments)
559# define doubly_linked_list_splice(arguments...) \
560 CCC_doubly_linked_list_splice(arguments)
561# define doubly_linked_list_splice_range(arguments...) \
562 CCC_doubly_linked_list_splice_range(arguments)
563# define doubly_linked_list_sort(arguments...) \
564 CCC_doubly_linked_list_sort(arguments)
565# define doubly_linked_list_insert_sorted(arguments...) \
566 CCC_doubly_linked_list_insert_sorted(arguments)
567# define doubly_linked_list_is_sorted(arguments...) \
568 CCC_doubly_linked_list_is_sorted(arguments)
569# define doubly_linked_list_begin(arguments...) \
570 CCC_doubly_linked_list_begin(arguments)
571# define doubly_linked_list_next(arguments...) \
572 CCC_doubly_linked_list_next(arguments)
573# define doubly_linked_list_reverse_begin(arguments...) \
574 CCC_doubly_linked_list_reverse_begin(arguments)
575# define doubly_linked_list_reverse_next(arguments...) \
576 CCC_doubly_linked_list_reverse_next(arguments)
577# define doubly_linked_list_end(arguments...) \
578 CCC_doubly_linked_list_end(arguments)
579# define doubly_linked_list_reverse_end(arguments...) \
580 CCC_doubly_linked_list_reverse_end(arguments)
581# define doubly_linked_list_node_begin(arguments...) \
582 CCC_doubly_linked_list_node_begin(arguments)
583# define doubly_linked_list_count(arguments...) \
584 CCC_doubly_linked_list_count(arguments)
585# define doubly_linked_list_is_empty(arguments...) \
586 CCC_doubly_linked_list_is_empty(arguments)
587# define doubly_linked_list_clear(arguments...) \
588 CCC_doubly_linked_list_clear(arguments)
589# define doubly_linked_list_validate(arguments...) \
590 CCC_doubly_linked_list_validate(arguments)
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