Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Dlink::Iterator Class Reference

Iterator on Dlink lists. More...

#include <dlink.H>

Inheritance diagram for Aleph::Dlink::Iterator:
[legend]
Collaboration diagram for Aleph::Dlink::Iterator:
[legend]

Public Types

using Set_Type = Dlink
 The set type.
 
using Item_Type = Dlink *
 The type of elements of container.
 

Public Member Functions

 Iterator (Dlink *head_ptr) noexcept
 Initialize an iterator on the first item of the list pointed by head_ptr.
 
 Iterator (const Dlink &list) noexcept
 Initialize an iterator on the first item of list.
 
void set (Dlink *new_curr) noexcept
 Set the current node .
 
 Iterator () noexcept
 
void reset_first () noexcept
 Reset the iterator to the first item of list.
 
void reset_last () noexcept
 Reset the iterator to the last item of list.
 
void end () noexcept
 Put the iterator out of range.
 
bool has_curr () const noexcept
 Return true if the iterator has current item.
 
bool is_last () const noexcept
 
Dlinkget_curr_ne () const noexcept
 Return the current link guaranteeing no exception. Be careful.
 
Dlinkget_curr () const
 Return the current node of iterator.
 
constexpr bool is_in_first () const noexcept
 Return true if the iterator is positiones on the first item.
 
bool is_in_last () const noexcept
 Return true if the iterator is positiones on the last item.
 
void prev_ne () noexcept
 Move the iterator one position backward guaranteeing no exception.
 
void prev ()
 Move the iterator one position backward.
 
void next_ne () noexcept
 Move the iterator one position backward guaranteeing no exception.
 
void next ()
 Move the iterator one position forward.
 
constexpr bool operator== (const Iterator &it) const noexcept
 Return true if this and it are positioned on the same item.
 
constexpr bool operator!= (const Iterator &it) const noexcept
 Return true if this and it hace different states.
 
Dlinkdel ()
 Remove from the list the current node and move the iterator one position forward.
 
Dlinkdel_ne () noexcept
 
constexpr bool verify (Dlink *l) const noexcept
 Return true if the iterator is on the list pointed by l
 
constexpr bool verify (const Iterator &it) const noexcept
 Return true if this and it are on the same list.
 

Private Attributes

Dlinkhead = nullptr
 
Dlinkcurr = nullptr
 

Detailed Description

Iterator on Dlink lists.

Definition at line 646 of file dlink.H.

Member Typedef Documentation

◆ Item_Type

The type of elements of container.

Definition at line 659 of file dlink.H.

◆ Set_Type

The set type.

Definition at line 656 of file dlink.H.

Constructor & Destructor Documentation

◆ Iterator() [1/3]

Aleph::Dlink::Iterator::Iterator ( Dlink head_ptr)
inlinenoexcept

Initialize an iterator on the first item of the list pointed by head_ptr.

Parameters
[in]head_ptrpointer to the list (hedaer node)

Definition at line 666 of file dlink.H.

◆ Iterator() [2/3]

Aleph::Dlink::Iterator::Iterator ( const Dlink list)
inlinenoexcept

Initialize an iterator on the first item of list.

Parameters
[in]listreference to the list

Definition at line 673 of file dlink.H.

◆ Iterator() [3/3]

Aleph::Dlink::Iterator::Iterator ( )
inlinenoexcept

Definition at line 692 of file dlink.H.

Member Function Documentation

◆ del()

Dlink * Aleph::Dlink::Iterator::del ( )
inline

Remove from the list the current node and move the iterator one position forward.

Returns
a pointer to removed item

Definition at line 795 of file dlink.H.

References curr, Aleph::Dlink::del(), get_curr(), has_curr(), head, Aleph::maps(), and next().

