Aleph-w 7.10.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
 
Node * get_current_node () const
 Return the current node of a path.
 
Node * get_current_node_ne () const noexcept
 
Arc * get_current_arc () const
 Return the current arc of a path.
 
Arc * get_current_arc_ne () const noexcept
 
Node * get_curr_ne () const noexcept
 Return the current node, which must exist.
 
Node * get_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::Const_Iterator< It >
 Const_Iterator ()=default
 A view with no current item.
 
template<class C >
requires (not std::same_as<std::remove_cvref_t<C>, Const_Iterator> and not std::same_as<std::remove_cvref_t<C>, It>)
 Const_Iterator (const C &c)
 View positioned on the first item of the container c.
 
 Const_Iterator (It underlying) noexcept(std::is_nothrow_move_constructible_v< It >)
 Read-only view over an existing iterator.
 
template<class I = It>
auto has_curr () const noexcept(noexcept(std::declval< I & >().has_curr())) -> decltype(std::declval< I & >().has_curr())
 true if there is a current item.
 
template<class I = It>
auto get_curr () const noexcept(noexcept(std::declval< I & >().get_curr())) -> const_iterator_detail::const_item_t< decltype(std::declval< I & >().get_curr())>
 The current item, read-only.
 
template<class I = It>
auto get_curr_ne () const noexcept(noexcept(std::declval< I & >().get_curr_ne())) -> const_iterator_detail::const_item_t< decltype(std::declval< I & >().get_curr_ne())>
 get_curr() without the checks of the underlying iterator.
 
template<class I = It>
auto next () noexcept(noexcept(std::declval< I & >().next())) -> decltype(std::declval< I & >().next())
 Move to the next item; what the underlying iterator throws.
 
template<class I = It>
auto next_ne () noexcept(noexcept(std::declval< I & >().next_ne())) -> decltype(std::declval< I & >().next_ne())
 next() without checks.
 
template<class I = It>
auto prev () noexcept(noexcept(std::declval< I & >().prev())) -> decltype(std::declval< I & >().prev())
 Move to the previous item; what the underlying iterator throws.
 
template<class I = It>
auto prev_ne () noexcept(noexcept(std::declval< I & >().prev_ne())) -> decltype(std::declval< I & >().prev_ne())
 prev() without checks.
 
template<class I = It>
auto reset_first () noexcept(noexcept(std::declval< I & >().reset_first())) -> decltype(std::declval< I & >().reset_first())
 Position the view on the first item.
 
template<class I = It>
auto reset_last () noexcept(noexcept(std::declval< I & >().reset_last())) -> decltype(std::declval< I & >().reset_last())
 Position the view on the last item.
 
template<class I = It>
auto reset () noexcept(noexcept(std::declval< I & >().reset())) -> decltype(std::declval< I & >().reset())
 Position the view on the first item.
 
template<class I = It>
auto end () noexcept(noexcept(std::declval< I & >().end())) -> decltype(std::declval< I & >().end())
 Position the view past the last item.
 
template<class I = It>
auto get_pos () const noexcept(noexcept(std::declval< I & >().get_pos())) -> decltype(std::declval< I & >().get_pos())
 Ordinal position of the current item.
 
template<class I = It>
auto set_pos (const long pos) noexcept(noexcept(std::declval< I & >().set_pos(pos))) -> decltype(std::declval< I & >().set_pos(pos))
 Position the view on the item at ordinal position pos.
 
template<class I = It>
auto is_last () const noexcept(noexcept(std::declval< I & >().is_last())) -> decltype(std::declval< I & >().is_last())
 true if the current item is the last one.
 
template<class I = It>
auto is_in_first () const noexcept(noexcept(std::declval< I & >().is_in_first())) -> decltype(std::declval< I & >().is_in_first())
 true if the current item is the first one.
 
template<class I = It>
auto is_in_last () const noexcept(noexcept(std::declval< I & >().is_in_last())) -> decltype(std::declval< I & >().is_in_last())
 true if the current item is the last one.
 
void swap (Const_Iterator &other) noexcept(std::is_nothrow_swappable_v< It >)
 Exchange the views.
 
template<class I = It>
auto operator== (const Const_Iterator &other) const -> decltype(std::declval< I & >()==std::declval< I & >())
 Equality of the underlying iterators, when they have it.
 
template<class I = It>
auto operator!= (const Const_Iterator &other) const -> decltype(not(std::declval< I & >()==std::declval< I & >()))
 Negation of ==.
 

Private Types

using Base = Aleph::const_iterator_t< DynDlist< Path_Desc > >
 

Private Member Functions

const Path_Desc & get_curr_path_desc_ne () const noexcept
 
const Path_Desc & get_curr_path_desc () const
 

Additional Inherited Members

- Public Types inherited from Aleph::Const_Iterator< It >
using Itor = It
 The underlying iterator.
 
using aleph_random_access_iterator = std::conditional_t< AlephRandomAccessItor< It >, Const_Iterator, void >
 Random access when the underlying iterator opts in; see AlephRandomAccessItor.
 
- Protected Member Functions inherited from Aleph::Const_Iterator< It >
It & underlying () const noexcept
 The underlying iterator, for the views that extend the reading protocol with members of their own (the read-only iterators of the graphs do it with get_src_node() and get_tgt_node()).
 

Detailed Description

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

Iterator on nodes and arcs of a path.

See also
Path

Definition at line 4394 of file tpl_graph.H.

Member Typedef Documentation

◆ Base

template<class GT >
using Aleph::Path< GT >::Iterator::Base = Aleph::const_iterator_t<DynDlist<Path_Desc> >
private

Definition at line 4398 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 4402 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 4458 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

Return the current node, which must exist.

Definition at line 4453 of file tpl_graph.H.

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

◆ get_curr_path_desc()

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

◆ get_curr_path_desc_ne()

template<class GT >
const 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 4440 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::Const_Iterator< It >::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 >
Node * 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

Definition at line 4420 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 4473 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 4488 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 4506 of file tpl_graph.H.

References Aleph::and, Aleph::Const_Iterator< It >::has_curr(), and Aleph::Const_Iterator< It >::is_in_last().

Referenced by Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::get_min_path(), Aleph::increase_flow(), and TYPED_TEST().

◆ has_current_node()

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

Return true if the iterator has a current node.

Definition at line 4512 of file tpl_graph.H.

References Aleph::Const_Iterator< It >::has_curr().

Referenced by Aleph::k_shortest_paths_detail::path_to_state(), TEST(), TEST(), and TEST_F().


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