Regina 7.3 Calculation Engine
Public Types | Public Member Functions | Friends | List of all members
regina::DiscSpecIterator< TetData > Class Template Reference

A forward iterator used for running through all normal discs in a normal surface. More...

#include <surface/disc.h>

Public Types

using iterator_category = std::forward_iterator_tag
 Declares this to be a forward iterator type. More...
 
using value_type = regina::DiscSpec
 Indicates what type the iterator points to. More...
 
using difference_type = long
 The type obtained by subtracting iterators. More...
 
using pointer = const regina::DiscSpec *
 A pointer to value_type. More...
 
using reference = const regina::DiscSpec &
 The type obtained when dereferencing iterators. More...
 

Public Member Functions

 DiscSpecIterator ()
 Creates a new uninitialised iterator. More...
 
 DiscSpecIterator (const DiscSetSurfaceDataImpl< TetData > &discSet)
 Creates a new iterator pointing to the first disc in the given disc set. More...
 
 DiscSpecIterator (const DiscSpecIterator &)=default
 Creates a new copy of the given iterator. More...
 
void init (const DiscSetSurfaceDataImpl< TetData > &discSet)
 Points this iterator to the first disc in the given disc set. More...
 
DiscSpecIteratoroperator= (const DiscSpecIterator &)=default
 Sets this to be a copy of the given iterator. More...
 
DiscSpecIteratoroperator++ ()
 Preincrement operator. More...
 
DiscSpecIterator operator++ (int)
 Postincrement operator. More...
 
auto __next__ ()
 Returns the current DiscSpec and increments this iterator. More...
 
const DiscSpecoperator* () const
 Returns a reference to the disc pointed to by this iterator. More...
 
bool done () const
 Determines if this iterator is past-the-end. More...
 
bool operator== (const DiscSpecIterator &other) const
 Determines if this and the given iterator are equal. More...
 
bool operator!= (const DiscSpecIterator &other) const
 Determines if this and the given iterator are different. More...
 

Friends

class DiscSetSurfaceDataImpl< TetData >
 

Detailed Description

template<class TetData>
class regina::DiscSpecIterator< TetData >

A forward iterator used for running through all normal discs in a normal surface.

This class is designed to work alongside DiscSetSurfaceDataImpl<TetData>. Typically you would not need to specify the template argument TetData; for copy initialisation you can use the auto type, and when constructing from a DiscSetSurfaceData<T> the template argument can be automatically deduced.

Warning
This class converts the indices of normal discs of a given type from LargeInteger to unsigned long. See the precondition below.
Precondition
The number of normal discs of a particular type in a particular tetrahedron can be represented by a long integer.
Python
The only instance of this class that is available through python is the iterator for DiscSetSurface (i.e., the "vanilla" case where TetData is the type DiscSetTet). Moreover, instead of the C++ interface described here, in Python DiscSetSurface and this class together implement the Python iterable/iterator interface. The DiscSetSurface class implements __iter__(), which returns a DiscSpecIterator; then DiscSpecIterator implements next(), which either returns the next normal disc in the set or else throws a StopException if there are no more discs to return.

Member Typedef Documentation

◆ difference_type

template<class TetData >
using regina::DiscSpecIterator< TetData >::difference_type = long

The type obtained by subtracting iterators.

◆ iterator_category

template<class TetData >
using regina::DiscSpecIterator< TetData >::iterator_category = std::forward_iterator_tag

Declares this to be a forward iterator type.

◆ pointer

template<class TetData >
using regina::DiscSpecIterator< TetData >::pointer = const regina::DiscSpec*

A pointer to value_type.

◆ reference

template<class TetData >
using regina::DiscSpecIterator< TetData >::reference = const regina::DiscSpec&

The type obtained when dereferencing iterators.

◆ value_type

template<class TetData >
using regina::DiscSpecIterator< TetData >::value_type = regina::DiscSpec

Indicates what type the iterator points to.

Constructor & Destructor Documentation

◆ DiscSpecIterator() [1/3]

template<class TetData >
regina::DiscSpecIterator< TetData >::DiscSpecIterator ( )
inline

Creates a new uninitialised iterator.

This iterator cannot be used or queried until either init() or the assignmemnt operator is called.

Python
Not present. The only way to create a DiscSpecIterator is to iterate over a DiscSetSurface.

