Regina Calculation Engine
|
A lightweight object that gives access to all strict descendants of a given packet. More...
#include <packet/packet.h>
Public Member Functions | |
PacketDescendants (const PacketDescendants &)=default | |
Default copy constructor. More... | |
PacketDescendants (const Packet *subtree) | |
Creates a new object for iterating through the strict descendants of the given packet. More... | |
PacketDescendants & | operator= (const PacketDescendants &)=default |
Default copy assignment operator. More... | |
SubtreeIterator | begin () const |
Returns an iterator at the beginning of the range of strict descendants. More... | |
SubtreeIterator | end () const |
Returns an iterator at the end of the range of strict descendants. More... | |
A lightweight object that gives access to all strict descendants of a given packet.
The purpose of this class is to support iteration through all strict descendants of a packet p using C++11 range-based for
loops:
In Python, PacketDescendants is an iterable object:
__iter__()
, which returns a SubtreeIterator; then SubtreeIterator implements next()
, which either returns the next descendant packet in the iteration or else throws a StopException
if there are no more children to return.