Classes | Namespaces | Macros | Functions
pybind11.hpp File Reference
#include <iostream>
#include <pinocchio/fwd.hpp>
#include <pybind11/pybind11.h>
#include <eigenpy/eigenpy.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 124 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 *))

Definition at line 125 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> \
{ \
}; \
} \
}

Defines a conversion used by make_pybind11_function.

Definition at line 111 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 */

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 PyBind11 documentation

Definition at line 207 of file pybind11.hpp.

boost::serialization::load
void load(Archive &ar, Eigen::array< _IndexType, _NumIndices > &a, const unsigned int)
Definition: serialization/eigen.hpp:241
pinocchio::cast
NewScalar cast(const Scalar &value)
Definition: utils/cast.hpp:13
python
PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE
#define PINOCCHIO_PYBIND11_ADD_CONVERT_TYPE(CLASS)
Defines a conversion used by make_pybind11_function.
Definition: pybind11.hpp:111
_SINGLE_ARG
#define _SINGLE_ARG(...)
Defines a set of conversion used by make_pybind11_function.
Definition: pybind11.hpp:124
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:34