The double_list Class Template Reference
A class template for a doubly linked list of nodes. More...
Fully Qualified Name
micro_os_plus::utils::double_list< T, L >
Included Headers
#include <micro-os-plus/utils/lists.h>
Derived Classes
class | |
A class template for a list of nodes which store the links inside themselves as intrusive nodes. More... | |
Member Typedefs
using | is_statically_allocated = typename links_type::is_statically_allocated |
Type indicating that the links node is statically allocated. More... | |
using | |
Type of iterator over the values. More... | |
using | |
Type of reference to the iterator internal pointer. More... | |
using | links_type = L |
Type of the links node object where the pointers to the list head and tail are stored. More... | |
using | pointer = value_type * |
Type of pointer to object pointed to by the iterator. More... | |
using | reference = value_type & |
Type of reference to object pointed to by the iterator. More... | |
using | value_type = T |
Type of value pointed to by the iterator. More... | |
Protected Member Attributes
The list top node used to point to head and tail nodes. More... | |
Member Functions
double_list () | |
Construct a doubly linked list. More... | |
constexpr | ~double_list () |
Destruct the list. More... | |
begin () const | |
Iterator begin. More... | |
void | clear (void) |
Clear the list. More... | |
bool | empty (void) const |
Check if the list is empty. More... | |
end () const | |
Iterator end. More... | |
head (void) const | |
Get the list head. More... | |
void | initialize_once (void) |
Initialize the list only at first run. More... | |
void | link_head (reference node) |
Add a node to the head of the list. More... | |
void | link_tail (reference node) |
Add a node to the tail of the list. More... | |
const links_type * | links_pointer () const |
Get the address of the node storing the list links. More... | |
tail (void) const | |
Get the list tail. More... | |
bool | uninitialized (void) const |
Check if the list is uninitialised (only statically allocated lists can be uninitialised). More... | |
Description
The class template declaration is:
template < class T, class L = double_list_links >
class micro_os_plus::utils::double_list< T, L >;
- Template Parameters
T Type of the elements linked into the list, derived from class double_list_links_base
.L Type of the links node (one of double_list_links
orstatic_double_list_links
).
A doubly linked list is a pair of head/tail pointers, allowing to iterate over the nodes.
Currently only forward iterators are provided, but there is no problem to add reverse iterators, if needed.
The list elements (of type T) should be derived from the double_list_links_base
class, (usually from double_list_links
) extended with the payload, that may be either the actual content or a pointer to the content.
The iterators return pointers to the list elements, i.e. to the beginning of the objects of type T.
The class does not use inheritance, but composition for the links node, to avoid inheriting unwanted methods from it.
Definition at line 501 of file lists.h.
Member Typedefs
is_statically_allocated
|
iterator
|
iterator_pointer
|
links_type
|
pointer
|
reference
|
value_type
Protected Member Attributes
links_
| protected |
Constructors
double_list()
|
Destructor
~double_list()
| constexpr |
Member Functions
begin()
|
clear()
|
empty()
|
end()
|
head()
| constexpr |
initialize_once()
|
Initialize the list only at first run.
- Parameters
None.
- Returns
Nothing.
If the statically allocated list is still in the initial uninitialised state (with both pointers null), initialise the list to the empty state, with both pointers pointing to itself.
For non-statically initialised lists, this method is ineffective.
Must be manually called for statically allocated list before inserting elements, or any other operations.
link_head()
|
link_tail()
|
links_pointer()
| inlineconstexpr |
tail()
| constexpr |
uninitialized()
|
Check if the list is uninitialised (only statically allocated lists can be uninitialised).
- Parameters
None.
- Return Values
true The list was not initialised. false The list was initialised.
An uninitialized node is a node with any of the pointers set to nullptr
.
Only statically allocated nodes in the initial state are uninitialized.
Generated via docusaurus-plugin-doxygen by Doxygen 1.13.2