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

#include <bidilist.hpp>

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

Class Description

template<typename TElement>
struct aworx::lib::detail::BidiNodeBase< 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 detail::SidiNodeBase.

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

See also
Types detail::SidiNodeBase,
detail::SidiListHelper and
detail::BidiListHelper.
Template Parameters
TElementThe "final" node type, containing custom data fields, that is to be derived from this struct.

Definition at line 43 of file bidilist.hpp.

Public Types

using FWDNode = SidiNodeBase< TElement >
 

Public Fields

TElement * pprev
 
- Public Fields inherited from SidiNodeBase< TElement >
TElement * pnext
 

Public Methods

 BidiNodeBase () noexcept=default
 
 BidiNodeBase (BidiNodeBase &&) noexcept=default
 
 BidiNodeBase (const BidiNodeBase &)=delete
 
 BidiNodeBase (TElement *next, TElement *prev) noexcept
 
void addBefore (TElement *elem)
 
void addBehind (TElement *elem)
 
BidiNodeBaseoperator= (BidiNodeBase &&) noexcept=default
 
BidiNodeBaseoperator= (const BidiNodeBase &)=delete
 
TElement * prev () const
 
void prev (BidiNodeBase *newPrev)
 
void remove ()
 
void remove (TElement *last)
 
- Public Methods inherited from SidiNodeBase< TElement >
 SidiNodeBase () noexcept=default
 
 SidiNodeBase (const SidiNodeBase &)=delete
 
 SidiNodeBase (SidiNodeBase &&) noexcept=default
 
 SidiNodeBase (TElement *next) noexcept
 
TElement * addBehind (TElement *elem)
 
integer count (SidiNodeBase *end=nullptr) const
 
bool hasNext () const
 
TElement * next () const
 
void next (SidiNodeBase *p)
 
SidiNodeBaseoperator= (const SidiNodeBase &)=delete
 
SidiNodeBaseoperator= (SidiNodeBase &&) noexcept=default
 
bool pointsTo (const SidiNodeBase *elem) const
 
TElement * removeNext ()
 
TElement * removeRangeBehind (TElement *last)
 

Member Typedef Documentation

◆ FWDNode

using FWDNode = SidiNodeBase<TElement>

Alias name for the an instantiation of the base template.

Definition at line 46 of file bidilist.hpp.

Constructor & Destructor Documentation

◆ BidiNodeBase() [1/4]

BidiNodeBase ( )
defaultnoexcept

Default constructor. (Does not initialize the pointer!)

◆ BidiNodeBase() [2/4]

BidiNodeBase ( const BidiNodeBase< TElement > &  )
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

◆ BidiNodeBase() [3/4]

BidiNodeBase ( BidiNodeBase< TElement > &&  )
defaultnoexcept

Defaulted move constructor.

◆ BidiNodeBase() [4/4]

BidiNodeBase ( TElement *  next,
TElement *  prev 
)
inlinenoexcept

Constructor accepting a pointer to the next and previous elements.

Parameters
nextPointer to the next element. Assigned to inherited field detail::SidiNodeBase::pnext.
prevPointer to the next element. Assigned to field pprev.

Definition at line 80 of file bidilist.hpp.

Member Function Documentation

◆ addBefore()

void addBefore ( TElement *  elem)
inline

Hooks the given element before this node.

Parameters
elemThe element to add.

Definition at line 95 of file bidilist.hpp.

◆ addBehind()

void addBehind ( TElement *  elem)
inline

Hooks the given element behind this node.

Parameters
elemThe element to add.

Definition at line 105 of file bidilist.hpp.

◆ operator=() [1/2]

BidiNodeBase& operator= ( BidiNodeBase< TElement > &&  )
defaultnoexcept

Defaulted move assignment operator.

Returns
A reference to this object.

◆ operator=() [2/2]

BidiNodeBase& operator= ( const BidiNodeBase< TElement > &  )
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.

◆ prev() [1/2]

TElement* prev ( ) const
inline

Returns the backward pointer of this node.

Returns
Pointer to the previous element.

Definition at line 87 of file bidilist.hpp.

◆ prev() [2/2]

void prev ( BidiNodeBase< TElement > *  newPrev)
inline

Sets the backward pointer of this node.

Parameters
newPrevPointer to the previous element.

Definition at line 91 of file bidilist.hpp.

◆ remove() [1/2]

void remove ( )
inline

Unhooks this node from a list.

Definition at line 114 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 122 of file bidilist.hpp.

Member Data Documentation

◆ pprev

TElement* pprev

A pointer to the previous element in the list.

Attention
If this is the first node in the list, this object will point to the list hook, which is an instance of this type instead of template type TElement.

Definition at line 52 of file bidilist.hpp.


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