HepMC3 event record library
|
#include <pytypes.h>
Public Member Functions | |
handle ()=default | |
The default constructor creates a handle with a nullptr -valued pointer. More... | |
handle (PyObject *ptr) | |
Creates a handle from the given raw Python object pointer. More... | |
PyObject * | ptr () const |
Return the underlying PyObject * pointer. More... | |
PyObject *& | ptr () |
const handle & | inc_ref () const & |
const handle & | dec_ref () const & |
template<typename T > | |
T | cast () const |
operator bool () const | |
Return true when the handle wraps a valid Python object. More... | |
bool | operator== (const handle &h) const |
bool | operator!= (const handle &h) const |
bool | check () const |
Protected Attributes | |
PyObject * | m_ptr = nullptr |
\rst Holds a reference to a Python object (no reference counting) The `handle` class is a thin wrapper around an arbitrary Python object (i.e. a ``PyObject *`` in Python's C API). It does not perform any automatic reference counting and merely provides a basic C++ interface to various Python API functions. .. seealso:: The `object` class inherits from `handle` and adds automatic reference counting features.
|
default |
The default constructor creates a handle with a nullptr
-valued pointer.
|
inline |
T cast | ( | ) | const |
\rst Attempt to cast the Python object into the given C++ type. A `cast_error` will be throw upon failure.
|
inline |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |