aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::AVLTreeIteratorSafe< Val, Cmp > Class Template Reference

AVL binary search tree safe (w.r.t. More...

#include <agrum/base/core/AVLTree.h>

Inheritance diagram for gum::AVLTreeIteratorSafe< Val, Cmp >:
Collaboration diagram for gum::AVLTreeIteratorSafe< Val, Cmp >:

Public Types

using iterator_category = std::bidirectional_iterator_tag
 Types for STL compliance.
using value_type = Val
 Types for STL compliance.
using reference = value_type&
 Types for STL compliance.
using const_reference = const value_type&
 Types for STL compliance.
using pointer = value_type*
 Types for STL compliance.
using const_pointer = const value_type*
 Types for STL compliance.

Public Member Functions

Constructors / Destructors
 AVLTreeIteratorSafe (AVLTree< Val, Cmp > &tree, const bool begin=true)
 constructor for begin safe iterators
 AVLTreeIteratorSafe (const AVLTreeIteratorSafe< Val, Cmp > &from)
 copy constructor
 AVLTreeIteratorSafe (AVLTreeIteratorSafe< Val, Cmp > &&from)
 move constructor
 ~AVLTreeIteratorSafe () noexcept
 destructor
Operators
AVLTreeIteratorSafe< Val, Cmp > & operator= (const AVLTreeIteratorSafe< Val, Cmp > &from)
 copy operator
AVLTreeIteratorSafe< Val, Cmp > & operator= (AVLTreeIteratorSafe< Val, Cmp > &&from)
 move operator
bool operator== (const AVLTreeIteratorSafe< Val, Cmp > &from) const
 indicates whether two iterator point to the same element
bool operator!= (const AVLTreeIteratorSafe< Val, Cmp > &from) const
 indicates whether two iterator point to different element
AVLTreeIteratorSafe< Val, Cmp > & operator++ () noexcept
 move to the next element in the tree
AVLTreeIteratorSafe< Val, Cmp > & operator+= (const Size k) noexcept
 move to the next k elements
AVLTreeIteratorSafe< Val, Cmp > & operator-- () noexcept
 move to the preceding element in the tree
AVLTreeIteratorSafe< Val, Cmp > & operator-= (const Size k) noexcept
 move to the preceding k element

Protected Types

using AVLNode
 the type of the nodes of the tree

Protected Member Functions

AVLNodenextNode_ (AVLNode *node) const noexcept
 computes the node to go to when applying operator++
AVLNodeprecedingNode_ (AVLNode *node) const noexcept
 computes the node to go to when applying operator--
void unregisterTree_ () noexcept
 make the iterator point to nothing
void pointToEndRend_ () noexcept
 force the iterator to point to end/rend
Operators
bool operator== (const AVLTreeIterator< Val, std::less< Val > > &from) const
 indicates whether two iterator point to the same element
bool operator!= (const AVLTreeIterator< Val, std::less< Val > > &from) const
 indicates whether two iterator point to different element
const_reference operator* () const
 returns the element pointed to by the iterator

Protected Attributes

friend AVLTree< Val, Cmp >
 allow AVL trees to access the content of the iterators
AVLTree< Val, std::less< Val > > * tree_
 the tree the iterator points to
AVLNodenode_
 the AVLNode the iterator points to
AVLNodenext_node_
 the next node to go to when applying operator++
AVLNodepreceding_node_
 the preceding node to go to when applying operator--

Detailed Description

template<typename Val, typename Cmp = std::less< Val >>
class gum::AVLTreeIteratorSafe< Val, Cmp >

AVL binary search tree safe (w.r.t.

erasures) iterator

Template Parameters
ValThe type of the elements stored into the tree.
CmpThe function used for sorting the elements. queues.

Definition at line 594 of file AVLTree.h.

Member Typedef Documentation

◆ AVLNode

using gum::AVLTreeIterator< Val, std::less< Val > >::AVLNode
protectedinherited

the type of the nodes of the tree

Definition at line 551 of file AVLTree.h.

◆ const_pointer

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeIteratorSafe< Val, Cmp >::const_pointer = const value_type*

Types for STL compliance.

Definition at line 603 of file AVLTree.h.

◆ const_reference

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeIteratorSafe< Val, Cmp >::const_reference = const value_type&

Types for STL compliance.

Definition at line 601 of file AVLTree.h.

◆ iterator_category

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeIteratorSafe< Val, Cmp >::iterator_category = std::bidirectional_iterator_tag

Types for STL compliance.

Definition at line 598 of file AVLTree.h.

◆ pointer

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeIteratorSafe< Val, Cmp >::pointer = value_type*

Types for STL compliance.

Definition at line 602 of file AVLTree.h.

◆ reference

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeIteratorSafe< Val, Cmp >::reference = value_type&

Types for STL compliance.

Definition at line 600 of file AVLTree.h.

◆ value_type

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeIteratorSafe< Val, Cmp >::value_type = Val

Types for STL compliance.

Definition at line 599 of file AVLTree.h.

Constructor & Destructor Documentation

◆ AVLTreeIteratorSafe() [1/3]

template<typename Val, typename Cmp = std::less< Val >>
gum::AVLTreeIteratorSafe< Val, Cmp >::AVLTreeIteratorSafe ( AVLTree< Val, Cmp > & tree,
const bool begin = true )
explicit

constructor for begin safe iterators

Parameters
treethe AVL tree which parses the iterator
beginif true, the iterator points to the highest value in the tree, else it points to the lowest value

◆ AVLTreeIteratorSafe() [2/3]

template<typename Val, typename Cmp = std::less< Val >>
gum::AVLTreeIteratorSafe< Val, Cmp >::AVLTreeIteratorSafe ( const AVLTreeIteratorSafe< Val, Cmp > & from)

copy constructor

◆ AVLTreeIteratorSafe() [3/3]

template<typename Val, typename Cmp = std::less< Val >>
gum::AVLTreeIteratorSafe< Val, Cmp >::AVLTreeIteratorSafe ( AVLTreeIteratorSafe< Val, Cmp > && from)

move constructor

◆ ~AVLTreeIteratorSafe()

template<typename Val, typename Cmp = std::less< Val >>
gum::AVLTreeIteratorSafe< Val, Cmp >::~AVLTreeIteratorSafe ( )
noexcept

destructor

Member Function Documentation

◆ nextNode_()

AVLNode * gum::AVLTreeIterator< Val, std::less< Val > >::nextNode_ ( AVLNode * node) const
protectednoexceptinherited

computes the node to go to when applying operator++

◆ operator!=() [1/2]

bool gum::AVLTreeIterator< Val, std::less< Val > >::operator!= ( const AVLTreeIterator< Val, std::less< Val > > & from) const
inherited

indicates whether two iterator point to different element

◆ operator!=() [2/2]

template<typename Val, typename Cmp = std::less< Val >>
bool gum::AVLTreeIteratorSafe< Val, Cmp >::operator!= ( const AVLTreeIteratorSafe< Val, Cmp > & from) const

indicates whether two iterator point to different element

◆ operator*()

const_reference gum::AVLTreeIterator< Val, std::less< Val > >::operator* ( ) const
inherited

returns the element pointed to by the iterator

Returns
the element pointed to by the iterator, if the iterator actually points to an element
Exceptions
NotFoundis raised if the iterator does not point to any element

◆ operator++()

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeIteratorSafe< Val, Cmp > & gum::AVLTreeIteratorSafe< Val, Cmp >::operator++ ( )
noexcept

move to the next element in the tree

Warning
Applying this operator to an iterator equal to the end iterator has no effect. In particular, it does not raise any exception.

◆ operator+=()

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeIteratorSafe< Val, Cmp > & gum::AVLTreeIteratorSafe< Val, Cmp >::operator+= ( const Size k)
noexcept

move to the next k elements

Warning
Applying this operator to an iterator equal to the end iterator has no effect. In particular, it does not raise any exception.

◆ operator--()

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeIteratorSafe< Val, Cmp > & gum::AVLTreeIteratorSafe< Val, Cmp >::operator-- ( )
noexcept

move to the preceding element in the tree

Warning
Applying this operator to an iterator equal to the begin iterator has no effect. In particular, it does not raise any exception.

◆ operator-=()

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeIteratorSafe< Val, Cmp > & gum::AVLTreeIteratorSafe< Val, Cmp >::operator-= ( const Size k)
noexcept

move to the preceding k element

Warning
Applying this operator to an iterator equal to the begin iterator has no effect. In particular, it does not raise any exception.

◆ operator=() [1/2]

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeIteratorSafe< Val, Cmp > & gum::AVLTreeIteratorSafe< Val, Cmp >::operator= ( AVLTreeIteratorSafe< Val, Cmp > && from)

move operator

◆ operator=() [2/2]

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeIteratorSafe< Val, Cmp > & gum::AVLTreeIteratorSafe< Val, Cmp >::operator= ( const AVLTreeIteratorSafe< Val, Cmp > & from)

copy operator

◆ operator==() [1/2]

bool gum::AVLTreeIterator< Val, std::less< Val > >::operator== ( const AVLTreeIterator< Val, std::less< Val > > & from) const
inherited

indicates whether two iterator point to the same element

◆ operator==() [2/2]

template<typename Val, typename Cmp = std::less< Val >>
bool gum::AVLTreeIteratorSafe< Val, Cmp >::operator== ( const AVLTreeIteratorSafe< Val, Cmp > & from) const

indicates whether two iterator point to the same element

◆ pointToEndRend_()

void gum::AVLTreeIterator< Val, std::less< Val > >::pointToEndRend_ ( )
protectednoexceptinherited

force the iterator to point to end/rend

◆ precedingNode_()

AVLNode * gum::AVLTreeIterator< Val, std::less< Val > >::precedingNode_ ( AVLNode * node) const
protectednoexceptinherited

computes the node to go to when applying operator--

◆ unregisterTree_()

void gum::AVLTreeIterator< Val, std::less< Val > >::unregisterTree_ ( )
protectednoexceptinherited

make the iterator point to nothing

Member Data Documentation

◆ AVLTree< Val, Cmp >

template<typename Val, typename Cmp = std::less< Val >>
friend gum::AVLTreeIteratorSafe< Val, Cmp >::AVLTree< Val, Cmp >
protected

allow AVL trees to access the content of the iterators

Definition at line 688 of file AVLTree.h.

◆ next_node_

AVLNode* gum::AVLTreeIterator< Val, std::less< Val > >::next_node_
protectedinherited

the next node to go to when applying operator++

Definition at line 560 of file AVLTree.h.

560{nullptr};

◆ node_

AVLNode* gum::AVLTreeIterator< Val, std::less< Val > >::node_
protectedinherited

the AVLNode the iterator points to

Definition at line 557 of file AVLTree.h.

557{nullptr};

◆ preceding_node_

AVLNode* gum::AVLTreeIterator< Val, std::less< Val > >::preceding_node_
protectedinherited

the preceding node to go to when applying operator--

Definition at line 563 of file AVLTree.h.

563{nullptr};

◆ tree_

AVLTree< Val, std::less< Val > >* gum::AVLTreeIterator< Val, std::less< Val > >::tree_
protectedinherited

the tree the iterator points to

Definition at line 554 of file AVLTree.h.

554{nullptr};

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