HepMC3 event record library
|
Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object. More...
#include <pybind11.h>
Public Member Functions | |
cpp_function (std::nullptr_t) | |
template<typename Return , typename... Args, typename... Extra> | |
cpp_function (Return(*f)(Args...), const Extra &...extra) | |
Construct a cpp_function from a vanilla function pointer. More... | |
template<typename Func , typename... Extra, typename = detail::enable_if_t<detail::is_lambda<Func>::value>> | |
cpp_function (Func &&f, const Extra &...extra) | |
Construct a cpp_function from a lambda function (possibly with internal state) More... | |
template<typename Return , typename Class , typename... Arg, typename... Extra> | |
cpp_function (Return(Class::*f)(Arg...), const Extra &...extra) | |
Construct a cpp_function from a class method (non-const, no ref-qualifier) More... | |
template<typename Return , typename Class , typename... Arg, typename... Extra> | |
cpp_function (Return(Class::*f)(Arg...)&, const Extra &...extra) | |
template<typename Return , typename Class , typename... Arg, typename... Extra> | |
cpp_function (Return(Class::*f)(Arg...) const, const Extra &...extra) | |
Construct a cpp_function from a class method (const, no ref-qualifier) More... | |
template<typename Return , typename Class , typename... Arg, typename... Extra> | |
cpp_function (Return(Class::*f)(Arg...) const &, const Extra &...extra) | |
object | name () const |
Return the function name. More... | |
handle | cpp_function () const |
bool | is_cpp_function () const |
PYBIND11_DEPRECATED ("Use reinterpret_borrow<object>() or reinterpret_steal<object>()") object(handle h | |
handle | release () |
template<typename T > | |
T | cast () const & |
template<typename T > | |
T | cast ()&& |
PyObject * | ptr () const |
Return the underlying PyObject * pointer. More... | |
PyObject *& | ptr () |
const handle & | inc_ref () const & |
const handle & | dec_ref () 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 |
Data Fields | |
bool | is_borrowed: handle(h) { if (is_borrowed) inc_ref() |
Protected Member Functions | |
PYBIND11_NOINLINE detail::function_record * | make_function_record () |
Space optimization: don't inline this frequently instantiated fragment. More... | |
template<typename Func , typename Return , typename... Args, typename... Extra> | |
void | initialize (Func &&f, Return(*)(Args...), const Extra &...extra) |
Special internal constructor for functors, lambda functions, etc. More... | |
void | initialize_generic (detail::function_record *rec, const char *text, const std::type_info *const *types, size_t args) |
Register a function call with Python (generic non-templated code goes here) More... | |
Static Protected Member Functions | |
static void | destruct (detail::function_record *rec) |
When a cpp_function is GCed, release any memory allocated by pybind11. More... | |
static PyObject * | dispatcher (PyObject *self, PyObject *args_in, PyObject *kwargs_in) |
Main dispatch logic for calls to functions bound using pybind11. More... | |
Protected Attributes | |
PyObject * | m_ptr = nullptr |
Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object.
Definition at line 62 of file pybind11.h.
|
inline |
Construct a cpp_function from a vanilla function pointer.
Definition at line 69 of file pybind11.h.
|
inline |
Construct a cpp_function from a lambda function (possibly with internal state)
Definition at line 76 of file pybind11.h.
|
inline |
Construct a cpp_function from a class method (non-const, no ref-qualifier)
Definition at line 83 of file pybind11.h.
|
inline |
Construct a cpp_function from a class method (non-const, lvalue ref-qualifier) A copy of the overload for non-const functions without explicit ref-qualifier but with an added &
.
Definition at line 92 of file pybind11.h.
|
inline |
Construct a cpp_function from a class method (const, no ref-qualifier)
Definition at line 99 of file pybind11.h.
|
inline |
Construct a cpp_function from a class method (const, lvalue ref-qualifier) A copy of the overload for const functions without explicit ref-qualifier but with an added &
.
Definition at line 108 of file pybind11.h.
|
inlineinherited |
|
inlinestaticprotected |
When a cpp_function is GCed, release any memory allocated by pybind11.
Definition at line 455 of file pybind11.h.
|
inlinestaticprotected |
Main dispatch logic for calls to functions bound using pybind11.
Definition at line 492 of file pybind11.h.
References function_record::args, argument_record::convert, instance::get_value_and_holder(), function_record::has_args, function_record::has_kwargs, function_record::impl, handle::inc_ref(), function_record::is_method, function_record::is_new_style_constructor, argument_record::name, function_record::nargs, function_record::nargs_kw_only, function_record::nargs_pos_only, function_record::next, argument_record::none, handle::ptr(), object::release(), and error_already_set::restore().
|
inlineinherited |
|
inlineprotected |
Special internal constructor for functors, lambda functions, etc.
Definition at line 124 of file pybind11.h.
|
inlineprotected |
Register a function call with Python (generic non-templated code goes here)
Definition at line 227 of file pybind11.h.
References handle::cast().
|
inlineprotected |
Space optimization: don't inline this frequently instantiated fragment.
Definition at line 118 of file pybind11.h.
Return the function name.
Definition at line 114 of file pybind11.h.
|
inlineexplicitinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
\rst Resets the internal pointer to ``nullptr`` without decreasing the object's reference count. The function returns a raw handle to the original Python object.
Definition at line 249 of file pytypes.h.
References handle::handle().