The default encoding to use for isomorphism signatures.
More...
#include <triangulation/isosigencoding.h>
|
using | Signature = std::string |
| The data type used to store an isomorphism signature. More...
|
|
|
static Signature | emptySig () |
| Returns the isomorphism signature of an empty dim-dimensional triangulation. More...
|
|
static Signature | encode (size_t size, size_t nFacetActions, const uint8_t *facetAction, size_t nJoins, const size_t *joinDest, const typename Perm< dim+1 >::Index *joinGluing) |
| Encodes data for a single connected component of a dim-dimensional triangulation. More...
|
|
static constexpr unsigned | decodeSingle (char c) |
| Determine the integer value represented by the given base64 character. More...
|
|
static constexpr char | encodeSingle (unsigned c) |
| Determine the base64 character that represents the given integer value. More...
|
|
static constexpr bool | isValid (char c) |
| Is the given character a valid base64 character? More...
|
|
template<typename IntType > |
static void | encodeInt (std::string &s, IntType val, unsigned nChars) |
| Append a base64 encoding of the given integer to the given string. More...
|
|
template<typename IntType > |
static IntType | decodeInt (const char *s, unsigned nChars) |
| Read the integer that is encoded at the beginning of the given base64 string. More...
|
|
template<typename InputIterator > |
static char | encodeTrits (InputIterator trits, unsigned nTrits) |
| Returns a single base64 character that encodes up to three trits, given using an input iterator. More...
|
|
template<int nTrits> |
static constexpr char | encodeTrits (const std::array< uint8_t, nTrits > &trits) |
| Returns a single base64 character that encodes up to three trits, given using a fixed-size array. More...
|
|
template<typename OutputIterator > |
static void | decodeTrits (char c, OutputIterator result) |
| Decodes a single base64 character into three trits, and returns these using an output iterator. More...
|
|
static constexpr std::array< uint8_t, 3 > | decodeTrits (char c) |
| Decodes a single base64 character into three trits, and returns these as a fixed-size array. More...
|
|
|
static constexpr unsigned | charsPerPerm |
| The number of characters that we use in our encoding to represent a single gluing permutation. More...
|
|
template<int dim>
class regina::IsoSigPrintable< dim >
The default encoding to use for isomorphism signatures.
This printable encoding is consistent with the original isomorphism signatures that were implemented in Regina 4.90. It represents an isomorphism signature as a std::string, using only printable characters from the 7-bit ASCII range.
This class is designed to be used as a template parameter for Triangulation<dim>::isoSig() and Triangulation<dim>::isoSigDetail(). Typical users would have no need to create objects of this class or call any of its functions directly.
- Python
- Python does not support templates. Instead this class can be used by appending the dimension as a suffix (e.g., IsoSigPrintable2 and IsoSigPrintable3 for dimensions 2 and 3).
◆ Signature
The data type used to store an isomorphism signature.
◆ decodeInt()
template<typename IntType >
static IntType regina::Base64SigEncoding::decodeInt |
( |
const char * |
s, |
|
|
unsigned |
nChars |
|
) |
| |
|
inlinestaticinherited |
Read the integer that is encoded at the beginning of the given base64 string.
It will be assumed that the integer is encoded using nChars base64 characters, each containing 6 bits of the integer, with the lowest-significance bits encoded in the first characters.
The inverse to this routine is encodeInt().
- Precondition
- The given string contains at least nChars characters.
- Python
- The template argument IntType is taken to be a native C++
long
.
- Template Parameters
-
IntType | a native C++ integer type, such as uint8_t , or unsigned , or long long . The result will be assembled using bitwise OR and bitwise shift lefts, and it is assumed that the programmer has chosen an integer type large enough to contain whatever values they expect to read. |
- Parameters
-
s | the string from which the encoded base64 characters should be read. |
nChars | the number of base64 characters to read. |
- Returns
- the native integer that was encoded.
◆ decodeSingle()
static constexpr unsigned regina::Base64SigEncoding::decodeSingle |
( |
char |
c | ) |
|
|
inlinestaticconstexprinherited |
Determine the integer value represented by the given base64 character.
The inverse to this routine is encodeSingle().
- Parameters
-
c | a base64 character, which must be one of the 64 printable characters described in the class notes. |
- Returns
- the corresponding integer, which will be between 0 and 63 inclusive.
◆ decodeTrits() [1/2]
static constexpr std::array< uint8_t, 3 > regina::Base64SigEncoding::decodeTrits |
( |
char |
c | ) |
|
|
inlinestaticconstexprinherited |
Decodes a single base64 character into three trits, and returns these as a fixed-size array.
A trit is either 0, 1 or 2.
The inverse to this routine is encodeTrits(); see that routine for details of the encoding.
- Parameters
-
c | the base64 character to decode. |
- Returns
- an array containing the three trits that had been encoded in the given base64 character.
◆ decodeTrits() [2/2]
template<typename OutputIterator >
static void regina::Base64SigEncoding::decodeTrits |
( |
char |
c, |
|
|
OutputIterator |
result |
|
) |
| |
|
inlinestaticinherited |
Decodes a single base64 character into three trits, and returns these using an output iterator.
A trit is either 0, 1 or 2.
The inverse to this routine is encodeTrits(); see that routine for details of the encoding.
- Python
- Not present; instead you can use the variant of this routine that takes one argument and returns a fixed-size array.
- Parameters
-
c | the base64 character to decode. |
result | an output iterator pointing to the location where the resulting trits will be stored; it must be possible to write and advance this iterator at least three times. Each trit will be written as a uint8_t . |
◆ emptySig()
Returns the isomorphism signature of an empty dim-dimensional triangulation.
◆ encode()
template<int dim>
static Signature regina::IsoSigPrintable< dim >::encode |
( |
size_t |
size, |
|
|
size_t |
nFacetActions, |
|
|
const uint8_t * |
facetAction, |
|
|
size_t |
nJoins, |
|
|
const size_t * |
joinDest, |
|
|
const typename Perm< dim+1 >::Index * |
joinGluing |
|
) |
| |
|
static |
Encodes data for a single connected component of a dim-dimensional triangulation.
The description consists of several arrays, describing facets of the top-dimensional simplices, as well as the ways that these facets are glued together. Which array elements represent which facets/gluings is an implementation detail; the purpose of this routine is simply to encode the given information. See the isoSig() implementation for further details.
- Python
- The arrays facetAction, joinDest and joinGluing should each be passed as Python lists of integers. The arguments nFacetActions and nJoins are not present, since Python lists already know their own sizes.
- Parameters
-
size | the number of top-dimensional simplices in the component. |
nFacetActions | the size of the array facetAction. |
facetAction | an array of size nFacetActions, where each element is either 0, 1 or 2, respectively representing a boundary facet, a facet joined to a new simplex, or a facet joined to a simplex that has already been seen. |
nJoins | the size of the arrays joinDest and joinGluing. |
joinDest | an array whose elements are indices of top-dimensional simplices to which gluings are being made. |
joinGluing | an array of gluing permutations. |
- Returns
- the encoding of the component being described.
◆ encodeInt()
template<typename IntType >
static void regina::Base64SigEncoding::encodeInt |
( |
std::string & |
s, |
|
|
IntType |
val, |
|
|
unsigned |
nChars |
|
) |
| |
|
inlinestaticinherited |
Append a base64 encoding of the given integer to the given string.
The integer will be broken into nChars distinct 6-bit blocks, and the lowest-significance blocks will be written first.
The inverse to this routine is decodeInt().
- Precondition
- The given integer val is non-negative, and fits within 6nChars bits.
- Python
- The template argument IntType is taken to be a native C++
long
.
- Template Parameters
-
IntType | a native C++ integer type, such as uint8_t , or unsigned , or long long . |
- Parameters
-
s | the string that resulting characters should be appended to. |
val | the integer to encode. |
nChars | the number of base64 characters to use. |
◆ encodeSingle()
static constexpr char regina::Base64SigEncoding::encodeSingle |
( |
unsigned |
c | ) |
|
|
inlinestaticconstexprinherited |
Determine the base64 character that represents the given integer value.
The inverse to this routine is decodeSingle().
- Parameters
-
c | an integer between 0 and 63 inclusive. |
- Returns
- the corresponding printable base64 character.
◆ encodeTrits() [1/2]
template<int nTrits>
static constexpr char regina::Base64SigEncoding::encodeTrits |
( |
const std::array< uint8_t, nTrits > & |
trits | ) |
|
|
inlinestaticconstexprinherited |
Returns a single base64 character that encodes up to three trits, given using a fixed-size array.
A trit is either 0, 1 or 2.
The given trits will be packed into a single base64 character, with the first trit representing the lowest-significance bits of the underlying integer and so on.
The inverse to this routine is decodeTrits().
- Template Parameters
-
mTrits | the number of trits to encode; this must be between 0 and 3 inclusive. |
- Parameters
-
trits | the array of trits to encode. Each trit must take the value 0, 1 or 2. |
- Returns
- the resulting printable base64 character.
◆ encodeTrits() [2/2]
template<typename InputIterator >
static char regina::Base64SigEncoding::encodeTrits |
( |
InputIterator |
trits, |
|
|
unsigned |
nTrits |
|
) |
| |
|
inlinestaticinherited |
Returns a single base64 character that encodes up to three trits, given using an input iterator.
A trit is either 0, 1 or 2.
The given trits will be packed into a single base64 character, with the first trit representing the lowest-significance bits of the underlying integer and so on.
The inverse to this routine is decodeTrits().
- Python
- Not present; instead you can use the variant of this routine that takes the trits as a fixed-size array.
- Parameters
-
trits | an input iterator pointing to the first trit to encode; it must be possible to read and advance this iterator at least nTrits times. Each trit will be cast to a uint8_t , and must take the value 0, 1 or 2. |
nTrits | the number of trits to encode; this must be at most 3. |
- Returns
- the resulting printable base64 character.
◆ isValid()
static constexpr bool regina::Base64SigEncoding::isValid |
( |
char |
c | ) |
|
|
inlinestaticconstexprinherited |
Is the given character a valid base64 character?
- Returns
true
if and only if the given character is one of the 64 printable characters described in the class notes.
◆ charsPerPerm
Initial value:=
constexpr int bitsRequired(IntType n)
Returns the number of bits required to store integers in the range 0,...,n-1.
Definition: intutils.h:149
The number of characters that we use in our encoding to represent a single gluing permutation.
This must be large enough to encode an index into Perm<dim+1>::Sn.
The documentation for this class was generated from the following file: