Regina Calculation Engine
|
Packet administration and some basic packet types. More...
Classes | |
class | regina::Container |
A packet that simply contains other packets. More... | |
struct | regina::PacketInfo< packetType > |
A template that stores information about a particular type of packet. More... | |
class | regina::Packet |
Represents a packet of information that may be individually edited or operated upon. More... | |
class | regina::PacketListener |
An object that can be registered to listen for packet events. More... | |
class | regina::PDF |
A packet that can hold a PDF document. More... | |
class | regina::Script |
A packet representing a Python script that can be run. More... | |
class | regina::Text |
A packet representing a text string. More... | |
class | regina::XMLPacketReader |
An XML element reader that reads the data for an individual packet. More... | |
class | regina::XMLContainerReader |
An XML packet reader that reads a single container. More... | |
class | regina::XMLPDFReader |
An XML packet reader that reads a single PDF packet. More... | |
class | regina::XMLScriptReader |
An XML packet reader that reads a single script. More... | |
class | regina::XMLTextReader |
An XML packet reader that reads a single text packet. More... | |
class | regina::XMLTreeResolutionTask |
An individual task for resolving dangling packet references after an XML data file has been read. More... | |
class | regina::XMLTreeResolver |
Provides a mechanism to resolve dangling packet references after a complete packet tree has been read from an XML data file. More... | |
Macros | |
#define | REGINA_PACKET(class_, id) |
Defines various constants, types and virtual functions for a subclass of Packet. More... | |
#define | REGINA_PACKET_FROM(class_, helper) |
An alternative to REGINA_PACKET, for scenarios where the relevant PacketInfo specialisation is not visible. More... | |
Typedefs | |
typedef Container | regina::NContainer |
Deprecated typedef for backward compatibility. More... | |
typedef Packet | regina::NPacket |
Deprecated typedef for backward compatibility. More... | |
typedef PacketListener | regina::NPacketListener |
Deprecated typedef for backward compatibility. More... | |
typedef PDF | regina::NPDF |
Deprecated typedef for backward compatibility. More... | |
typedef Script | regina::NScript |
Deprecated typedef for backward compatibility. More... | |
typedef Text | regina::NText |
Deprecated typedef for backward compatibility. More... | |
Functions | |
Packet * | regina::open (const char *filename) |
Reads a Regina data file, and returns the corresponding packet tree. More... | |
Packet * | regina::open (std::istream &in) |
Reads a Regina data file from the given input stream, and returns the corresponding packet tree. More... | |
template<typename FunctionObject , typename... Args> | |
ReturnsTraits< FunctionObject >::ReturnType | regina::forPacket (PacketType packetType, FunctionObject &&func, typename ReturnsTraits< FunctionObject >::ReturnType defaultReturn, Args &&... args) |
Allows the user to call a template function whose template parameter matches a given value of PacketType, which is not known until runtime. More... | |
template<typename FunctionObject , typename... Args> | |
ReturnsTraits< FunctionObject >::Void | regina::forPacket (PacketType packetType, FunctionObject &&func, Args &&... args) |
Allows the user to call a template function whose template parameter matches a given value of PacketType, which is not known until runtime. More... | |
Packet administration and some basic packet types.
#define REGINA_PACKET | ( | class_, | |
id | |||
) |
Defines various constants, types and virtual functions for a subclass of Packet.
Every subclass of Packet must include REGINA_PACKET at the beginning of the class definition.
This macro provides the class with:
The implementation of this macro relies on the helper class PacketInfo<id>. If the relevant specialisation of PacketInfo is not visible (as is the case, for instance, with templated packet classes such as Triangulation<dim>), then you may replace REGINA_PACKET with the macro REGINA_PACKET_FROM, which allows you to provide an alternative implementation.
class_ | the name of this descendant class of Packet. |
id | the corresponding PacketType constant. |
#define REGINA_PACKET_FROM | ( | class_, | |
helper | |||
) |
An alternative to REGINA_PACKET, for scenarios where the relevant PacketInfo specialisation is not visible.
This is intended for use with template classes such as Triangulation<dim>, where the corresponding PacketInfo specialisations are defined in a separate header to avoid triggering unwanted instantiations of every possible Triangulation class.
Like REGINA_PACKET, this macro should be placed in the definition of the relevant subclass of Packet, and in return it provides the same constants, types and virtual functions that REGINA_PACKET does. However, unlike REGINA_PACKET, it does not rely on PacketInfo for its implementation. Instead it calls upon the given class helper, which must provide:
class_ | the name of this descendant class of Packet. |
helper | the helper class that provides the implementation details, as described above. |
typedef Container regina::NContainer |
Deprecated typedef for backward compatibility.
This typedef will be removed in a future release of Regina.
typedef Packet regina::NPacket |
Deprecated typedef for backward compatibility.
This typedef will be removed in a future release of Regina.
Deprecated typedef for backward compatibility.
This typedef will be removed in a future release of Regina.
typedef PDF regina::NPDF |
Deprecated typedef for backward compatibility.
This typedef will be removed in a future release of Regina.
typedef Script regina::NScript |
Deprecated typedef for backward compatibility.
This typedef will be removed in a future release of Regina.
typedef Text regina::NText |
Deprecated typedef for backward compatibility.
This typedef will be removed in a future release of Regina.
enum regina::PacketType |
Represents the different types of packet that are available in Regina.
IDs 0-9999 are reserved for future use by Regina. If you are extending Regina to include your own packet type, you should choose an ID >= 10000.
Enumerator | |
---|---|
PACKET_CONTAINER | Represents a container packet, of class Container. |
PACKET_TEXT | Represents a text packet, of class Text. |
PACKET_TRIANGULATION | Deprecated alias for PACKET_TRIANGULATION3.
|
PACKET_NORMALSURFACES | Represents a normal surface list, of class NormalSurfaces. |
PACKET_NORMALSURFACELIST | Deprecated alias for PACKET_NORMALSURFACES.
|
PACKET_SCRIPT | Represents a script packet, of class Script. |
PACKET_SURFACEFILTER | Represents a normal surface filter, of class SurfaceFilter or one of its descendant classes. |
PACKET_ANGLESTRUCTURES | Represents an angle structure list, of class AngleStructures. |
PACKET_ANGLESTRUCTURELIST | Deprecated alias for PACKET_ANGLESTRUCTURES.
|
PACKET_PDF | |
PACKET_DIM4TRIANGULATION | Deprecated alias for PACKET_TRIANGULATION4.
|
PACKET_NORMALHYPERSURFACES | Represents a normal hypersurface list, of class NormalHypersurfaces. |
PACKET_NORMALHYPERSURFACELIST | Deprecated alias for PACKET_NORMALHYPERSURFACES.
|
PACKET_DIM2TRIANGULATION | Deprecated alias for PACKET_TRIANGULATION2.
|
PACKET_SNAPPEATRIANGULATION | Represents a triangulation in the embedded SnapPea kernel, of class SnapPeaTriangulation. |
PACKET_TRIANGULATION2 | Represents a 2-dimensional triangulation, of class Triangulation<2>. |
PACKET_TRIANGULATION3 | Represents a 3-dimensional triangulation, of class Triangulation<3>. |
PACKET_TRIANGULATION4 | Represents a 4-dimensional triangulation, of class Triangulation<4>. |
PACKET_TRIANGULATION5 | Represents a 5-dimensional triangulation, of class Triangulation<5>. |
PACKET_TRIANGULATION6 | Represents a 6-dimensional triangulation, of class Triangulation<6>. |
PACKET_TRIANGULATION7 | Represents a 7-dimensional triangulation, of class Triangulation<7>. |
PACKET_TRIANGULATION8 | Represents a 8-dimensional triangulation, of class Triangulation<8>. |
PACKET_TRIANGULATION9 | Represents a 9-dimensional triangulation, of class Triangulation<9>. |
PACKET_TRIANGULATION10 | Represents a 10-dimensional triangulation, of class Triangulation<10>. |
PACKET_TRIANGULATION11 | Represents a 11-dimensional triangulation, of class Triangulation<11>. |
PACKET_TRIANGULATION12 | Represents a 12-dimensional triangulation, of class Triangulation<12>. |
PACKET_TRIANGULATION13 | Represents a 13-dimensional triangulation, of class Triangulation<13>. |
PACKET_TRIANGULATION14 | Represents a 14-dimensional triangulation, of class Triangulation<14>. |
PACKET_TRIANGULATION15 | Represents a 15-dimensional triangulation, of class Triangulation<15>. |
ReturnsTraits<FunctionObject>::ReturnType regina::forPacket | ( | PacketType | packetType, |
FunctionObject && | func, | ||
typename ReturnsTraits< FunctionObject >::ReturnType | defaultReturn, | ||
Args &&... | args | ||
) |
Allows the user to call a template function whose template parameter matches a given value of PacketType, which is not known until runtime.
In essence, this routine contains a switch/case statement that runs through all possible packet types known to Regina.
The advantages of this routine are that (i) the user does not need to repeatedly type such switch/case statements themselves; and (ii) if a new packet type is added then only a small amount of code needs to be extended to incorporate it.
In detail: the function object func must define a templated bracket operator, so that func.operator()<PacketInfo<t>>(...)
is defined for any valid PacketType enum value t. Then, when the user calls forPacket(packetType, func, defaultReturn, ...)
, this routine will call func.operator()<PacketInfo<packetType>>(...)
and pass back the corresponding return value. If packetType does not denote a valid packet type, then forPacket() will pass back defaultReturn instead.
There is also a variant of forPacket() that works with void functions, and so does not take the extra defaultReturn argument.
packetType | the given packet type. |
func | the function object whose bracket operator we will call with a PacketInfo<packetType> object. |
defaultReturn | the value to return if the given packet type is not valid. |
args | any additional arguments to pass to the bracket operator for func. These will be copied/moved, so if you wish to pass references then you may need to wrap them in std::ref or std::cref. |
ReturnsTraits<FunctionObject>::Void regina::forPacket | ( | PacketType | packetType, |
FunctionObject && | func, | ||
Args &&... | args | ||
) |
Allows the user to call a template function whose template parameter matches a given value of PacketType, which is not known until runtime.
In essence, this routine contains a switch/case statement that runs through all possible packet types known to Regina.
The advantages of this routine are that (i) the user does not need to repeatedly type such switch/case statements themselves; and (ii) if a new packet type is added then only a small amount of code needs to be extended to incorporate it.
In detail: the function object func must define a templated bracket operator, so that func.operator()<PacketInfo<t>>(...)
is defined for any valid PacketType enum value t. Then, when the user calls forPacket(packetType, func, ...)
, this routine will call func.operator()<PacketInfo<packetType>>(...)
in turn. If packetType does not denote a valid packet type, then forPacket() will do nothing.
There is also a variant of forPacket() that works with functions with return values, and which takes an extra defaultReturn argument.
packetType | the given packet type. |
func | the function object whose bracket operator we will call with a PacketInfo<packetType> object. |
args | any additional arguments to pass to the bracket operator for func. These will be copied/moved, so if you wish to pass references then you may need to wrap them in std::ref or std::cref. |
ReturnsTraits<FunctionObject>::Void
simply evaluates to void
. Packet* regina::open | ( | const char * | filename | ) |
Reads a Regina data file, and returns the corresponding packet tree.
This uses Regina's native XML file format; it does not matter whether the XML file is compressed or uncompressed.
If the file could not be opened or the top-level packet in the tree could not be read, this routine will return 0. If some packet deeper within the tree could not be read then that particular packet (and its descendants, if any) will simply be ignored.
regina.open()
.filename | the pathname of the file to read from. |
Packet* regina::open | ( | std::istream & | in | ) |
Reads a Regina data file from the given input stream, and returns the corresponding packet tree.
This uses Regina's native XML file format; it does not matter whether the XML file is compressed or uncompressed.
If the stream could not be read or if the top-level packet in the tree could not be read, then this routine will return 0. If some packet deeper within the tree could not be read then that particular packet (and its descendants, if any) will simply be ignored.
in | the input stream to read from. |