41#ifndef MICRO_OS_PLUS_UTILS_LISTS_H_
42#define MICRO_OS_PLUS_UTILS_LISTS_H_
50#if defined(MICRO_OS_PLUS_INCLUDE_CONFIG_H)
51#include <micro-os-plus/config.h>
62#pragma GCC diagnostic push
64#pragma GCC diagnostic ignored "-Waggregate-return"
66#pragma clang diagnostic ignored "-Wc++98-compat"
371 template <
class T,
class N = T,
class U = T>
485 template <
class T,
class L =
double_list_links>
489 static_assert (std::is_base_of<double_list_links_base, L>::value ==
true,
490 "L must be derived from double_list_links_base!");
491 static_assert (std::is_base_of<double_list_links_base, T>::value ==
true,
492 "T must be derived from double_list_links_base!");
529 typename links_type::is_statically_allocated;
694 template <
class T,
class N, N T::*MP,
class U = T>
821 static_assert (std::is_base_of<double_list_links_base, L>::value ==
true,
822 "L must be derived from double_list_links_base!");
823 static_assert (std::is_base_of<double_list_links_base, N>::value ==
true,
824 "N must be derived from double_list_links_base!");
856 typename links_type::is_statically_allocated;
979#pragma GCC diagnostic pop
A class template for a double linked list forward iterator.
constexpr double_list_iterator(reference element)
ptrdiff_t difference_type
Type of pointer difference.
constexpr bool operator==(const double_list_iterator &other) const
constexpr pointer get_pointer() const
constexpr pointer operator->() const
value_type * pointer
Type of pointer to object "pointed to" by the iterator.
constexpr double_list_iterator & operator--()
constexpr bool operator!=(const double_list_iterator &other) const
std::forward_iterator_tag iterator_category
Category of iterator.
constexpr iterator_pointer get_iterator_pointer() const
constexpr double_list_iterator & operator++()
constexpr reference operator*() const
value_type & reference
Type of reference to object "pointed to" by the iterator.
iterator_pointer node_
Pointer to the node.
U value_type
Type of value "pointed to" by the iterator.
constexpr double_list_iterator()
N * iterator_pointer
Type of reference to the iterator internal pointer.
A base class for a double linked list.
constexpr ~double_list_links_base()
Destruct the node.
double_list_links_base * previous_
Pointer to the previous node.
void initialize_once(void)
Initialize the list only at first run.
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 double 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 * next_
Pointer to the next node.
constexpr void initialize(void)
Initialise the node links.
void unlink(void)
Remove this node from the list.
A class for the core of a double linked list (pointers to neighbours).
constexpr double_list_links()
Construct a list node (initialise the pointers).
constexpr ~double_list_links()
Destruct the node.
std::false_type is_statically_allocated
Type indicating that the links node is not statically allocated.
A class template for a double linked list of nodes.
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.
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 const links_type * links_pointer() const
Get the address of the node storing the list links.
constexpr ~double_list()
Destruct the list.
value_type & reference
Type of reference to object "pointed to" by the iterator.
double_list()
Construct a double linked list.
void clear(void)
Clear the list.
constexpr pointer head(void) const
Get the list head.
iterator end() const
Iterator end.
T value_type
Type of value "pointed to" by the iterator.
iterator begin() const
Iterator begin.
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 can be).
typename links_type::is_statically_allocated is_statically_allocated
Type indicating that the links node is statically allocated.
A class template for an 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++()
N * iterator_pointer
Type of reference to the iterator internal pointer.
reference operator*() const
bool operator==(const intrusive_list_iterator &other) const
iterator_pointer get_iterator_pointer() const
value_type & reference
Type of reference to object "pointed to" by the iterator.
constexpr intrusive_list_iterator()
bool operator!=(const intrusive_list_iterator &other) const
U value_type
Type of value "pointed to" by the iterator.
pointer operator->() const
intrusive_list_iterator & operator--()
ptrdiff_t difference_type
Type of pointer difference.
iterator_pointer node_
Pointer to intrusive node.
A class template for a list of nodes which store the links inside themselves as intrusive nodes.
constexpr intrusive_list()
Construct an intrusive double 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 of reference to the iterator internal pointer.
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.
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.
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.
pointer unlink_tail(void)
Unlink the last element from the list.
pointer get_pointer(iterator_pointer node) const
Get the address of the node.
A class for the core of a statically allocated double linked list (pointers to neighbours).
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.
µOS++ utility definitions.