|
LvArray
|
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... | |
Private Attributes | |
| T * | m_object = nullptr |
| A pointer to the manged object. | |
A class that manages an owned Python reference with RAII semantics.
| T | The type of the managed object, must be castable to a PyObject. |
|
inline |
Take ownership of a reference to src.
| src | The object to be referenced. |
|
inline |
Create a new reference to src.
| src | The object to create a new reference to. |
|
inline |
Steal a reference from src.
| src | The object to steal a reference to. |
|
inline |
Return a pointer to the managed object.
|
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.
|
inline |
Conversion operator to a T *.
|
inline |
Create a new reference to src.
| src | The object to create a new reference to. |
|
inline |
Steal a reference from src.
| src | The object to steal a reference to. |
|
inline |
Decrease the reference count to the current object and take ownership of a new reference.
| src | The new object to be referenced. |
|
inline |
Return the address of the managed object and release ownership.
Useful for functions which return a PyObject *.
1.8.13