LvArray
Public Member Functions | Private Attributes | List of all members
LvArray::python::PythonFunction< ARGS > Class Template Reference

A C++ functor wrapper around a Python function. More...

#include <PyFunc.hpp>

Public Member Functions

 PythonFunction (PyObject *pyfunc)
 create a PythonFunction around pyfunc. More...
 
void operator() (ARGS ... args)
 Call the Python function with arguments args. More...
 

Private Attributes

PyObjectRef m_function
 A reference to the wrapped python function.
 

Detailed Description

template<typename ... ARGS>
class LvArray::python::PythonFunction< ARGS >

A C++ functor wrapper around a Python function.

Template Parameters
ARGSA variadic parameter pack of types to call the function with.

Constructor & Destructor Documentation

◆ PythonFunction()

template<typename ... ARGS>
LvArray::python::PythonFunction< ARGS >::PythonFunction ( PyObject *  pyfunc)
inline

create a PythonFunction around pyfunc.

Parameters
pyfuncthe Python function to wrap, a new reference is created.

Member Function Documentation

◆ operator()()

template<typename ... ARGS>
void LvArray::python::PythonFunction< ARGS >::operator() ( ARGS ...  args)
inline

Call the Python function with arguments args.

Parameters
argsThe arguments to call the function with.
Note
throws a PythonError (a C++ exception) if the args cannot be converted to Python objects or if the Python function raises an exception.

The documentation for this class was generated from the following file: