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

Inorder iterator yielding Interval<T> keys. More...

#include <tpl_interval_tree.H>

Public Member Functions

 Iterator () noexcept=default
 Default constructor.
 
 Iterator (const DynIntervalTree &t)
 Construct for a given tree.
 
bool has_curr () const noexcept
 Check if there is a current element.
 
const Keyget_curr () const
 Return the current interval.
 
const Keyget_curr_ne () const noexcept
 Return the current interval (no check).
 
void next ()
 Advance to the next element.
 
void next_ne () noexcept
 Advance to the next element (no check).
 
void prev ()
 Go back to the previous element.
 
void reset_first () noexcept
 Reset to the first element in traversal order.
 
void end () noexcept
 Move to the position after the last element.
 
size_t get_pos () const
 Return the 0-indexed current position.
 

Private Attributes

Tree::Iterator it
 

Detailed Description

template<typename T, class Compare = Aleph::less<T>>
class Aleph::DynIntervalTree< T, Compare >::Iterator

Inorder iterator yielding Interval<T> keys.

Satisfies the Aleph iterator protocol (has_curr/get_curr/next).

Definition at line 1410 of file tpl_interval_tree.H.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<typename T , class Compare = Aleph::less<T>>
Aleph::DynIntervalTree< T, Compare >::Iterator::Iterator ( )
defaultnoexcept

Default constructor.

◆ Iterator() [2/2]

template<typename T , class Compare = Aleph::less<T>>
Aleph::DynIntervalTree< T, Compare >::Iterator::Iterator ( const DynIntervalTree t)
inline

Construct for a given tree.

Parameters
[in]ttree to iterate over.

Definition at line 1421 of file tpl_interval_tree.H.

Member Function Documentation

◆ end()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::end ( )
inlinenoexcept

Move to the position after the last element.

Exceptions
none

Definition at line 1469 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::end(), and Aleph::DynIntervalTree< T, Compare >::Iterator::it.

◆ get_curr()

template<typename T , class Compare = Aleph::less<T>>
const Key & Aleph::DynIntervalTree< T, Compare >::Iterator::get_curr ( ) const
inline

Return the current interval.

Returns
constant reference to interval.
Exceptions
ah_invalid_argumentif no current element exists.

Definition at line 1432 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::get_curr(), Aleph::DynIntervalTree< T, Compare >::Iterator::it, and KEY.

◆ get_curr_ne()

template<typename T , class Compare = Aleph::less<T>>
const Key & Aleph::DynIntervalTree< T, Compare >::Iterator::get_curr_ne ( ) const
inlinenoexcept

Return the current interval (no check).

Returns
constant reference to interval.
Exceptions
none

Definition at line 1441 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::get_curr_ne(), Aleph::DynIntervalTree< T, Compare >::Iterator::it, and KEY.

◆ get_pos()

template<typename T , class Compare = Aleph::less<T>>
size_t Aleph::DynIntervalTree< T, Compare >::Iterator::get_pos ( ) const
inline

Return the 0-indexed current position.

Returns
index of current element.
Exceptions
ah_invalid_argumentif no current element.

Definition at line 1475 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::get_pos(), and Aleph::DynIntervalTree< T, Compare >::Iterator::it.

◆ has_curr()

template<typename T , class Compare = Aleph::less<T>>
bool Aleph::DynIntervalTree< T, Compare >::Iterator::has_curr ( ) const
inlinenoexcept

Check if there is a current element.

Returns
true if valid current element exists.

Definition at line 1426 of file tpl_interval_tree.H.

References Aleph::BinNodeInfixIterator< Node >::has_curr(), and Aleph::DynIntervalTree< T, Compare >::Iterator::it.

◆ next()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::next ( )
inline

Advance to the next element.

Exceptions
ah_invalid_argumentif already at end.

Definition at line 1449 of file tpl_interval_tree.H.

References Aleph::DynIntervalTree< T, Compare >::Iterator::it, and Aleph::BinNodeInfixIterator< Node >::next().

◆ next_ne()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::next_ne ( )
inlinenoexcept

Advance to the next element (no check).

Exceptions
none

Definition at line 1454 of file tpl_interval_tree.H.

References Aleph::DynIntervalTree< T, Compare >::Iterator::it, and Aleph::BinNodeInfixIterator< Node >::next_ne().

◆ prev()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::prev ( )
inline

Go back to the previous element.

Exceptions
ah_invalid_argumentif already at the beginning.

Definition at line 1459 of file tpl_interval_tree.H.

References Aleph::DynIntervalTree< T, Compare >::Iterator::it.

◆ reset_first()

template<typename T , class Compare = Aleph::less<T>>
void Aleph::DynIntervalTree< T, Compare >::Iterator::reset_first ( )
inlinenoexcept

Reset to the first element in traversal order.

Exceptions
none

Definition at line 1464 of file tpl_interval_tree.H.

References Aleph::DynIntervalTree< T, Compare >::Iterator::it, and Aleph::BinNodeInfixIterator< Node >::reset_first().

Member Data Documentation

◆ it


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