Drake
Drake C++ Documentation
wrap_pybind.h File Reference

Detailed Description

Defines convenience utilities to wrap pybind11 methods and classes.

#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include "drake/bindings/pydrake/common/wrap_function.h"
#include "drake/bindings/pydrake/pydrake_pybind.h"
#include "drake/common/copyable_unique_ptr.h"
#include "drake/common/drake_copyable.h"
Include dependency graph for wrap_pybind.h:
This graph shows which files directly or indirectly include this file:

Namespaces

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

Functions

template<typename Func >
auto WrapCallbacks (Func &&func)
 Ensures that any std::function<> arguments are wrapped such that any T& (which can infer for T = const U) is wrapped as U* (and conversely unwrapped when returned). More...
 
template<typename PyClass , typename Class , typename T >
void DefReadWriteKeepAlive (PyClass *cls, const char *name, T Class::*member, const char *doc="")
 Idempotent to pybind11's def_readwrite(), with the exception that the setter is protected with keep_alive on a member variable that is a bare pointer. More...
 
template<typename PyClass , typename Class , typename T >
void DefReadUniquePtr (PyClass *cls, const char *name, const std::unique_ptr< T > Class::*member, const char *doc="")
 Idempotent to pybind11's def_readonly(), which works for unique_ptr elements; the getter is protected with keep_alive on a member variable that is a unique_ptr. More...
 
template<typename PyClass , typename Class , typename T >
void DefReadUniquePtr (PyClass *cls, const char *name, const copyable_unique_ptr< T > Class::*member, const char *doc="")