50#ifndef MICRO_OS_PLUS_UTILS_LISTS_H_
51#define MICRO_OS_PLUS_UTILS_LISTS_H_
59#if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
60#include <micro-os-plus/config.h>
71#pragma GCC diagnostic push
73#pragma GCC diagnostic ignored "-Waggregate-return"
75#pragma clang diagnostic ignored "-Wc++98-compat"
488 template <
class T,
class N = T,
class U = T>
673 template <
class T,
class L =
double_list_links>
677 static_assert (std::is_base_of<double_list_links_base, L>::value ==
true,
678 "L must be derived from double_list_links_base!");
679 static_assert (std::is_base_of<double_list_links_base, T>::value ==
true,
680 "T must be derived from double_list_links_base!");
717 typename links_type::is_statically_allocated;
927 template <
class T,
class N, N T::* MP,
class U = T>
1086#if defined(__clang__)
1087#pragma clang diagnostic push
1088#pragma clang diagnostic ignored "-Wdocumentation"
1129#if defined(__clang__)
1130#pragma clang diagnostic pop
1138 static_assert (std::is_base_of<double_list_links_base, L>::value ==
true,
1139 "L must be derived from double_list_links_base!");
1140 static_assert (std::is_base_of<double_list_links_base, N>::value ==
true,
1141 "N must be derived from double_list_links_base!");
1173 typename links_type::is_statically_allocated;
1336#if defined(__GNUC__)
1337#pragma GCC diagnostic pop
A class template for a doubly linked list forward iterator.
constexpr double_list_iterator(reference element)
Construct an iterator from a reference to an element.
ptrdiff_t difference_type
Type of pointer difference.
constexpr bool operator==(const double_list_iterator &other) const
Equality comparison operator.
constexpr iterator_pointer get_iterator_pointer(void) const
Get the internal iterator pointer (node pointer).
constexpr pointer operator->() const
Pointer access operator.
value_type * pointer
Type of pointer to object pointed to by the iterator.
constexpr pointer get_pointer(void) const
Get a pointer to the value pointed to by the iterator.
constexpr double_list_iterator & operator--()
Pre-decrement operator.
constexpr bool operator!=(const double_list_iterator &other) const
Inequality comparison operator.
std::forward_iterator_tag iterator_category
Category of iterator.
constexpr double_list_iterator & operator++()
Pre-increment operator.
constexpr reference operator*() const
Dereference operator.
constexpr double_list_iterator(iterator_pointer const node)
Construct an iterator from a node pointer.
value_type & reference
Type of reference to object pointed to by the iterator.
U value_type
Type of value pointed to by the iterator.
constexpr double_list_iterator()
Default constructor. Constructs an iterator pointing to nullptr.
N * iterator_pointer
Type of reference to the iterator internal pointer.
constexpr ~double_list_links_base()
Destruct the node.
double_list_links_base * previous_
Pointer to the previous node.
void initialize_once(void)
Initialise the node links only if not already initialised.
double_list_links_base(const double_list_links_base &)=delete
Deleted copy constructor.
constexpr double_list_links_base()
Construct an uninitialised list node.
constexpr double_list_links_base * next(void) const
Get the link to the next node.
void link_next(double_list_links_base *node)
Link the new node as next.
constexpr double_list_links_base * previous(void) const
Get the link to the previous node.
bool linked(void) const
Check if the node is linked to a doubly linked list.
void link_previous(double_list_links_base *node)
Link the new node as previous.
bool uninitialized(void) const
Check if the node is uninitialised.
double_list_links_base & operator=(const double_list_links_base &)=delete
Deleted copy assignment operator.
double_list_links_base * next_
Pointer to the next node.
double_list_links_base(double_list_links_base &&)=delete
Deleted move constructor.
constexpr void initialize(void)
Initialise the node links.
void unlink(void)
Remove this node from the list.
A class for the core of a doubly linked list (pointers to neighbours).
double_list_links & operator=(const double_list_links &)=delete
Deleted copy assignment operator.
constexpr double_list_links()
Construct a list node (initialise the pointers).
constexpr ~double_list_links()
Destruct the node.
double_list_links(const double_list_links &)=delete
Deleted copy constructor.
double_list_links(double_list_links &&)=delete
Deleted move constructor.
std::false_type is_statically_allocated
Type indicating that the links node is not statically allocated.
constexpr const links_type * links_pointer(void) const
Get the address of the node storing the list links.
void link_head(reference node)
Add a node to the head of the list.
links_type links_
The list top node used to point to head and tail nodes.
L links_type
Type of the links node object where the pointers to the list head and tail are stored.
value_type * iterator_pointer
Type of reference to the iterator internal pointer.
constexpr pointer tail(void) const
Get the list tail.
double_list(double_list &&)=delete
Deleted move constructor.
void initialize_once(void)
Initialize the list only at first run.
value_type * pointer
Type of pointer to object pointed to by the iterator.
constexpr ~double_list()
Destruct the list.
value_type & reference
Type of reference to object pointed to by the iterator.
double_list()
Construct a doubly linked list.
void clear(void)
Clear the list.
constexpr pointer head(void) const
Get the list head.
iterator end() const
Iterator end.
double_list & operator=(const double_list &)=delete
Deleted copy assignment operator.
double_list(const double_list &)=delete
Deleted copy constructor.
T value_type
Type of value pointed to by the iterator.
iterator begin() const
Iterator begin.
double_list_iterator< value_type > iterator
Type of iterator over the values.
bool empty(void) const
Check if the list is empty.
void link_tail(reference node)
Add a node to the tail of the list.
bool uninitialized(void) const
Check if the list is uninitialised (only statically allocated lists can be uninitialised).
typename links_type::is_statically_allocated is_statically_allocated
Type indicating if the links node is statically allocated.
A class template for the intrusive list iterator.
value_type * pointer
Type of pointer to object pointed to by the iterator.
std::forward_iterator_tag iterator_category
Category of iterator.
pointer get_pointer(void) const
Get the object node from the intrusive node.
intrusive_list_iterator & operator++()
Pre-increment operator.
iterator_pointer get_iterator_pointer(void) const
Retrieve the iterator pointer for the current node.
N * iterator_pointer
Type of reference to the iterator internal pointer.
reference operator*() const
Dereference operator.
bool operator==(const intrusive_list_iterator &other) const
Equality comparison operator.
value_type & reference
Type of reference to object pointed to by the iterator.
constexpr intrusive_list_iterator()
Default constructor. Constructs an iterator pointing to nullptr.
bool operator!=(const intrusive_list_iterator &other) const
Inequality comparison operator.
U value_type
Type of value pointed to by the iterator.
pointer operator->() const
Pointer access operator.
constexpr intrusive_list_iterator(iterator_pointer const node)
Construct an iterator from a node pointer.
constexpr intrusive_list_iterator(reference element)
Construct an iterator from a reference to an element.
intrusive_list_iterator & operator--()
Pre-decrement operator.
ptrdiff_t difference_type
Type of pointer difference.
constexpr intrusive_list()
Construct an intrusive doubly linked list.
L links_type
Type of the list links node object where the pointers to the list head and tail are stored.
constexpr bool empty(void) const
Check if the list is empty.
void link_tail(reference node)
Add a node to the tail of the list.
N * iterator_pointer
Type of reference to the iterator internal pointer.
iterator begin() const
Iterator begin.
typename links_type::is_statically_allocated is_statically_allocated
Type indicating if the links node is statically allocated.
pointer unlink_head(void)
Unlink the first element from the list.
void link_head(reference node)
Add a node to the head of the list.
constexpr ~intrusive_list()
Destruct the list.
intrusive_list_iterator< T, N, MP, U > iterator
Type of iterator over the values.
void initialize_once(void)
Initialize the list only at first run.
U value_type
Type of value pointed to by the iterator.
iterator end() const
Iterator begin.
intrusive_list & operator=(const intrusive_list &)=delete
Deleted copy assignment operator.
value_type & reference
Type of reference to object pointed to by the iterator.
ptrdiff_t difference_type
Type of pointer difference.
value_type * pointer
Type of pointer to object pointed to by the iterator.
intrusive_list(intrusive_list &&)=delete
Deleted move constructor.
pointer unlink_tail(void)
Unlink the last element from the list.
pointer get_pointer(iterator_pointer node) const
Get the address of the object from the intrusive node pointer.
intrusive_list(const intrusive_list &)=delete
Deleted copy constructor.
static_double_list_links(static_double_list_links &&)=delete
Deleted move constructor.
static_double_list_links & operator=(const static_double_list_links &)=delete
Deleted copy assignment operator.
static_double_list_links(const static_double_list_links &)=delete
Deleted copy constructor.
std::true_type is_statically_allocated
Type indicating that the links node is statically allocated.
constexpr static_double_list_links()
Construct a statically allocated list node (BSS initialised).
constexpr ~static_double_list_links()
Destruct the node.
void nullify(void)
Reset the two pointers to nullptr.
C++ header file with the inline implementations for the µOS++ lists methods.
The µOS++ utilities definitions.