Classes | Namespaces | Macros | Functions
pybind11.hpp File Reference
#include <iostream>
#include <pinocchio/fwd.hpp>
#include <pybind11/pybind11.h>
#include <boost/python.hpp>
Include dependency graph for pybind11.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pinocchio::python::internal::function_wrapper< R(*)(Args...)>::arg< i >
 
struct  pinocchio::python::convert_boost_python_object< T >
 
struct  pinocchio::python::convert_type< T >
 
struct  pinocchio::python::convert_type< void >
 
struct  pinocchio::python::internal::function_wrapper< T >
 
struct  pinocchio::python::internal::function_wrapper< R(*)(Args...)>
 

Namespaces

 pinocchio
 Main pinocchio namespace.
 
 pinocchio::python
 
 pinocchio::python::internal
 

Macros

#define _SINGLE_ARG(...)   __VA_ARGS__
 Defines a set of conversion used by make_pybind11_function. More...
 
#define PINOCCHIO_PYBIND11_ADD_ALL_CONVERT_TYPE(CLASS)
 
#define PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE(CLASS)
 Defines a conversion used by make_pybind11_function. More...
 
#define PINOCCHIO_PYBIND11_TYPE_CASTER(native_type, boost_python_name)
 Add a PyBind11 type caster. More...
 

Functions

template<typename R , typename... Args>
auto pinocchio::python::internal::call (R(*f)(Args...), typename convert_type< Args >::type... args)
 
template<typename... Args>
void pinocchio::python::internal::call (void(*f)(Args...), typename convert_type< Args >::type... args)
 
template<typename T >
py::object pinocchio::python::default_arg (T t)
 
template<typename ReturnType >
ReturnType & pinocchio::python::from (py::handle model)
 
template<typename R , typename... Args>
internal::function_wrapper< R(*)(Args...)> pinocchio::python::make_pybind11_function (R(*func)(Args...))
 Creates a function wrapper. More...
 
template<typename T >
py::object pinocchio::python::to (T &t)
 
template<typename T >
py::object pinocchio::python::to (T *t)
 

Macro Definition Documentation

◆ _SINGLE_ARG

#define _SINGLE_ARG (   ...)    __VA_ARGS__

Defines a set of conversion used by make_pybind11_function.

Definition at line 106 of file pybind11.hpp.

◆ PINOCCHIO_PYBIND11_ADD_ALL_CONVERT_TYPE

#define PINOCCHIO_PYBIND11_ADD_ALL_CONVERT_TYPE (   CLASS)
Value:
PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE(_SINGLE_ARG(CLASS const)) \
PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE(_SINGLE_ARG(CLASS&)) \
PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE(_SINGLE_ARG(CLASS const&)) \
PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE(_SINGLE_ARG(CLASS*)) \
PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE(_SINGLE_ARG(CLASS const*))
#define _SINGLE_ARG(...)
Defines a set of conversion used by make_pybind11_function.
Definition: pybind11.hpp:106
#define PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE(CLASS)
Defines a conversion used by make_pybind11_function.
Definition: pybind11.hpp:97

Definition at line 107 of file pybind11.hpp.

◆ PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE

#define PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE (   CLASS)
Value:
namespace pinocchio { \
namespace python { \
template <> \
struct convert_type<CLASS> : convert_boost_python_object<CLASS> {}; \
} \
}
Main pinocchio namespace.
Definition: timings.cpp:28

Defines a conversion used by make_pybind11_function.

Definition at line 97 of file pybind11.hpp.

◆ PINOCCHIO_PYBIND11_TYPE_CASTER

#define PINOCCHIO_PYBIND11_TYPE_CASTER (   native_type,
  boost_python_name 
)
Value:
namespace pybind11 { \
namespace detail { \
template <> \
struct type_caster<native_type> { \
PYBIND11_TYPE_CASTER(_SINGLE_ARG(native_type), boost_python_name); \
\
/* Python -> C++ */ \
bool load(pybind11::handle src, bool) { \
PyObject* source = src.ptr(); \
value = boost::python::extract<native_type>(source); \
return !PyErr_Occurred(); \
} \
/* C++ -> Python */ \
static pybind11::handle cast(native_type src, \
pybind11::return_value_policy /*policy*/, \
pybind11::handle /*parent*/) { \
return boost::python::api::object(src).ptr(); \
} \
}; \
} /* namespace detail */ \
} /* namespace pybind11 */
NewScalar cast(const Scalar &value)
Definition: cast.hpp:13
def load(name, display=False, rootNodeName="")
#define _SINGLE_ARG(...)
Defines a set of conversion used by make_pybind11_function.
Definition: pybind11.hpp:106

Add a PyBind11 type caster.

Using type caster has the advantage of not requiring to wrap the exposed functions but the disadvantage of systematically requiring a copy.

See https://pybind11.readthedocs.io/en/stable/advanced/cast/custom.html "PyBind11 documentation"

Definition at line 182 of file pybind11.hpp.



pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:33