Regina 7.0 Calculation Engine
|
A forward iterator for iterating through the entire packet subtree rooted at a given packet. More...
#include <packet/packet.h>
Public Types | |
using | value_type = typename std::conditional< const_, const Packet, Packet >::type |
Indicates what the iterator points to. More... | |
using | iterator_category = std::forward_iterator_tag |
Declares this to be a forward iterator type. More... | |
using | difference_type = ptrdiff_t |
The type obtained by subtracting iterators. More... | |
using | pointer = value_type * |
A pointer to value_type. More... | |
using | reference = value_type & |
A reference to value_type. More... | |
Public Member Functions | |
SubtreeIterator ()=default | |
Creates a past-the-end iterator. More... | |
SubtreeIterator (const SubtreeIterator &)=default | |
Default copy constructor. More... | |
SubtreeIterator (std::shared_ptr< value_type > subtree) | |
Creates a new iterator pointing to the first packet within the given subtree. More... | |
SubtreeIterator (std::shared_ptr< value_type > subtree, std::shared_ptr< value_type > current) | |
Creates a new iterator pointing to the given packet within the given subtree. More... | |
SubtreeIterator & | operator= (const SubtreeIterator &)=default |
Default copy assignment operator. More... | |
bool | operator== (const SubtreeIterator &rhs) const |
Tests whether this and the given iterator are equal. More... | |
bool | operator!= (const SubtreeIterator &rhs) const |
Tests whether this and the given iterator are different. More... | |
SubtreeIterator & | operator++ () |
Preincrement operator. More... | |
SubtreeIterator | operator++ (int) |
Postincrement operator. More... | |
value_type & | operator* () const |
Returns the packet that this iterator is currently pointing to. More... | |
operator bool () const | |
Identifies whether this iterator is dereferencable. More... | |
A forward iterator for iterating through the entire packet subtree rooted at a given packet.
The order of iteration is depth-first, where a parent packet is always processed before its descendants.
Each iterator will hold a std::shared_ptr to the packet whose subtree it is iterating over. This guarantees that the packet will not be destroyed mid-iteration, but it also means that you must ensure that you dispose of your iterators once you are finished with them.
const_ | Indicates whether this iterator should offer const or non-const access to the packet tree. |
iter()
, which returns the iterator object itself; it also implements next()
, which either returns the next packet in the subtree iteration or else throws a StopException
if there are no more packets to return. All iteration in Python is non-const (i.e., Python exclusively uses the classes where const_ is false
). using regina::SubtreeIterator< const_ >::difference_type = ptrdiff_t |
The type obtained by subtracting iterators.
using regina::SubtreeIterator< const_ >::iterator_category = std::forward_iterator_tag |
Declares this to be a forward iterator type.
using regina::SubtreeIterator< const_ >::pointer = value_type* |
A pointer to value_type.
using regina::SubtreeIterator< const_ >::reference = value_type& |
A reference to value_type.
using regina::SubtreeIterator< const_ >::value_type = typename std::conditional<const_, const Packet, Packet>::type |
|
default |
Creates a past-the-end iterator.
|
default |
Default copy constructor.
|
inline |
Creates a new iterator pointing to the first packet within the given subtree.
Dereferencing this iterator will return subtree itself.
subtree | the packet subtree that we are iterating through. This does not need to be the root of the overall packet tree (i.e., subtree is allowed to have a non-null parent). |
|
inline |
Creates a new iterator pointing to the given packet within the given subtree.
subtree | the packet subtree that we are iterating through. This does not need to be the root of the overall packet tree (i.e., subtree is allowed to have a non-null parent). |
current | the packet within the subtree that the new iterator should point to, or null if the new iterator should be past-the-end. If current is not null, then it must be equal to or a descendant of subtree. |
|
inline |
Identifies whether this iterator is dereferencable.
next()
, which either returns the current child packet and increments the iterator, or else throws a StopIteration
exception if the iterator is not dereferencable.true
if and only if this is dereferencable (i.e., not past-the-end).
|
inline |
Tests whether this and the given iterator are different.
|
inline |
Returns the packet that this iterator is currently pointing to.
next()
, which either returns the current packet in the subtree and increments the iterator, or else throws a StopIteration
exception if the iterator is past-the-end.
|
inline |
Preincrement operator.
next()
, which either returns the current packet in the subtree and increments the iterator, or else throws a StopIteration
exception if the iterator is past-the-end.
|
inline |
Postincrement operator.
next()
, which either returns the current packet in the subtree and increments the iterator, or else throws a StopIteration
exception if the iterator is past-the-end.
|
default |
Default copy assignment operator.
|
inline |
Tests whether this and the given iterator are equal.