4#include "include/types.hpp"
64 node *next{
nullptr };
65 node *prev{
nullptr };
66 list *container{
nullptr };
67 void init(
void )
noexcept;
69 void operator=(
node const& ) =
delete;
79 node() : next(nullptr), prev(nullptr), container(nullptr) {}
121 node *head{
nullptr };
122 node *tail{
nullptr };
124 bool isMember(
const void *
const xNode )
const noexcept;
125 void insertAtFront(
node *
const xNode )
noexcept;
126 void insertAtBack(
node *
const xNode )
noexcept;
127 node* removeFront(
void )
noexcept;
128 node* removeBack(
void )
noexcept;
130 void givenNodeSwapBoundaries(
node *n1,
node *n2 )
noexcept;
131 static void givenNodeSwapAdjacent(
node *n1,
node *n2 )
noexcept;
132 static void givenNodesUpdateOuterLinks(
node *n1,
node *n2 )
noexcept;
134 void operator=(
list const& ) =
delete;
155 bool remove(
void *
const xNode )
noexcept;
217 bool swap(
void* node1,
void* node2 ) noexcept;
261 node *iter{
nullptr };
262 void *current{
nullptr };
280 bool untilEnd(
void ) const noexcept;
286 bool untilEnd(
void*
node ) const noexcept;
299 template <typename T>
300 inline T get(
void ) noexcept
303 return static_cast<T
>( current );
A list object (Generic double-linked)
Definition list.hpp:119
bool insert(void *const xNode, const listPosition p=listPosition::AT_BACK) noexcept
Insert an item into the list.
listIterator begin(void) noexcept
Returns an iterator pointing to the first element in the list container.
bool isEmpty(void) const noexcept
Check if the list is empty.
void * remove(const listPosition p, void *const xNode=nullptr) noexcept
Remove an item from the list.
size_t length(void) const noexcept
Get the number of items inside the list.
listIterator from(void *offset) noexcept
Returns an iterator pointing to the element given by offset in the list container.
bool swap(void *node1, void *node2) noexcept
Swap two nodes that belongs to the list by changing its own links.
bool remove(void *const xNode) noexcept
If the node is member of a list, the node will be removed from it.
void * getFront(void) const noexcept
Get a pointer to the front item of the list.
bool sort(listCompareFcn_t f) noexcept
Sort the double linked list using the f function to determine the order. The sorting algorithm used b...
listIterator end(void) noexcept
Returns an iterator pointing to the last element in the list container.
void * getBack(void) const noexcept
Get a pointer to the back item of the list.
void clean(void) noexcept
Clean up the entire list leaving it empty.
bool move(list &src, const listPosition p=listPosition::AT_BACK) noexcept
Moves(or merge) the entire list src to the given list. After the move operation, this function leaves...
A list iterator.
Definition list.hpp:258
listIterator(list &xList, listDirection dir=listDirection::FORWARD, void *nodeOffset=nullptr) noexcept
Instantiate a list iterator for the given list.
A list-node object (Used internally)
Definition list.hpp:62
list * getContainer(void) noexcept
Get a pointer to the list in which this node is contained.
Definition list.hpp:75
node()
Definition list.hpp:79
listDirection
An enum with the possible options to transverse a list.
Definition list.hpp:109
listPosition
An enum with the possible options to specify a target position for a list.
Definition list.hpp:53
bool(*)(const void *, const void *) listCompareFcn_t
Pointer to a function used by the list::sort() method to compare nodes of a list.
Definition list.hpp:104
@ AT_FRONT
Definition list.hpp:54
@ AT_BACK
Definition list.hpp:55
OS/Kernel interfaces.
Definition bytebuffer.hpp:7