Regina 7.0 Calculation Engine
|
A template class that references a constant two-dimensional C++ array. More...
#include <python/globalarray.h>
Public Types | |
using | Row = GlobalArray< T, rvp > |
A wrapper class for each row of this array. More... | |
Public Member Functions | |
template<size_t nCols> | |
GlobalArray2D (const T data[][nCols], size_t nRows) | |
Constructs a new wrapper object for the given 2-dimensional C++ array. More... | |
GlobalArray2D (const T data[], size_t nRows, size_t nCols) | |
Constructs a new 2-dimensional wrapper object for the given 1-dimensional C++ array. More... | |
GlobalArray2D (const GlobalArray2D< T, rvp > &cloneMe) | |
Constructs a new wrapper object that wraps the same C++ array as the given wrapper object. More... | |
~GlobalArray2D () | |
Class destructor. More... | |
size_t | rows () const |
Return the number of rows in this array. More... | |
size_t | cols () const |
Return the number of columns in this array. More... | |
const Row & | getItem (size_t index) const |
Returns the requested row of the array. More... | |
std::ostream & | writeText (std::ostream &out) const |
Writes a string representation of this array, including all of its elements, to the given output stream. More... | |
Static Public Member Functions | |
static void | wrapClass (pybind11::module_ &m, const char *className) |
Constructs a Python wrapper for this class. More... | |
Friends | |
class | GlobalArray3D< T, rvp > |
A template class that references a constant two-dimensional C++ array.
An object of this class can be passed through to Python to allow the user access to the underlying C++ array. For the Python user, the usual list operator [] can be used to access the elements of the array. Range checking is performed on any indices that are passed.
The rvp template argument specifies the return value policy for element lookup.
For each different set of template parameters, the corresponding GlobalArray2D class must be wrapped in Python before the first object of this class is wrapped. This wrapping is performed by calling wrapClass().
Note that elements of this array can only be inspected, not modified.
using regina::python::GlobalArray2D< T, rvp >::Row = GlobalArray<T, rvp> |
A wrapper class for each row of this array.
|
inline |
Constructs a new wrapper object for the given 2-dimensional C++ array.
data | the constant 2-dimensional C++ array that is to be wrapped. |
nRows | the number of rows in this C++ array, i.e., the first array dimension. |
nCols | the number of columns in this C++ array, i.e., the second array dimension. This must be a compile-time constant. |
|
inline |
Constructs a new 2-dimensional wrapper object for the given 1-dimensional C++ array.
If the Python array is to have r rows and columns
, the Python element array[i][j]
will correspond to the C++ element array[(i * c) + j]
.
data | the constant 1-dimensional C++ array that is to be wrapped. |
nRows | the number of rows in the corresponding 2-dimensional array, i.e., the first array dimension. |
nCols | the number of columns in the corresponding 2-dimensional array, i.e., the second array dimension. |
|
inline |
Constructs a new wrapper object that wraps the same C++ array as the given wrapper object.
Note that the same underlying C++ array is referenced, i.e., the C++ array itself is not cloned.
cloneMe | the wrapper object to clone. |
|
inline |
Class destructor.
All of the internal row wrappers are destroyed.
|
inline |
Return the number of columns in this array.
|
inline |
Returns the requested row of the array.
If the row index is out of range, a Python error will be thrown.
index | the index of the requested row. |
|
inline |
Return the number of rows in this array.
|
inlinestatic |
Constructs a Python wrapper for this class.
This routine must be called for each set of template parameters before the first object of this class is wrapped.
m | the Python module in which these wrappers should be installed. |
className | the name that will be assigned to this class in Python. |
|
inline |
Writes a string representation of this array, including all of its elements, to the given output stream.
out | the output stream to which to write. |