◆ DiscSpecIterator() [2/3]

template<class TetData >
regina::DiscSpecIterator< TetData >::DiscSpecIterator ( const DiscSetSurfaceDataImpl< TetData > &  discSet)
inline

Creates a new iterator pointing to the first disc in the given disc set.

Python
Not present. The only way to create a DiscSpecIterator is to iterate over a DiscSetSurface.
Parameters
discSetthe disc set used to initialise this iterator.

◆ DiscSpecIterator() [3/3]

template<class TetData >
regina::DiscSpecIterator< TetData >::DiscSpecIterator ( const DiscSpecIterator< TetData > &  )
default

Creates a new copy of the given iterator.

Python
Not present. The only way to create a DiscSpecIterator is to iterate over a DiscSetSurface.

Member Function Documentation

◆ __next__()

template<class TetData >
auto regina::DiscSpecIterator< TetData >::__next__ ( )

Returns the current DiscSpec and increments this iterator.

C++
Not present. For C++ users, DiscSpecIterator provides the usual iterator preincrement, postincrement and dereferencing operators (++ and *) instead.
Exceptions
StopIterationThe iterator is already past-the-end when this function is called.
Returns
a reference to the disc that this iterator is pointing to, before the increment takes place.

◆ done()

template<class TetData >
bool regina::DiscSpecIterator< TetData >::done ( ) const
inline

Determines if this iterator is past-the-end.

Python
Not present. For Python users, DiscSpecIterator implements the Python iterator interface instead. See next() for details.
Returns
true if and only if this iterator is past-the-end.

◆ init()

template<class TetData >
void regina::DiscSpecIterator< TetData >::init ( const DiscSetSurfaceDataImpl< TetData > &  discSet)
inline

Points this iterator to the first disc in the given disc set.

Python
Not present. For Python users, DiscSpecIterator implements the Python iterator interface instead. See next() for details.
Parameters
discSetthe disc set used to reinitialise this iterator.

◆ operator!=()

template<class TetData >
bool regina::DiscSpecIterator< TetData >::operator!= ( const DiscSpecIterator< TetData > &  other) const
inline

Determines if this and the given iterator are different.

Two iterators are considered equal if (i) they were constructed from the same DiscSetSurface object (not two different DiscSetSurface objects with identical contents), and (ii) they point to the same disc of the same tetrahedron.

Parameters
otherthe iterator to compare with this.
Returns
true if and only if this and the given iterator are equal.

◆ operator*()

template<class TetData >
const DiscSpec & regina::DiscSpecIterator< TetData >::operator* ( ) const
inline

Returns a reference to the disc pointed to by this iterator.

Precondition
This iterator is not past-the-end.
Python
Not present. For Python users, DiscSpecIterator implements the Python iterator interface instead. See next() for details.
Returns
a reference to the disc pointed to by this iterator.

◆ operator++() [1/2]

template<class TetData >
DiscSpecIterator & regina::DiscSpecIterator< TetData >::operator++ ( )
inline

Preincrement operator.

Precondition
This iterator is not past-the-end.
Python
Not present. For Python users, DiscSpecIterator implements the Python iterator interface instead. See next() for details.
Returns
a reference to this iterator.

◆ operator++() [2/2]

template<class TetData >
DiscSpecIterator regina::DiscSpecIterator< TetData >::operator++ ( int  )
inline

Postincrement operator.

Precondition
This iterator is not past-the-end.
Python
Not present. For Python users, DiscSpecIterator implements the Python iterator interface instead. See next() for details.
Returns
a copy of this iterator before it was incremented.

◆ operator=()

template<class TetData >
DiscSpecIterator & regina::DiscSpecIterator< TetData >::operator= ( const DiscSpecIterator< TetData > &  )
default

Sets this to be a copy of the given iterator.

Returns
a reference to this iterator.

◆ operator==()

template<class TetData >
bool regina::DiscSpecIterator< TetData >::operator== ( const DiscSpecIterator< TetData > &  other) const
inline

Determines if this and the given iterator are equal.

Two iterators are considered equal if (i) they were constructed from the same DiscSetSurface object (not two different DiscSetSurface objects with identical contents), and (ii) they point to the same disc of the same tetrahedron.

Parameters
otherthe iterator to compare with this.
Returns
true if and only if this and the given iterator are equal.

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

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