Drake
Drake C++ Documentation
Object Class Reference

Detailed Description

Provides a publicly visible, but minimal, re-implementation of py::object so that a public type can be used with drake::Value<T>, while still maintaining the revelant semantics with its generic implementation (#13207).

This should only be used in place of py::object for public APIs that rely on RTTI (e.g. typeid). See implementation of class object in pybind11/include/pybind11/pytypes.h.

#include <drake/bindings/pydrake/common/cpp_param_pybind.h>

Public Member Functions

 Object ()
 
 ~Object ()
 Decrements reference count (if pointing to a real object). More...
 
 Object (::PyObject *ptr)
 Constructs from raw pointer, incrementing the reference count. More...
 
 Object (const Object &other)
 Constructs from another Object, incrementing the reference count. More...
 
 Object (Object &&other)
 Steals object (and reference count) from another Object. More...
 
Objectoperator= (const Object &other)
 Copies object reference and increments reference count. More...
 
Objectoperator= (Object &&other)
 Steals object (and reference count) from another Object. More...
 
::PyObject * ptr () const
 Accesses raw PyObject pointer (no reference counting). More...
 
template<typename T >
to_pyobject () const
 Converts to a pybind11 Python type, using py::reinterpret_borrow. More...
 
Object Clone () const
 Provides a deep copy of the referred-to object. More...
 

Static Public Member Functions

template<typename T >
static Object from_pyobject (const T &h)
 Converts from a pybind11 Python type, using py::reinterpret_borrow. More...
 

Constructor & Destructor Documentation

◆ Object() [1/4]

Object ( )

◆ ~Object()

~Object ( )

Decrements reference count (if pointing to a real object).

◆ Object() [2/4]

Object ( ::PyObject *  ptr)
explicit

Constructs from raw pointer, incrementing the reference count.

Note
This does not implement any of the py::reinterpret_borrow<> semantics.

◆ Object() [3/4]

Object ( const Object other)
explicit

Constructs from another Object, incrementing the reference count.

◆ Object() [4/4]

Object ( Object &&  other)

Steals object (and reference count) from another Object.

Member Function Documentation

◆ Clone()

Object Clone ( ) const

Provides a deep copy of the referred-to object.

◆ from_pyobject()

static Object from_pyobject ( const T &  h)
static

Converts from a pybind11 Python type, using py::reinterpret_borrow.

◆ operator=() [1/2]

Object& operator= ( const Object other)

Copies object reference and increments reference count.

◆ operator=() [2/2]

Object& operator= ( Object &&  other)

Steals object (and reference count) from another Object.

◆ ptr()

::PyObject* ptr ( ) const

Accesses raw PyObject pointer (no reference counting).

◆ to_pyobject()

T to_pyobject ( ) const

Converts to a pybind11 Python type, using py::reinterpret_borrow.


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