Regina 7.4 Calculation Engine
|
A base class for objects that support topology locks, such as triangulations or links. More...
#include <utilities/topologylock.h>
Classes | |
class | TopologyLock |
Creates a temporary lock on the topological properties of the given object. More... | |
Public Member Functions | |
TopologyLockable ()=default | |
Default constructor that initialises the lock count to zero. | |
TopologyLockable (const TopologyLockable &)=delete | |
TopologyLockable & | operator= (const TopologyLockable &)=delete |
Protected Member Functions | |
bool | topologyLocked () const |
Returns whether or not there are any topology locks currently held on this object. | |
Protected Attributes | |
uint8_t | topologyLock_ { 0 } |
The number of topology locks currently held on this object. | |
A base class for objects that support topology locks, such as triangulations or links.
Essentially, a "topology lock" means the following. In routines that would normally clear computed properties of an object (e.g., operations that edit a triangulation or a link diagram), if there are any topology locks currently held on that object then properties that are purely topological will be preserved. This is essentially an optimisation that allows us to avoid recomputing expensive invariants when we know in advance they will not change.
By a "purely topological" property, we mean the following:
This specific notion of "preserved properties" is subject to change in future versions of Regina.
Currently end users cannot access TopologyLockable or TopologyLock at all; instead topology locks are restricted to member functions, since it is too easy to accidentally abuse them and generate incorrect mathematical results as a result. This may change in a future release of Regina if a good way is found to make them safer for end users.
TopologyLockable should be used as a protected base class for objects that support topology locks (e.g., both Triangulation<dim> and Link derive from TopologyLockable). To create a temporary topology lock on an object obj (e.g., a triangulation or link), typically within a member function (e.g., functions that implement Pachner or Reidemeister moves), you should create a TopologyLock on the stack and pass obj to its constructor.
Subclass implementations should remember:
true
then they should preserve any properties that are purely topological./nopython
|
default |
Default constructor that initialises the lock count to zero.
|
inlineprotected |
Returns whether or not there are any topology locks currently held on this object.
Strictly speaking, this routine could return a false negative: the number of locks is stored as an 8-bit integer and so in reality this tests whether the number of locks is a multiple of 256. False negatives are mathematically harmless, since the worst that will happen is that topological properties will be cleared when they could have been preserved, and so unnecessary extra computation may be required to compute them again.
This routine will never return a false positive.
false
if there are no topology locks currently held on this object, or if a false negative occurs (as described above); or true
to indicate that there are currently topology locks held on this object.
|
protected |
The number of topology locks currently held on this object.
Any non-zero number of locks implies that "hook routines" that clear computed properties (as described in the class notes) will preserve properties that are purely topological.