Regina 7.4 Calculation Engine
regina::PacketData< Held >::PacketChangeSpan Class Reference

An object that facilitates firing packetToBeChanged() and packetWasChanged() events. More...

#include <packet/packet.h>

Public Member Functions

 PacketChangeSpan (PacketData &data)
 Creates a new change event object for the given Held data.
 
 ~PacketChangeSpan ()
 Destroys this change event object.
 
Held & held () const
 Returns the underlying Held object.
 
 PacketChangeSpan (const PacketChangeSpan &)=delete
 
PacketChangeSpanoperator= (const PacketChangeSpan &)=delete
 

Protected Attributes

PacketDatadata_
 The object for which - if it belongs to a PacketOf<Held> - change events will be fired.
 

Detailed Description

template<typename Held>
class regina::PacketData< Held >::PacketChangeSpan

An object that facilitates firing packetToBeChanged() and packetWasChanged() events.

This performs the same function as Packet::PacketChangeSpan; see that class for full details on how it works. The main differences are:

  • If the underlying Held object is not actually part of a larger PacketOf<Held>, then this PacketChangeSpan will do nothing. In such a scenario, the PacketChangeSpan constructor and destructor are both extremely cheap (each will make just a single integer comparison).
  • If the underlying Held object is part of a PacketOf<Held>, then this PacketChangeSpan will ensure that the appropriate packet events are fired (just like Packet::PacketChangeSpan).

Just like Packet::PacketChangeSpan, these objects can be nested so that only the outermost object will fire change events; furthermore, PacketData<Held>::PacketChangeSpan objects and Packet::PacketChangeSpan objects can be nested within each other.

Also, just like Packet::PacketChangeSpan and Packet::PacketChangeGroup, there is an equivalent type PacketData::PacketChangeGroup whose purpose is to indicate to the reader that the an object is being used only to merge many event pairs into a single event pair.

When working with PacketData<Triangulation<3>>, this class includes special code that nullifies a SnapPea triangulation when its inherited Triangulation<3> data changes unexpectedly. See the SnapPeaTriangulation class for details.

PacketChangeSpan objects are not copyable, movable or swappable. In particular, Regina does not offer any way for a PacketChangeSpan to transfer its duty (i.e., firing events upon destruction) to another object.

Python
Not present.

Constructor & Destructor Documentation

◆ PacketChangeSpan()

template<typename Held >
regina::PacketData< Held >::PacketChangeSpan::PacketChangeSpan ( PacketData & data)
inline

Creates a new change event object for the given Held data.

If data is part of a PacketOf<Held>, and this is the only PacketChangeSpan currently in existence for data, then this constructor will call PacketListener::packetToBeChanged() for all registered listeners for the packet.

Parameters
datathe object whose data is about to change; this may or may not be of the subclass PacketOf<Held>.

◆ ~PacketChangeSpan()

template<typename Held >
regina::PacketData< Held >::PacketChangeSpan::~PacketChangeSpan ( )
inline

Destroys this change event object.

If the underlying Held object is part of a PacketOf<Held>, and this is the only PacketChangeSpan currently in existence for it, then this destructor will call PacketListener::packetWasChanged() for all registered listeners for the packet.

Member Function Documentation

◆ held()

template<typename Held >
Held & regina::PacketData< Held >::PacketChangeSpan::held ( ) const
inline

Returns the underlying Held object.

Returns
the Held object that was originally passed to the PacketChangeSpan constructor.

Member Data Documentation

◆ data_

template<typename Held >
PacketData& regina::PacketData< Held >::PacketChangeSpan::data_
protected

The object for which - if it belongs to a PacketOf<Held> - change events will be fired.


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