Referenced by Aleph::Dnode< T >::Iterator::del(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::Iterator::del(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ del_ne()

Dlink * Aleph::Dlink::Iterator::del_ne ( )
inlinenoexcept

◆ end()

void Aleph::Dlink::Iterator::end ( )
inlinenoexcept

Put the iterator out of range.

Definition at line 709 of file dlink.H.

References put_itor_at_the_end().

◆ get_curr()

◆ get_curr_ne()

◆ has_curr()

bool Aleph::Dlink::Iterator::has_curr ( ) const
inlinenoexcept

Return true if the iterator has current item.

Definition at line 715 of file dlink.H.

References curr, head, and Aleph::maps().

Referenced by Aleph::DynDlist< T >::DynDlist(), Aleph::DynDlist< T >::Iterator::append(), Aleph::DynDlist< T >::Iterator::append(), Aleph::DynDlist< T >::Iterator::append_list(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::build_path(), Eepic_Plane::compute_extreme_points(), Aleph::compute_maximum_cardinality_bipartite_matching(), Aleph::compute_min_cut(), Polygon::copy_points(), del(), Aleph::DynDlist< T >::Iterator::del(), del_ne(), demo_any_path(), demo_degrees_of_separation(), Eepic_Plane::draw(), Aleph::edge_connectivity(), Aleph::Karger_Min_Cut< GT, SA >::fast(), Aleph::generate_dot_file(), get_curr(), Polygon::Segment_Iterator::has_curr(), Aleph::Path< GT >::Iterator::has_current_arc(), Aleph::Path< GT >::Iterator::has_current_node(), Aleph::DynDlist< T >::Iterator::insert(), Aleph::DynDlist< T >::Iterator::insert(), Aleph::DynDlist< T >::Iterator::insert_list(), Aleph::insert_sorted(), Aleph::Karger_Min_Cut< GT, SA >::karger_min_cut(), Aleph::Compute_Cut_Nodes< GT, SA >::map_cut_graph(), Polinomio::multiplicado_por(), next(), Aleph::DynDlist< T >::operator=(), Aleph::Compute_Cut_Nodes< GT, SA >::paint_subgraphs(), prev(), Polinomio::print(), print_grid_with_path(), process_tag_node(), Aleph::Karger_Min_Cut< GT, SA >::rebuild_arc_index(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Aleph::Karger_Min_Cut< GT, SA >::update_arcs(), and Aleph::vertex_connectivity().

◆ is_in_first()

constexpr bool Aleph::Dlink::Iterator::is_in_first ( ) const
inlineconstexprnoexcept

Return true if the iterator is positiones on the first item.

Definition at line 746 of file dlink.H.

References curr, head, Aleph::Dlink::is_empty(), Aleph::maps(), and Aleph::Dlink::next.

Referenced by TEST(), TEST(), TEST_F(), and TEST_F().

◆ is_in_last()

bool Aleph::Dlink::Iterator::is_in_last ( ) const
inlinenoexcept

Return true if the iterator is positiones on the last item.

Definition at line 752 of file dlink.H.

References is_last().

Referenced by Aleph::Path< GT >::Iterator::get_current_arc(), Aleph::Path< GT >::Iterator::has_current_arc(), and TEST_F().

◆ is_last()

bool Aleph::Dlink::Iterator::is_last ( ) const
inlinenoexcept

Definition at line 721 of file dlink.H.

References curr, head, Aleph::Dlink::is_empty(), Aleph::maps(), and Aleph::Dlink::prev.

Referenced by is_in_last(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ next()

void Aleph::Dlink::Iterator::next ( )
inline

◆ next_ne()

void Aleph::Dlink::Iterator::next_ne ( )
inlinenoexcept

Move the iterator one position backward guaranteeing no exception.

Be careful.

Definition at line 770 of file dlink.H.

References curr, and Aleph::Dlink::get_next().

Referenced by del_ne(), Aleph::insert_sorted(), next(), Aleph::DynDlist< T >::Iterator::next_ne(), and Aleph::GenLinearHashTable< Key, BucketType, Cmp >::Iterator::next_ne().

◆ operator!=()

constexpr bool Aleph::Dlink::Iterator::operator!= ( const Iterator it) const
inlineconstexprnoexcept

Return true if this and it hace different states.

Definition at line 787 of file dlink.H.

References curr.

◆ operator==()

constexpr bool Aleph::Dlink::Iterator::operator== ( const Iterator it) const
inlineconstexprnoexcept

Return true if this and it are positioned on the same item.

Definition at line 783 of file dlink.H.

References curr.

◆ prev()

void Aleph::Dlink::Iterator::prev ( )
inline

Move the iterator one position backward.

Exceptions
underflow_errorif there is no current item

Definition at line 762 of file dlink.H.

References ah_underflow_error_if, has_curr(), Aleph::maps(), and prev_ne().

Referenced by Aleph::DynDlist< T >::Iterator::prev(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::Iterator::prev(), TEST_F(), TEST_F(), and TEST_F().

◆ prev_ne()

void Aleph::Dlink::Iterator::prev_ne ( )
inlinenoexcept

Move the iterator one position backward guaranteeing no exception.

Be careful.

Definition at line 756 of file dlink.H.

References curr, and Aleph::Dlink::get_prev().

Referenced by prev().

◆ reset_first()

void Aleph::Dlink::Iterator::reset_first ( )
inlinenoexcept

Reset the iterator to the first item of list.

Definition at line 695 of file dlink.H.

References curr, Aleph::Dlink::get_next(), head, and Aleph::maps().

Referenced by Aleph::DynDlist< T >::Iterator::reset_first(), TEST(), and TEST_F().

◆ reset_last()

void Aleph::Dlink::Iterator::reset_last ( )
inlinenoexcept

Reset the iterator to the last item of list.

Definition at line 702 of file dlink.H.

References curr, Aleph::Dlink::get_prev(), head, and Aleph::maps().

Referenced by Aleph::DynDlist< T >::Iterator::reset_last(), TEST(), TEST_F(), and TEST_F().

◆ set()

void Aleph::Dlink::Iterator::set ( Dlink new_curr)
inlinenoexcept

Set the current node .

This method set the current node to new_curr, which of course must be a valid pointer to a item in the list.

Parameters
[in]new_currpointer to the new current item

Definition at line 686 of file dlink.H.

References curr, head, and Aleph::maps().

◆ verify() [1/2]

constexpr bool Aleph::Dlink::Iterator::verify ( const Iterator it) const
inlineconstexprnoexcept

Return true if this and it are on the same list.

Definition at line 821 of file dlink.H.

References head.

◆ verify() [2/2]

constexpr bool Aleph::Dlink::Iterator::verify ( Dlink l) const
inlineconstexprnoexcept

Return true if the iterator is on the list pointed by l

Definition at line 818 of file dlink.H.

References head, and l.

Member Data Documentation

◆ curr

Dlink* Aleph::Dlink::Iterator::curr = nullptr
mutableprivate

◆ head

Dlink* Aleph::Dlink::Iterator::head = nullptr
mutableprivate

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