ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::lang::BidiNodeBase< TElement > Struct Template Reference

Description:

template<typename TElement>
struct alib::lang::BidiNodeBase< TElement >

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

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

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

Definition at line 29 of file bidilist.inl.

Inheritance diagram for alib::lang::BidiNodeBase< TElement >:
alib::lang::SidiNodeBase< TElement >

Public Type Index:

using FWDNode = SidiNodeBase<TElement>
 Alias name for an instantiation of the base template.

Public Field Index:

TElement * p
Public Field Index: inherited from alib::lang::SidiNodeBase< TElement >
TElement * n

Public Method Index:

 BidiNodeBase () noexcept=default
 Default constructor. (Does not initialize the pointer!).
 BidiNodeBase (BidiNodeBase &&) noexcept=default
 Defaulted move constructor.
 BidiNodeBase (const BidiNodeBase &)=delete
 BidiNodeBase (TElement *next, TElement *prev) noexcept
void addBefore (TElement *elem) noexcept
void addBehind (TElement *elem) noexcept
BidiNodeBaseoperator= (BidiNodeBase &&) noexcept=default
BidiNodeBaseoperator= (const BidiNodeBase &)=delete
TElement * prev () const noexcept
void prev (BidiNodeBase *previous) noexcept
void remove () noexcept
 Unhooks this node from a list.
void remove (TElement *last) noexcept
Public Method Index: inherited from alib::lang::SidiNodeBase< TElement >
 SidiNodeBase () noexcept=default
 Default constructor. (Does not initialize the pointer.).
 SidiNodeBase (const SidiNodeBase &)=delete
 SidiNodeBase (SidiNodeBase &&) noexcept=default
 Defaulted move constructor.
 SidiNodeBase (TElement *next) noexcept
TElement * addBehind (TElement *elem) noexcept
integer count (SidiNodeBase *end=nullptr) const noexcept
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 () noexcept
TElement * removeRangeBehind (TElement *last) noexcept

Type Definition Details:

◆ FWDNode

template<typename TElement>
using alib::lang::BidiNodeBase< TElement >::FWDNode = SidiNodeBase<TElement>

Alias name for an instantiation of the base template.

Definition at line 32 of file bidilist.inl.

Field Details:

◆ p

template<typename TElement>
TElement* alib::lang::BidiNodeBase< TElement >::p

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 38 of file bidilist.inl.

Constructor(s) / Destructor Details:

◆ BidiNodeBase() [1/2]

template<typename TElement>
alib::lang::BidiNodeBase< TElement >::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() [2/2]

template<typename TElement>
alib::lang::BidiNodeBase< TElement >::BidiNodeBase ( TElement * next,
TElement * prev )
inlinenoexcept

Constructor accepting a pointer to the next and previous elements.

Parameters
nextPointer to the next element. Assigned to the inherited field SidiNodeBase::n.
prevPointer to the next element. Assigned to the field p.

Definition at line 65 of file bidilist.inl.

Method Details:

◆ addBefore()

template<typename TElement>
void alib::lang::BidiNodeBase< TElement >::addBefore ( TElement * elem)
inlinenoexcept

Hooks the given element before this node.

Parameters
elemThe element to add.

Definition at line 80 of file bidilist.inl.

◆ addBehind()

template<typename TElement>
void alib::lang::BidiNodeBase< TElement >::addBehind ( TElement * elem)
inlinenoexcept

Hooks the given element behind this node.

Parameters
elemThe element to add.

Definition at line 89 of file bidilist.inl.

◆ operator=() [1/2]

template<typename TElement>
BidiNodeBase & alib::lang::BidiNodeBase< TElement >::operator= ( BidiNodeBase< TElement > && )
defaultnoexcept

Defaulted move assignment operator.

Returns
A reference to this object.

◆ operator=() [2/2]

template<typename TElement>
BidiNodeBase & alib::lang::BidiNodeBase< TElement >::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 create copies of derived type TElement.

Returns
Not defined.

◆ prev() [1/2]

template<typename TElement>
TElement * alib::lang::BidiNodeBase< TElement >::prev ( ) const
inlinenodiscardnoexcept

Returns the backward pointer of this node.

Returns
Pointer to the previous element.

Definition at line 72 of file bidilist.inl.

◆ prev() [2/2]

template<typename TElement>
void alib::lang::BidiNodeBase< TElement >::prev ( BidiNodeBase< TElement > * previous)
inlinenoexcept

Sets the backward pointer of this node.

Parameters
previousPointer to the previous element.

Definition at line 76 of file bidilist.inl.

◆ remove() [1/2]

template<typename TElement>
void alib::lang::BidiNodeBase< TElement >::remove ( )
inlinenoexcept

Unhooks this node from a list.

Definition at line 97 of file bidilist.inl.

◆ remove() [2/2]

template<typename TElement>
void alib::lang::BidiNodeBase< TElement >::remove ( TElement * last)
inlinenoexcept

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 101 of file bidilist.inl.


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