GEOSX
|
A class that manages an owned Python reference with RAII semantics. More...
#include <pythonHelpers.hpp>
Public Member Functions | |
PyObjectRef ()=default | |
Create an uninitialized (nullptr) reference. | |
PyObjectRef (T *const src) | |
Take ownership of a reference to src . More... | |
PyObjectRef (PyObjectRef const &src) | |
Create a new reference to src . More... | |
PyObjectRef (PyObjectRef &&src) | |
Steal a reference from src . More... | |
~PyObjectRef () | |
Destructor, decreases the reference count. | |
PyObjectRef & | operator= (PyObjectRef const &src) |
Create a new reference to src . More... | |
PyObjectRef & | operator= (PyObjectRef &&src) |
Steal a reference from src . More... | |
PyObjectRef & | operator= (PyObject *src) |
Decrease the reference count to the current object and take ownership of a new reference. More... | |
operator T* () | |
Conversion operator to a T *. More... | |
T * | get () const |
Return a pointer to the managed object. More... | |
T ** | getAddress () |
Return the address of the pointer to the manged object. More... | |
T * | release () |
Return the address of the managed object and release ownership. More... | |
A class that manages an owned Python reference with RAII semantics.
T | The type of the managed object, must be castable to a PyObject. |
Definition at line 144 of file pythonHelpers.hpp.
|
inline |
Take ownership of a reference to src
.
src | The object to be referenced. |
Definition at line 158 of file pythonHelpers.hpp.
|
inline |
Create a new reference to src
.
src | The object to create a new reference to. |
Definition at line 167 of file pythonHelpers.hpp.
|
inline |
Steal a reference from src
.
src | The object to steal a reference to. |
Definition at line 175 of file pythonHelpers.hpp.
|
inline |
Return a pointer to the managed object.
Definition at line 235 of file pythonHelpers.hpp.
|
inline |
Return the address of the pointer to the manged object.
Useful for functions which take a PyObject** as an output parameter and fill it with a new reference.
Definition at line 244 of file pythonHelpers.hpp.
|
inline |
Conversion operator to a T *.
Definition at line 228 of file pythonHelpers.hpp.
|
inline |
Create a new reference to src
.
src | The object to create a new reference to. |
Definition at line 190 of file pythonHelpers.hpp.
|
inline |
Steal a reference from src
.
src | The object to steal a reference to. |
Definition at line 203 of file pythonHelpers.hpp.
|
inline |
Decrease the reference count to the current object and take ownership of a new reference.
src | The new object to be referenced. |
Definition at line 216 of file pythonHelpers.hpp.
|
inline |
Return the address of the managed object and release ownership.
Useful for functions which return a PyObject *.
Definition at line 252 of file pythonHelpers.hpp.