Regina 7.0 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
 Default copy constructor. More...
 
void init (const DiscSetSurfaceDataImpl< TetData > &discSet)
 Points this iterator to the first disc in the given disc set. More...
 
DiscSpecIteratoroperator= (const DiscSpecIterator &)=default
 Default copy assignment operator. More...
 
DiscSpecIteratoroperator++ ()
 Preincrement operator. More...
 
DiscSpecIterator operator++ (int)
 Postincrement operator. 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

Default copy constructor.

Member Function Documentation

◆ done()

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

Determines if this iterator is past-the-end.

Python
Not present; instead this class implements next(), which either returns the current DiscSpec and increments the iterator, or else throws a StopIteration exception if the iterator is past-the-end.
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; instead this class implements next(), which either returns the current DiscSpec and increments the iterator, or else throws a StopIteration exception if the iterator is past-the-end.
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; instead this class implements next(), which either returns the current DiscSpec and increments the iterator, or else throws a StopIteration exception if the iterator is past-the-end.
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; instead this class implements next(), which either returns the current DiscSpec and increments the iterator, or else throws a StopIteration exception if the iterator is past-the-end.
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; instead this class implements next(), which either returns the current DiscSpec and increments the iterator, or else throws a StopIteration exception if the iterator is past-the-end.
Returns
a copy of this iterator before it was incremented.

◆ operator=()

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

Default copy assignment operator.

◆ 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-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).