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


Iterates through all directed arcs of a knot or link. More...

#include <link/link.h>

Public Member Functions

 ArcIterator ()
 Creates a singular iterator. More...
 
 ArcIterator (const ArcIterator &)=default
 Default copy constructor. More...
 
 ArcIterator (const Link &link, size_t crossing=0, bool upper=false)
 Creates a new iterator pointing to the arc exiting the given strand of the given crossing of the given link. More...
 
ArcIteratoroperator++ ()
 Preincrement operator. More...
 
ArcIterator operator++ (int)
 Postincrement operator. More...
 
StrandRef operator* () const
 Returns the directed arc to which this iterator points. More...
 
ArcIteratoroperator= (const ArcIterator &)=default
 Default assignment operator. More...
 
bool operator== (const ArcIterator &rhs) const
 Tests whether this and the given iterator are equal. More...
 
bool operator!= (const ArcIterator &rhs) const
 Tests whether this and the given iterator are different. More...
 

Detailed Description


Iterates through all directed arcs of a knot or link.

The order of iteration is as follows. The iterator works through crossings 0,1,... of the underlying link in turn. For each crossing, it visits the arcs exiting the crossing from the lower strand and then the upper strand, in that order.

Zero-crossing unknot components are not visited at all by this iterator type.

This class implements the Boost multipass input iterator concept, which is similar to the standard C++ forward iterator except that the reference type may be the same as value_type (and so, in particular, the dereference operator may return by value). This header also specialises std::iterator_traits for this iterator type.

Python
Not present.

Constructor & Destructor Documentation

◆ ArcIterator() [1/3]

regina::ArcIterator::ArcIterator ( )
inline

Creates a singular iterator.

◆ ArcIterator() [2/3]

regina::ArcIterator::ArcIterator ( const ArcIterator )
default

Default copy constructor.

◆ ArcIterator() [3/3]

regina::ArcIterator::ArcIterator ( const Link link,
size_t  crossing = 0,
bool  upper = false 
)
inline

Creates a new iterator pointing to the arc exiting the given strand of the given crossing of the given link.

Parameters
linkthe underlying knot/link.
crossingthe index of the given crossing. This must be between 0 and link.size()-1 for a deferencable iterator, or must be exactly link.size() for a past-the-end iterator.
uppertrue or false according to whether the iterator should point to the arc exiting the given crossing from the upper or lower strand respectively. For a past-the-end iterator, this should always be false.

Member Function Documentation

◆ operator!=()

bool regina::ArcIterator::operator!= ( const ArcIterator rhs) const
inline

Tests whether this and the given iterator are different.

Note
This routine only compares the indices of the crossings and the upper/lower strand markings. It does not examine whether this and the given iterator refer to the same underlying link.
Parameters
rhsthe iterator to compare with this.
Returns
true if and only if the two iterators are different.

◆ operator*()

StrandRef regina::ArcIterator::operator* ( ) const
inline

Returns the directed arc to which this iterator points.

See the StrandRef documentation for details on how a StrandRef object is used to identify a directed arc.

Precondition
This iterator is not past-the-end.
Returns
the directed arc to which this iterator points.

◆ operator++() [1/2]

ArcIterator & regina::ArcIterator::operator++ ( )
inline

Preincrement operator.

Returns
a reference to this iterator.

◆ operator++() [2/2]

ArcIterator regina::ArcIterator::operator++ ( int  )
inline

Postincrement operator.

Returns
a copy of this iterator before it was incremented.

◆ operator=()

ArcIterator& regina::ArcIterator::operator= ( const ArcIterator )
default

Default assignment operator.

Returns
a reference to this iterator.

◆ operator==()

bool regina::ArcIterator::operator== ( const ArcIterator rhs) const
inline

Tests whether this and the given iterator are equal.

Note
This routine only compares the indices of the crossings and the upper/lower strand markings. It does not examine whether this and the given iterator refer to the same underlying link.
Parameters
rhsthe iterator to compare with this.
Returns
true if and only if the two iterators are equal.

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

Copyright © 1999-2021, 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).