GEOSX
Public Member Functions | 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...
 

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.

Definition at line 62 of file PyFunc.hpp.

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.

Definition at line 70 of file PyFunc.hpp.

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.

Definition at line 80 of file PyFunc.hpp.


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