Drake
pydrake_pybind.h File Reference
#include <utility>
#include "pybind11/pybind11.h"
Include dependency graph for pydrake_pybind.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  overload_cast_impl< Return, Args >
 

Namespaces

 drake
 
 drake::pydrake
 For more high-level information, see the Python Bindings technical notes.
 

Macros

#define PYDRAKE_PREVENT_PYTHON3_MODULE_REIMPORT(variable)
 

Typedefs

using py_rvp = py::return_value_policy
 Shortened alias for py::return_value_policy. More...
 

Functions

py::object py_keep_alive (py::object nurse, py::object patient)
 Use this when you must do manual casting - e.g. More...
 
template<typename PyType >
PyType py_keep_alive_iterable (PyType nurses, py::object patient)
 Use this to manually cast an iterable type (e.g. More...
 
template<typename PyClass >
void DefCopyAndDeepCopy (PyClass *ppy_class)
 Binds Pythonic __copy__ and __deepcopy__ using class's copy constructor. More...
 
template<typename PyClass >
void DefClone (PyClass *ppy_class)
 Binds Pythonic __copy__ and __deepcopy__ for a class, as well as Clone method, using class's Clone method rather than the copy constructor. More...
 
template<typename Class >
auto ParamInit ()
 Returns a constructor for creating an instance of Class and initializing parameters (bound using def_readwrite). More...
 
void ExecuteExtraPythonCode (py::module m)
 Executes Python code to introduce additional symbols for a given module. More...
 

Variables

template<typename Return , typename... Args>
constexpr auto overload_cast_explicit = overload_cast_impl<Return, Args...>{}
 Provides option to provide explicit signature when py::overload_cast<Args...> fails to infer the Return argument. More...
 

Macro Definition Documentation

◆ PYDRAKE_PREVENT_PYTHON3_MODULE_REIMPORT

#define PYDRAKE_PREVENT_PYTHON3_MODULE_REIMPORT (   variable)
Value:
{ \
static py::handle variable##_original; \
if (variable##_original) { \
variable##_original.inc_ref(); \
variable = py::reinterpret_borrow<py::module>(variable##_original); \
return; \
} else { \
variable##_original = variable; \
} \
}