SourceXtractorPlusPlus
0.14
Please provide a description of the project.
|
Hold a reference to a Python object. More...
Public Member Functions | |
PyObjectHolder (py::object &&obj) | |
PyObjectHolder (const PyObjectHolder &)=default | |
PyObjectHolder (PyObjectHolder &&)=default | |
operator const py::object & () const | |
const py::object & | operator* () const |
py::object | attr (const char *name) |
Private Attributes | |
std::shared_ptr< py::object > | m_obj_ptr |
Hold a reference to a Python object.
A boost::python::object contains a pointer to the underlying Python struct, which is copied as-is (shared) when copied. When the boost::python::object is destroyed, it checks, and then decrements, the reference count. This destruction is not thread safe, as the pointer is not protected by a mutex or anything. This class holds a single reference to the Python object, and relies on the mechanism of std::shared_ptr to destroy the object once there is no one using it. std::shared_ptr is thread safe, unlike boost::python::object.
Definition at line 81 of file ModelFittingConfig.cpp.
|
inline |
Definition at line 83 of file ModelFittingConfig.cpp.
References std::make_shared().
|
default |
|
default |
|
inline |
Definition at line 96 of file ModelFittingConfig.cpp.
|
inline |
Definition at line 88 of file ModelFittingConfig.cpp.
|
inline |
Definition at line 92 of file ModelFittingConfig.cpp.
|
private |
Definition at line 101 of file ModelFittingConfig.cpp.