Regina 7.4.1 Calculation Engine
Public Member Functions | List of all members
regina::detail::TriangulationBase< dim >::ChangeAndClearSpan< changeType > Class Template Reference

An object that facilitates taking snapshots, firing change events, and calling clearAllProperties(). More...

#include <triangulation/detail/triangulation.h>

Inheritance diagram for regina::detail::TriangulationBase< dim >::ChangeAndClearSpan< changeType >:

Public Member Functions

 ChangeAndClearSpan (TriangulationBase &tri)
 Performs all initial tasks before the triangulation is modified.
 
 ~ChangeAndClearSpan ()
 Performs all follow-up tasks after the triangulation has been modified.
 
 ChangeAndClearSpan (const ChangeAndClearSpan &)=delete
 
ChangeAndClearSpanoperator= (const ChangeAndClearSpan &)=delete
 

Detailed Description

template<int dim>
template<ChangeType changeType = ChangeType::General>
class regina::detail::TriangulationBase< dim >::ChangeAndClearSpan< changeType >

An object that facilitates taking snapshots, firing change events, and calling clearAllProperties().

An object of type Triangulation::ChangeAndClearSpan has four possible effects upon the triangulation that is passed to its constructor:

The use of ChangeAndClearSpan is similar to Packet::PacketChangeSpan (and indeed, this class is intended to replace PacketChangeSpan when writing Triangulation member functions): objects of this type would typically be created on the stack, just before the internal data within a triangulation is changed, and have a lifespan that covers all of your changes to the triangulation.

Like PacketChangeSpan, these objects can be safely nested with other ChangeAndClearSpan and/or PacketChangeSpan objects, and only the outermost object will fire packet change events. However, unlike PacketChangeSpan, this comes with a cost: as always, only one set of change events will be fired; however, if there are multiple ChangeAndClearSpan objects then Triangulation<dim>::takeSnapshot() and Triangulation<dim>::clearAllProperties() will be called multiple times. This is harmless but inefficient.

Likewise, if changeType is ChangeType::PreserveTopology then these objects will behave in the expected way when nested with other TopologyLock objects (i.e., topological properties will be preserved as long as any such object is alive).

Note: we would normally use a deduction guide so that, for the default case, you can just write ChangeAndClearSpan instead of ChangeAndClearSpan<>. Unfortunately this is not possible due to a gcc bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79501), which affects gcc versions 11 and earlier (but not clang).

ChangeAndClearSpan objects are not copyable, movable or swappable. In particular, Regina does not offer any way for a ChangeAndClearSpan to transfer its outstanding duties (i.e., firing events and calling clearAllProperties() upon destruction) to another object.

Template Parameters
changeTypecontrols which computed properties of the triangulation will be cleared upon the destruction of this object. See the notes above for details. If unsure, the default value of ChangeType::General (which clears all computed properties) is always safe to use.
Python
Not present.

Constructor & Destructor Documentation

◆ ChangeAndClearSpan()

template<int dim>
template<ChangeType changeType = ChangeType::General>
regina::detail::TriangulationBase< dim >::ChangeAndClearSpan< changeType >::ChangeAndClearSpan ( TriangulationBase tri)
inline

Performs all initial tasks before the triangulation is modified.

See the class notes for precisely what tasks are performed.

Parameters
trithe triangulation whose data is about to change.

◆ ~ChangeAndClearSpan()

template<int dim>
template<ChangeType changeType = ChangeType::General>
regina::detail::TriangulationBase< dim >::ChangeAndClearSpan< changeType >::~ChangeAndClearSpan ( )
inline

Performs all follow-up tasks after the triangulation has been modified.

See the class notes for precisely what tasks are performed.


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