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

Iterator on nodes and arcs of a path. More...

#include <tpl_graph.H>

Inheritance diagram for Aleph::Path< GT >::Iterator:
[legend]
Collaboration diagram for Aleph::Path< GT >::Iterator:
[legend]

Public Member Functions

 Iterator (const Path &path) noexcept
 Create an iterator on the first node of path
 
Nodeget_current_node () const
 Return the current node of a path.
 
Nodeget_current_node_ne () const noexcept
 
Arcget_current_arc () const
 Return the current arc of a path.
 
Arcget_current_arc_ne () const noexcept
 
Nodeget_curr_ne () const noexcept
 
Nodeget_curr () const
 
std::pair< Node *, Arc * > get_pair () const
 Return a pair with the current node and arc.
 
std::tuple< Node *, Arc * > get_tuple () const
 Return a tuple with the current node and arc.
 
std::tuple< Node *, Arc * > get_tuple_ne () const noexcept
 
bool has_current_arc () const noexcept
 Return true if iterator has current arc.
 
bool has_current_node () const noexcept
 Return true if the iterator has a current node.
 
- Public Member Functions inherited from Aleph::DynDlist< T >::Iterator
long get_pos () const noexcept
 Return the ordinal position of current item.
 
void next_ne () noexcept
 Move the iterator one position forward guaranteeing no exception.
 
void next ()
 Move the iterator one item forward.
 
void prev ()
 Move the iterator one item backward.
 
void reset_first () noexcept
 Reset the iterator to the first item.
 
void reset_last () noexcept
 Reset the iterator to the last item.
 
void end () noexcept
 Put the iterator at the end state (where there is no current item)
 
 Iterator (const DynDlist< T > &list) noexcept
 Initialize the iterator to the first item of list
 
 Iterator () noexcept
 
Iteratoroperator= (const Iterator &it) noexcept
 
Tget_curr () const
 Return the current item; throw overflow_error if there is no current item.
 
Tget_curr_ne () const noexcept
 
void insert (const T &item)
 Insert by copy an item after the current item.
 
void insert (T &&item)
 Insert by movement an item after the current item.
 
void append (const T &item)
 Append by copy an item before the current item.
 
void append (T &&item)
 Append by movement an item after the current item.
 
void insert_list (DynDlist &list)
 Move and insert all elements of list after the current item of iterator.
 
void append_list (DynDlist &list)
 Move and append all elements of list before the current item of iterator.
 
T del ()
 Remove from the list the current node and move the iterator one position forward.
 
- Public Member Functions inherited from Aleph::Dnode< T >::Iterator
Dnode< T > * get_curr_ne () const noexcept
 Return the current link guaranteeing no exception. Be careful.
 
Dnode< T > * get_curr () const
 Return a pointer to the current node.
 
Dnodedel ()
 Remove the current node of the list a return a pointer to the removed node.
 
Dnodedel_ne () noexcept
 Same as del() but without exception check.
 

Private Member Functions

Path_Descget_curr_path_desc_ne () const noexcept
 
Path_Descget_curr_path_desc () const
 

Additional Inherited Members

- Public Types inherited from Aleph::DynDlist< T >::Iterator
using Set_Type = DynDlist
 The type of container.
 
using Item_Type = T
 The type of element stored in the container.
 
- Public Types inherited from Aleph::Dnode< T >::Iterator
using Set_Type = Dnode< T >
 The type of set.
 
using Item_Type = Dnode< T > *
 The type of element of set.
 
using Base = Dlink::Iterator
 

Detailed Description

template<class GT>
class Aleph::Path< GT >::Iterator

Iterator on nodes and arcs of a path.

See also
Path

Definition at line 3200 of file tpl_graph.H.

Constructor & Destructor Documentation

◆ Iterator()

template<class GT >
Aleph::Path< GT >::Iterator::Iterator ( const Path path)
inlinenoexcept

Create an iterator on the first node of path

Definition at line 3204 of file tpl_graph.H.

Member Function Documentation

◆ get_curr()

template<class GT >
Node * Aleph::Path< GT >::Iterator::get_curr ( ) const
inline

Definition at line 3260 of file tpl_graph.H.

References Aleph::Path< GT >::Iterator::get_current_node().

◆ get_curr_ne()

template<class GT >
Node * Aleph::Path< GT >::Iterator::get_curr_ne ( ) const
inlinenoexcept

