Regina 7.3 Calculation Engine
Public Member Functions | List of all members
regina::detail::TriangulationBase< dim >::TopologyLock Class Reference

Creates a temporary lock on the topological properties of the given triangulation. More...

#include <triangulation/detail/triangulation.h>

Public Member Functions

 TopologyLock (TriangulationBase< dim > &tri)
 Creates a new lock on the given triangulation. More...
 
 ~TopologyLock ()
 Removes this lock on the associated triangulation. More...
 
 TopologyLock (const TopologyLock &)=delete
 
TopologyLockoperator= (const TopologyLock &)=delete
 

Detailed Description

template<int dim>
class regina::detail::TriangulationBase< dim >::TopologyLock

Creates a temporary lock on the topological properties of the given triangulation.

While this object exists, any computed properties of the underlying manifold will be preserved even when the triangulation changes. This allows you to avoid recomputing expensive invariants when the underlying manifold is retriangulated.

The lock will be created by the class constructor and removed by the class destructor. That is, the lock will remain in effect until the TopologyLock object goes out of scope (or is otherwise destroyed).

Multiple locks are allowed. If multiple locks are created, then computed properties of the manifold will be preserved as long as any one of these locks still exists. Multiple locks do not necessarily need to be nested (i.e., the order of destruction does not need to be the reverse order of construction).

Regina is currently only able to handle 255 distinct locks on the same triangulation at a time. This should be enormously more than enough (since external users cannot construct TopologyLock objects, and Regina's own code should not be recursing deeply inside TopologyLock scopes). However, even if there are somehow more than 255 locks, the worst that will happen is some CPU wastage: some properties may be cleared and need to be recomputed when this was not mathematically necessary.

TopologyLock objects are not copyable, movable or swappable. In particular, Regina does not offer any way for a TopologyLock to transfer its destructor's responsibilities (i.e., "unlocking" the topological properties of the triangulation) to another object.

Note
If you are creating a ChangeEventSpan before retriangulating the manifold and you wish to use a TopologyLock, then you should create the TopologyLock before the ChangeEventSpan (since the ChangeEventSpan calls clearAllProperties() in its destructor, and you need your topology lock to still exist at that point).

Constructor & Destructor Documentation

◆ TopologyLock()

template<int dim>
regina::detail::TriangulationBase< dim >::TopologyLock::TopologyLock ( TriangulationBase< dim > &  tri)
inline

Creates a new lock on the given triangulation.

Parameters
trithe triangulation whose topological properties are to be locked. This may be null (in which case the lock has no effect).

◆ ~TopologyLock()

template<int dim>
regina::detail::TriangulationBase< dim >::TopologyLock::~TopologyLock
inline

Removes this lock on the associated triangulation.


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