Regina 7.4 Calculation Engine
|
An object that facilitates taking snapshots, firing change events, and calling clearAllProperties(). More...
#include <triangulation/detail/triangulation.h>
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 | |
ChangeAndClearSpan & | operator= (const ChangeAndClearSpan &)=delete |
Triangulation< dim > & | held () const |
Returns the underlying Held object. | |
Protected Attributes | |
PacketData & | data_ |
The object for which - if it belongs to a PacketOf<Held> - change events will be fired. | |
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.
changeType | controls 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. |
|
inline |
Performs all initial tasks before the triangulation is modified.
See the class notes for precisely what tasks are performed.
tri | the triangulation whose data is about to change. |
|
inline |
Performs all follow-up tasks after the triangulation has been modified.
See the class notes for precisely what tasks are performed.
|
inlineinherited |
Returns the underlying Held object.
|
protectedinherited |
The object for which - if it belongs to a PacketOf<Held> - change events will be fired.