Definition at line 3255 of file tpl_graph.H.

References Aleph::Path< GT >::Iterator::get_current_node_ne().

◆ get_curr_path_desc()

template<class GT >
Path_Desc & Aleph::Path< GT >::Iterator::get_curr_path_desc ( ) const
inlineprivate

◆ get_curr_path_desc_ne()

template<class GT >
Path_Desc & Aleph::Path< GT >::Iterator::get_curr_path_desc_ne ( ) const
inlineprivatenoexcept

◆ get_current_arc()

template<class GT >
Arc * Aleph::Path< GT >::Iterator::get_current_arc ( ) const
inline

Return the current arc of a path.

Note
A path of n nodes has n - 1 arcs. So if the iterator is positioned on the last node, the get_current_arc() has no current arc and will throw an exception.
Returns
pointer to the current arc
Exceptions
overflow_errorif path is empty of iterator has not current node

Definition at line 3242 of file tpl_graph.H.

References ah_overflow_error_if, Aleph::Path< GT >::Path_Desc::arc, Aleph::Path< GT >::Iterator::get_curr_path_desc(), and Aleph::Dlink::Iterator::is_in_last().

Referenced by Aleph::Path< GT >::Iterator::get_pair(), and Aleph::Path< GT >::Iterator::get_tuple().

◆ get_current_arc_ne()

template<class GT >
Arc * Aleph::Path< GT >::Iterator::get_current_arc_ne ( ) const
inlinenoexcept

◆ get_current_node()

template<class GT >
Aleph::Path< GT >::Iterator::get_current_node ( ) const
inline

Return the current node of a path.

Throw overflow_error if path is empty of the iterator has not current 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 3222 of file tpl_graph.H.

References Aleph::Path< GT >::Iterator::get_curr_path_desc(), and Aleph::Path< GT >::Path_Desc::node.

Referenced by Aleph::Path< GT >::Iterator::get_curr(), Aleph::Path< GT >::Iterator::get_pair(), Aleph::Path< GT >::Iterator::get_tuple(), TYPED_TEST(), and TYPED_TEST().

◆ get_current_node_ne()

template<class GT >
Node * Aleph::Path< GT >::Iterator::get_current_node_ne ( ) const
inlinenoexcept

◆ get_pair()

template<class GT >
std::pair< Node *, Arc * > Aleph::Path< GT >::Iterator::get_pair ( ) const
inline

Return a pair with the current node and arc.

Note
If the iterator is positioned on the last node, then its arc is nullptr.
Returns
a pair whose first element is the current node and the second element its outcoming arc
Exceptions
overflow_errorif path is empty of iterator has not current node

Definition at line 3275 of file tpl_graph.H.

References Aleph::Path< GT >::Iterator::get_current_arc(), and Aleph::Path< GT >::Iterator::get_current_node().

◆ get_tuple()

template<class GT >
std::tuple< Node *, Arc * > Aleph::Path< GT >::Iterator::get_tuple ( ) const
inline

Return a tuple with the current node and arc.

Note
If the iterator is positioned on the last node, then its arc is nullptr.
Returns
a tuple whose first element is the current node and the second element its outcoming arc
Exceptions
overflow_errorif path is empty of iterator has not current node

Definition at line 3290 of file tpl_graph.H.

References Aleph::Path< GT >::Iterator::get_current_arc(), and Aleph::Path< GT >::Iterator::get_current_node().

◆ get_tuple_ne()

template<class GT >
std::tuple< Node *, Arc * > Aleph::Path< GT >::Iterator::get_tuple_ne ( ) const
inlinenoexcept

◆ has_current_arc()

template<class GT >
bool Aleph::Path< GT >::Iterator::has_current_arc ( ) const
inlinenoexcept

Return true if iterator has current arc.

Note
If the iterator is on the last node, then there is no current arc.
Returns
a boolean indicating if the iterator is positioned on an arc

Definition at line 3308 of file tpl_graph.H.

References Aleph::Dlink::Iterator::has_curr(), Aleph::Dlink::Iterator::is_in_last(), and Aleph::maps().

Referenced by Aleph::Path< GT >::contains_arc(), Aleph::Path< GT >::for_each_arc(), and Aleph::increase_flow().

◆ has_current_node()

template<class GT >
bool Aleph::Path< GT >::Iterator::has_current_node ( ) const
inlinenoexcept

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