Regina 7.4 Calculation Engine
regina::TopologyLockable::TopologyLock Class Reference

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

#include <utilities/topologylock.h>

Public Member Functions

 TopologyLock (TopologyLockable &obj)
 Creates a new lock on the given object.
 
 ~TopologyLock ()
 Removes this lock on the associated object.
 
 TopologyLock (const TopologyLock &)=delete
 
TopologyLockoperator= (const TopologyLock &)=delete
 

Detailed Description

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

See the TopologyLockable class notes for details on what a "topology lock" means, and what effect it has upon the given object.

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

The easiest way to create a TopologyLock is to have it automatically rolled in to a Triangulation<dim>::ChangeAndClearSpan or a Link::ChangeAndClearSpan, by declaring a local ChangeAndClearSpan<ChangeType::PreserveTopology> on the stack whose lifespan covers all of the modifications that you are making to the triangulation or link.

Alternatively, you can of course create a TopologyLock manually. This would, again, be a local stack variable whose lifespan covers all of your modifications to the given object. In this case, the TopologyLock lifespan would need to cover all points where computed properties are cleared, such as:

  • modifying function calls, such as Simplex<dim>::join();
  • ChangeAndClearSpan objects being destroyed; or
  • manual calls to Triangulation<dim>::clearAllProperties() or Link::clearAllProperties().

In particular, if you are declaring a TopologyLock separately from a ChangeAndClearSpan, then the TopologyLock must be declared first (so that it is still active when the ChangeAndClearSpan calls clearAllProperties() in its destructor).

Multiple locks are allowed. If multiple locks are created, then topological properties of the given object 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.

Python
Not present.

Constructor & Destructor Documentation

◆ TopologyLock()

regina::TopologyLockable::TopologyLock::TopologyLock ( TopologyLockable & obj)
inline

Creates a new lock on the given object.

Parameters
objthe object (e.g., a triangulation or link) whose topological properties are to be locked.

◆ ~TopologyLock()

regina::TopologyLockable::TopologyLock::~TopologyLock ( )
inline

Removes this lock on the associated object.


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