24 #ifndef LSST_UTILS_PYTHON_PYSHAREDPTR_H 25 #define LSST_UTILS_PYTHON_PYSHAREDPTR_H 27 #include "pybind11/pybind11.h" 62 PyObject* pyObj = pybind11::cast(ptr).ptr();
66 if (obj !=
nullptr) Py_DECREF(obj);
81 T*
get()
const noexcept {
return _impl.
get(); }
~PySharedPtr() noexcept=default
PySharedPtr & operator=(PySharedPtr const &) noexcept=default
Forward declarations for lsst::utils::Cache.
PySharedPtr(T *const ptr)
Create a pointer that counts as an extra reference in the Python environment.
PySharedPtr(std::shared_ptr< T > r) noexcept
PYBIND11_DECLARE_HOLDER_TYPE(T, lsst::utils::python::PySharedPtr< T >)
A shared pointer that tracks both a C++ object and its associated PyObject.