Aleph-w 7.10.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(std::is_nothrow_default_constructible_v< T >)
 Construct a node, or the header of an empty list, whose item is T(): zero for an arithmetic type or a pointer.
 
 Dnode (const T &item)
 Construct a node with a copy of item
 
 Dnode (T &&item)
 Construct a new node with the item moved.
 
Dnode & swap (Dnode &p)
 Swap this with p
 
 Dnode (const Dnode &node)
 Copy constructor.
 
 Dnode (Dnode &&node) noexcept
 Move constructor: takes the place of node in its list and moves its item, which cannot throw.
 
 Dnode (Dnode &&node)
 Move constructor for an item whose move may throw: moves the item of node and then takes its place in its list.
 
Dnode & operator= (const Dnode &p)
 Copy assigment.
 
Dnode & operator= (Dnode &&p)
 Move asignment.
 
T & get_data () noexcept
 Return a modifiable reference to the data contained in the node.
 
const T & get_data () const noexcept
 Return a modifiable reference to the data contained in the node.
 
T & get_key () noexcept
 See get_data().
 
const T & get_key () const noexcept
 See get_data().
 

Static Public Member Functions

static Dnode * data_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 272 of file tpl_dnode.H.

Constructor & Destructor Documentation

◆ Dnode() [1/6]

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

Construct a node, or the header of an empty list, whose item is T(): zero for an arithmetic type or a pointer.

An item built by default would be indeterminate for those types, and reading it, even to copy it, is undefined behavior.

Exceptions
whatT() throws; nothing when it is noexcept, as for the arithmetic types and std::string.
Note
The noexcept follows T() so that its exception reaches the caller instead of ending the program.

Definition at line 182 of file tpl_dnode.H.

◆ Dnode() [2/6]

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

Construct a node with a copy of item

Definition at line 190 of file tpl_dnode.H.

◆ Dnode() [3/6]

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

Construct a new node with the item moved.

Definition at line 197 of file tpl_dnode.H.

◆ Dnode() [4/6]

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

Copy constructor.

Definition at line 213 of file tpl_dnode.H.

◆ Dnode() [5/6]

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

Move constructor: takes the place of node in its list and moves its item, which cannot throw.

Parameters
[in]nodethe node to move from.

Definition at line 225 of file tpl_dnode.H.

◆ Dnode() [6/6]

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

Move constructor for an item whose move may throw: moves the item of node and then takes its place in its list.

Parameters
[in]nodethe node to move from.
Exceptions
whatthe move constructor of T throws (its copy constructor, if T has no move one). Then node stays in its list and nothing is linked to this.
Note
It is not noexcept, so that the exception reaches the caller instead of ending the program; the links are taken after the item, so that an exception leaves no list pointing to a node that was never built.

Definition at line 243 of file tpl_dnode.H.

References Aleph::Dlink::swap().

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 282 of file tpl_dnode.H.

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

Referenced by Aleph::DynHashTable< Key, HashTable, Cmp >::key_to_bucket(), and 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 269 of file tpl_dnode.H.

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

◆ get_data() [2/2]

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

◆ 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

See get_data().

Definition at line 278 of file tpl_dnode.H.

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

◆ get_key() [2/2]

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

See get_data().

Definition at line 275 of file tpl_dnode.H.

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

◆ 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(), Aleph::DynDlist< 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(), Aleph::DynDlist< 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 250 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 259 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::sort_utils_detail::radix_sort_impl(), and 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 >::delete_end(), and Aleph::DynDlist< T >::empty().

◆ 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 >::delete_end().

◆ swap()

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

Swap this with p

Definition at line 204 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: