Regina 7.0 Calculation Engine
|
A lightweight helper class that allows an object of type Held to connect with the wrapped packet class that contains it. More...
#include <packet/packet.h>
Classes | |
class | ChangeEventSpan |
An object that facilitates firing packetToBeChanged() and packetWasChanged() events. More... | |
Public Member Functions | |
PacketData ()=default | |
Default constructor that sets heldBy_ to HELD_BY_NONE. More... | |
PacketData (const PacketData &) noexcept | |
Copy constructor that ignores its argument, and instead sets heldBy_ to HELD_BY_NONE. More... | |
PacketData & | operator= (const PacketData &) |
Assignment operator that ignores its argument and does nothing. More... | |
std::shared_ptr< PacketOf< Held > > | packet () |
Returns the packet that holds this data, if there is one. More... | |
std::shared_ptr< const PacketOf< Held > > | packet () const |
Returns the packet that holds this data, if there is one. More... | |
std::string | anonID () const |
A unique string ID that can be used in place of a packet ID. More... | |
Protected Attributes | |
PacketHeldBy | heldBy_ { HELD_BY_NONE } |
Indicates whether this Held object is in fact the inherited data for a PacketOf<Held>. More... | |
Friends | |
class | PacketOf< Held > |
A lightweight helper class that allows an object of type Held to connect with the wrapped packet class that contains it.
For every wrapped packet type of the form PacketOf<Held>, the corresponding class Held must derive from PacketData<Held>. See the Packet class notes for more information about packets, and for what else must be implemented for each wrapped packet type.
This base class is extremely lightweight: the only data that it contains is a single PacketHeldBy enumeration value. All of the class constructors set this value to HELD_BY_NONE; it is the responsibility of subclasses (e.g., PacketOf<Held>) to change this where necessary.
|
default |
Default constructor that sets heldBy_ to HELD_BY_NONE.
|
inlinenoexcept |
Copy constructor that ignores its argument, and instead sets heldBy_ to HELD_BY_NONE.
This is because heldBy_ stores information about the C++ type of this object, not the object being copied.
This constructor is provided so that Held can (if it wants) use an implicitly-declared copy or move constructor.
std::string regina::PacketData< Held >::anonID |
A unique string ID that can be used in place of a packet ID.
This is an alternative to Packet::internalID(), and is designed for use when Held is not actually wrapped by a PacketOf<Held>. (An example of such a scenario is when a normal surface list needs to write its triangulation to file, but the triangulation is a standalone object that is not stored in a packet.)
The ID that is returned will:
These IDs are not preserved when copying or moving one object to another, and are not preserved when writing to a Regina data file and then reloading the file contents.
See Packet::internalID() for further details.
|
inline |
Assignment operator that ignores its argument and does nothing.
This is because heldBy_ stores information about the C++ type of this object, not the object being copied.
This operator is provided so that Held can (if it wants) use an implicitly-declared copy or move assignment operator.
|
inline |
Returns the packet that holds this data, if there is one.
If this object is being held by a packet p of type PacketOf<Held>, then that packet p will be returned. Otherwise, if this is a "standalone" object of type Held, then this routine will return null
.
There is a special case when dealing with a packet q that holds a SnapPea triangulation. Here q is of type PacketOf<SnapPeaTriangulation>, and it holds a Triangulation<3> "indirectly" in the sense that Packetof<SnapPeaTriangulation> derives from SnapPeaTriangulation, which in turn derives from Triangulation<3>. In this scenario:
null
, since there is no "direct" PacketOf<Triangulation<3>>;The function inAnyPacket() is specific to Triangulation<3>, and is not offered for other Held types.
null
if this data is not (directly) held by a packet.
|
inline |
Returns the packet that holds this data, if there is one.
See the non-const version of this function for further details, and in particular for how this functions operations in the special case of a packet that holds a SnapPea triangulation.
null
if this data is not (directly) held by a packet.
|
protected |
Indicates whether this Held object is in fact the inherited data for a PacketOf<Held>.
As a special case, this field is also used to indicate when a Triangulation<3> is in fact the inherited data for a SnapPeaTriangulation. See the PacketHeldBy enumeration for more details on the different values that this data member can take.