ALib C++ Library
Library Version: 1912 R0
Documentation generated by doxygen
Public Types | Public Methods | Private Fields | List of all members
BidiNode< TElement > Struct Template Reference

#include <bidilist.hpp>

Inheritance diagram for BidiNode< TElement >:
[legend]
Collaboration diagram for BidiNode< TElement >:
[legend]

Class Description

template<typename TElement>
struct aworx::lib::BidiNode< TElement >


This is a generic base type that represents a node of a doubly (bidirectional) linked lists. The effective (instantiated) nodes of the list are to be derived from this type with specifying their very own type name as template parameter TElement. For more information on this design, see explanations of parent type ForwardNode.

By being derived from aforementioned type, instances of TElement may also be added to single-linked lists of type ForwardList). This is for example used by type List to collect erased list elements for recycling.

Template Parameters
TElementThe "final" node type, containing custom data fields, that is to be derived from this struct.

Definition at line 41 of file bidilist.hpp.

Public Types

using TFNode = ForwardNode< TElement >
 
using TNode = BidiNode< TElement >
 
- Public Types inherited from ForwardNode< TElement >
using ConstIterator = ForwardListIterator< const TElement >
 
using Iterator = ForwardListIterator< TElement >
 
using TNode = ForwardNode< TElement >
 

Public Methods

 BidiNode () noexcept=default
 
 BidiNode (const TNode &)=delete
 
 BidiNode (TElement *next, TElement *previous) noexcept
 
 BidiNode (TNode &&) noexcept=default
 
void addBefore (TElement *elem)
 
void addBefore (TElement *first, TElement *last)
 
void addBehind (TElement *elem)
 
void addBehind (TElement *first, TElement *last)
 
TElement * next () const
 
BidiNodeoperator= (const TNode &)=delete
 
BidiNodeoperator= (TNode &&) noexcept=default
 
TElement * prev () const
 
void remove ()
 
void remove (TElement *last)
 
TElement * self ()
 
- Public Methods inherited from ForwardNode< TElement >
 ForwardNode () noexcept=default
 
 ForwardNode (const TNode &)=delete
 
 ForwardNode (TElement *next) noexcept
 
 ForwardNode (TNode &&) noexcept=default
 
TElement * addBehind (TElement *elem)
 
TElement * addBehind (TElement *first, TElement *last)
 
Iterator begin ()
 
ConstIterator begin () const
 
ConstIterator cbegin () const
 
ConstIterator cend () const
 
Iterator end ()
 
ConstIterator end () const
 
bool hasNext () const
 
bool isLast () const
 
TElement * makeLast ()
 
TElement * makePointTo (TElement *elem)
 
TElement * next () const
 
ForwardNodeoperator= (const TNode &)=delete
 
ForwardNodeoperator= (TNode &&) noexcept=default
 
bool pointsTo (TElement *elem) const
 
TElement * removeNext ()
 
TElement * removeRangeBehind (TElement *last)
 

Private Fields

TElement * backward
 

Additional Inherited Members

- Public Static Methods inherited from ForwardNode< TElement >
static integer count (TElement *start, TElement *end=nullptr)
 
static void moveForward (TElement *&pointer)
 
static TElement * moveForward (TNode *&pointer)
 

Member Typedef Documentation

◆ TFNode

using TFNode = ForwardNode<TElement>

Alias name for the an instantiation of the base template.

Definition at line 49 of file bidilist.hpp.

◆ TNode

using TNode = BidiNode<TElement>

Alias name for the an instantiation of this template.

Definition at line 52 of file bidilist.hpp.

Constructor & Destructor Documentation

◆ BidiNode() [1/4]

BidiNode ( )
defaultnoexcept

Default constructor. (Does not initialize the pointer!)

◆ BidiNode() [2/4]

BidiNode ( const TNode )
delete

Deleted copy constructor. This is deleted because it is dangerous, respectively often not possible and also mostly not wanted to be able to create copies of derived type TElement

◆ BidiNode() [3/4]

BidiNode ( TNode &&  )
defaultnoexcept

Defaulted move constructor.

◆ BidiNode() [4/4]

BidiNode ( TElement *  next,
TElement *  previous 
)
inlinenoexcept

Constructor accepting a pointer to the next element.

Parameters
nextPointer to the next element. Assigned to inherited field forward.
previousPointer to the next element. Assigned to field backward.

Definition at line 90 of file bidilist.hpp.

Member Function Documentation

◆ addBefore() [1/2]

void addBefore ( TElement *  elem)
inline

Hooks the given element before this node.

Parameters
elemThe element to add.

Definition at line 120 of file bidilist.hpp.

◆ addBefore() [2/2]

void addBefore ( TElement *  first,
TElement *  last 
)
inline

Hooks the given range of elements before this node.

Parameters
firstThe first element of the range to insert.
lastThe last element of the range to insert.

Definition at line 131 of file bidilist.hpp.

◆ addBehind() [1/2]

void addBehind ( TElement *  elem)
inline

Hooks the given element behind this node.

Parameters
elemThe element to add.

Definition at line 141 of file bidilist.hpp.

◆ addBehind() [2/2]

void addBehind ( TElement *  first,
TElement *  last 
)
inline

Hooks the given range of elements behind this node.

Parameters
firstThe first element of the range to insert.
lastThe last element of the range to insert.

Definition at line 152 of file bidilist.hpp.

◆ next()

TElement* next ( ) const
inline

Returns the successor of this node or element.

Returns
The element following this one, respectively an non-dereferencable end-marker node, in case this is the last element of the list.

Definition at line 98 of file bidilist.hpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

BidiNode& operator= ( const TNode )
delete

Deleted copy assignment operator. This is deleted because it is dangerous, respectively often not possible and also mostly not wanted to created copies of derived type TElement

Returns
Not defined.

◆ operator=() [2/2]

BidiNode& operator= ( TNode &&  )
defaultnoexcept

Defaulted move assignment operator.

Returns
A reference to this object.

◆ prev()

TElement* prev ( ) const
inline

Returns the predecessor of this node or element.

Returns
The element before this one, respectively an non-dereferencable end-marker node, in case this is the first element of the list.

Definition at line 106 of file bidilist.hpp.

Here is the caller graph for this function:

◆ remove() [1/2]

void remove ( )
inline

Unhooks this node from a list.

Definition at line 162 of file bidilist.hpp.

◆ remove() [2/2]

void remove ( TElement *  last)
inline

Unhooks the range of nodes starting with this node and ending with last a list.

Parameters
lastThe last element of the range to remove.

Definition at line 170 of file bidilist.hpp.

◆ self()

TElement* self ( )
inline

Returns this node statically casted to TElement.

Returns
This casted to TElement

Definition at line 113 of file bidilist.hpp.

Member Data Documentation

◆ backward

TElement* backward
private

In case of derived type TElement this is the pointer to the previous element. In case of derived class BidiList, this is the pointer to the last element of the list.

Definition at line 59 of file bidilist.hpp.


The documentation for this struct was generated from the following file: