Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Dnode< T > Class Template Reference

Node belonging to a double circular linked list with header node. More...

#include <tpl_dnode.H>

Inheritance diagram for Aleph::Dnode< T >:
[legend]
Collaboration diagram for Aleph::Dnode< T >:
[legend]

Classes

class  Iterator
 Iterator on a list of Dnode objects. More...
 

Public Types

using key_type = T
 The data type.
 

Public Member Functions

Dnode< T > *& get_next () const noexcept
 Return the next node to this
 
Dnode< T > *& get_prev () const noexcept
 Return the previous node to this
 
Dnode< T > * remove_prev () noexcept
 Remove the previous node to this; return its address.
 
Dnode< T > * remove_next () noexcept
 Remove the next node to this; return its address.
 
Dnode< T > *& get_first_ne () const noexcept
 Get the first node.
 
Dnode< T > *& get_last_ne () const noexcept
 Get the last node.
 
Dnode< T > *& get_first () const
 Get the first node.
 
Dnode< T > *& get_last () const
 Get the last node.
 
Dnode< T > * remove_last_ne () noexcept
 Remove the last node and return its address.
 
Dnode< T > * remove_first_ne () noexcept
 Remove the first node and return its address.
 
Dnode< T > * remove_last ()
 Remove the last node and return its address.
 
Dnode< T > * remove_first ()
 Remove the first node and return its address.
 
 Dnode () noexcept
 
 Dnode (const T &item)
 Construct a node with a copy of item
 
 Dnode (T &&item)
 Construct a new node with the item moved.
 
Dnodeswap (Dnode &p)
 Swap this with p
 
 Dnode (const Dnode &node)
 Copy constructor.
 
 Dnode (Dnode &&node) noexcept
 Move constructor.
 
Dnodeoperator= (const Dnode &p)
 Copy assigment.
 
Dnodeoperator= (Dnode &&p)
 Move asignment.
 
Tget_data () noexcept
 Return a modifiable reference to the data contained in the node.
 
const Tget_data () const noexcept
 Return a modifiable reference to the data contained in the node.
 
Tget_key () noexcept
 
const Tget_key () const noexcept
 

Static Public Member Functions

static Dnodedata_to_node (T &data) noexcept
 Given an reference to the data in the node, returns a pointer to the Dnode object that contains it.
 

Private Attributes

T data
 

Additional Inherited Members

Detailed Description

template<typename T>
class Aleph::Dnode< T >

Node belonging to a double circular linked list with header node.

See also
Dnode::Iterator

Definition at line 105 of file tpl_dnode.H.

Member Typedef Documentation

◆ key_type

template<typename T >
using Aleph::Dnode< T >::key_type = T

The data type.

Definition at line 238 of file tpl_dnode.H.

Constructor & Destructor Documentation

◆ Dnode() [1/5]

template<typename T >
Aleph::Dnode< T >::Dnode ( )
inlinenoexcept

Definition at line 171 of file tpl_dnode.H.

◆ Dnode() [2/5]

template<typename T >
Aleph::Dnode< T >::Dnode ( const T item)
inline

Construct a node with a copy of item

Definition at line 178 of file tpl_dnode.H.

◆ Dnode() [3/5]

template<typename T >
Aleph::Dnode< T >::Dnode ( T &&  item)
inline

Construct a new node with the item moved.

Definition at line 185 of file tpl_dnode.H.

◆ Dnode() [4/5]

template<typename T >
Aleph::Dnode< T >::Dnode ( const Dnode< T > &  node)
inline

Copy constructor.

Definition at line 201 of file tpl_dnode.H.

◆ Dnode() [5/5]

template<typename T >
Aleph::Dnode< T >::Dnode ( Dnode< T > &&  node)
inlinenoexcept

Move constructor.

Definition at line 209 of file tpl_dnode.H.

Member Function Documentation

◆ data_to_node()

template<typename T >
static Dnode * Aleph::Dnode< T >::data_to_node ( T data)
inlinestaticnoexcept

Given an reference to the data in the node, returns a pointer to the Dnode object that contains it.

Definition at line 248 of file tpl_dnode.H.

References Aleph::Dnode< T >::data, Aleph::maps(), and offset.

Referenced by Aleph::DynDlist< T >::remove().

◆ get_data() [1/2]

template<typename T >
const T & Aleph::Dnode< T >::get_data ( ) const
inlinenoexcept

Return a modifiable reference to the data contained in the node.

Definition at line 235 of file tpl_dnode.H.

References Aleph::Dnode< T >::data.

◆ get_data() [2/2]

template<typename T >
Aleph::Dnode< T >::get_data ( )
inlinenoexcept

Return a modifiable reference to the data contained in the node.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 232 of file tpl_dnode.H.

References Aleph::Dnode< T >::data.

Referenced by Aleph::DynDlist< T >::Iterator::del(), Aleph::random_search(), Aleph::DynDlist< T >::remove_first_ne(), and Aleph::DynDlist< T >::remove_last_ne().

◆ get_first()

template<typename T >
Dnode< T > *& Aleph::Dnode< T >::get_first ( ) const
inline

Get the first node.

Definition at line 132 of file tpl_dnode.H.

References ah_underflow_error_if, Aleph::Dnode< T >::get_first_ne(), and Aleph::Dlink::is_empty().

◆ get_first_ne()

template<typename T >
Dnode< T > *& Aleph::Dnode< T >::get_first_ne ( ) const
inlinenoexcept

Get the first node.

Definition at line 126 of file tpl_dnode.H.

References Aleph::Dnode< T >::get_next().

Referenced by Aleph::Dnode< T >::get_first().

◆ get_key() [1/2]

template<typename T >
const T & Aleph::Dnode< T >::get_key ( ) const
inlinenoexcept

Definition at line 244 of file tpl_dnode.H.

References Aleph::Dnode< T >::data.

◆ get_key() [2/2]

◆ get_last()

template<typename T >
Dnode< T > *& Aleph::Dnode< T >::get_last ( ) const
inline

Get the last node.

Definition at line 139 of file tpl_dnode.H.

References ah_underflow_error_if, Aleph::Dnode< T >::get_last_ne(), and Aleph::Dlink::is_empty().

◆ get_last_ne()

template<typename T >
Dnode< T > *& Aleph::Dnode< T >::get_last_ne ( ) const
inlinenoexcept

Get the last node.

Definition at line 129 of file tpl_dnode.H.

References Aleph::Dnode< T >::get_prev().

Referenced by Aleph::Dnode< T >::get_last().

◆ get_next()

template<typename T >
Dnode< T > *& Aleph::Dnode< T >::get_next ( ) const
inlinenoexcept

Return the next node to this

Definition at line 114 of file tpl_dnode.H.

References Aleph::Dlink::next.

Referenced by Aleph::Dnode< T >::get_first_ne(), and Aleph::DynDlist< T >::get_first_ne().

◆ get_prev()

template<typename T >
Dnode< T > *& Aleph::Dnode< T >::get_prev ( ) const
inlinenoexcept

Return the previous node to this

Definition at line 117 of file tpl_dnode.H.

References Aleph::Dlink::prev.

Referenced by Aleph::Dnode< T >::get_last_ne(), and Aleph::DynDlist< T >::get_last_ne().

◆ operator=() [1/2]

template<typename T >
Dnode & Aleph::Dnode< T >::operator= ( const Dnode< T > &  p)
inline

Copy assigment.

Definition at line 216 of file tpl_dnode.H.

References Aleph::Dnode< T >::data.

◆ operator=() [2/2]

template<typename T >
Dnode & Aleph::Dnode< T >::operator= ( Dnode< T > &&  p)
inline

Move asignment.

Definition at line 225 of file tpl_dnode.H.

References Aleph::Dnode< T >::data.

◆ remove_first()

template<typename T >
Dnode< T > * Aleph::Dnode< T >::remove_first ( )
inline

Remove the first node and return its address.

Definition at line 165 of file tpl_dnode.H.

References ah_underflow_error_if, Aleph::Dlink::is_empty(), and Aleph::Dnode< T >::remove_first_ne().

◆ remove_first_ne()

template<typename T >
Dnode< T > * Aleph::Dnode< T >::remove_first_ne ( )
inlinenoexcept

Remove the first node and return its address.

Definition at line 152 of file tpl_dnode.H.

References Aleph::Dlink::remove_next().

Referenced by Aleph::Dnode< T >::remove_first().

◆ remove_last()

template<typename T >
Dnode< T > * Aleph::Dnode< T >::remove_last ( )
inline

Remove the last node and return its address.

Definition at line 158 of file tpl_dnode.H.

References ah_underflow_error_if, Aleph::Dlink::is_empty(), and Aleph::Dnode< T >::remove_last_ne().

◆ remove_last_ne()

template<typename T >
Dnode< T > * Aleph::Dnode< T >::remove_last_ne ( )
inlinenoexcept

Remove the last node and return its address.

Definition at line 146 of file tpl_dnode.H.

References Aleph::Dlink::remove_prev().

Referenced by Aleph::Dnode< T >::remove_last().

◆ remove_next()

template<typename T >
Dnode< T > * Aleph::Dnode< T >::remove_next ( )
inlinenoexcept

Remove the next node to this; return its address.

Definition at line 123 of file tpl_dnode.H.

References Aleph::Dlink::remove_next().

Referenced by Aleph::DynDlist< T >::empty(), and Aleph::DynDlist< T >::remove_first_ne().

◆ remove_prev()

template<typename T >
Dnode< T > * Aleph::Dnode< T >::remove_prev ( )
inlinenoexcept

Remove the previous node to this; return its address.

Definition at line 120 of file tpl_dnode.H.

References Aleph::Dlink::remove_prev().

Referenced by Aleph::DynDlist< T >::remove_last_ne().

◆ swap()

template<typename T >
Dnode & Aleph::Dnode< T >::swap ( Dnode< T > &  p)
inline

Swap this with p

Definition at line 192 of file tpl_dnode.H.

References Aleph::Dnode< T >::data, and Aleph::Dlink::swap().

Member Data Documentation

◆ data


The documentation for this class was generated from the following files: