Regina Calculation Engine
|
A template class that references a constant one-dimensional C++ array. More...
#include <python/globalarray.h>
Public Member Functions | |
GlobalArray (const T newData[], size_t newSize) | |
Constructs a new wrapper object for the given C++ array. | |
GlobalArray (const GlobalArray< T, ReturnValuePolicy > &cloneMe) | |
Constructs a new wrapper object that wraps the same C++ array as the given wrapper object. | |
size_t | size () const |
Return the number of elements in this array. | |
const T & | getItem (size_t index) const |
Returns the array element at the given index. | |
const T & | operator[] (size_t index) const |
Returns the array element at the given index. | |
std::ostream & | writeText (std::ostream &out) const |
Writes a string representation of this array, including all of its elements, to the given output stream. | |
Static Public Member Functions | |
static void | wrapClass (const char *className) |
Constructs a Boost.Python wrapper for this class. | |
Friends | |
class | GlobalArray2D< T, ReturnValuePolicy > |
A template class that references a constant one-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 index that is passed.
The ReturnValuePolicy template argument specifies the return value policy for element lookup.
For each different set of template parameters, the corresponding GlobalArray class must be wrapped in Python before the first object of this class is constructed. This wrapping is performed by calling wrapClass().
Note that elements of this array can only be inspected, not modified.
regina::python::GlobalArray< T, ReturnValuePolicy >::GlobalArray | ( | const T | newData[], |
size_t | newSize | ||
) | [inline] |
Constructs a new wrapper object for the given C++ array.
newData | the constant C++ array that is to be wrapped. |
newSize | the number of elements in this C++ array. |
regina::python::GlobalArray< T, ReturnValuePolicy >::GlobalArray | ( | const GlobalArray< T, ReturnValuePolicy > & | cloneMe | ) | [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. |
const T& regina::python::GlobalArray< T, ReturnValuePolicy >::getItem | ( | size_t | index | ) | const [inline] |
Returns the array element at the given index.
If the index is out of range, a Python error will be thrown.
index | the given array index. |
const T& regina::python::GlobalArray< T, ReturnValuePolicy >::operator[] | ( | size_t | index | ) | const [inline] |
Returns the array element at the given index.
If the index is out of range, a Python error will be thrown.
index | the given array index. |
size_t regina::python::GlobalArray< T, ReturnValuePolicy >::size | ( | ) | const [inline] |
Return the number of elements in this array.
static void regina::python::GlobalArray< T, ReturnValuePolicy >::wrapClass | ( | const char * | className | ) | [inline, static] |
Constructs a Boost.Python wrapper for this class.
This routine must be called for each set of template parameters before the first object of this class is constructed.
className | the name that will be assigned to this class in Python. |
std::ostream& regina::python::GlobalArray< T, ReturnValuePolicy >::writeText | ( | std::ostream & | out | ) | const [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. |