Regina Calculation Engine
Public Member Functions | List of all members
regina::SubtreeIterator Class Reference

A forward iterator for iterating through the entire packet subtree rooted at a given packet. More...

#include <packet/packet.h>

Public Member Functions

 SubtreeIterator ()
 Creates a past-the-end iterator. More...
 
 SubtreeIterator (const SubtreeIterator &)=default
 Default copy constructor. More...
 
 SubtreeIterator (Packet *subtree)
 Creates a new iterator pointing to the first packet within the given subtree. More...
 
 SubtreeIterator (const Packet *subtree, Packet *current)
 Creates a new iterator pointing to the given packet within the given subtree. More...
 
SubtreeIteratoroperator= (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...
 
SubtreeIteratoroperator++ ()
 Preincrement operator. More...
 
SubtreeIterator operator++ (int)
 Postincrement operator. More...
 
Packet *const & operator* () const
 Returns the packet that this iterator is currently pointing to. More...
 

Detailed Description

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.

This header also specialises std::iterator_traits for this iterator class.

Python:\n Instead of the C++ interface described here, in Python
this class implements the Python iterable/iterator interface. It implements the function 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.

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

Copyright © 1999-2018, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).