Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
PyROOT::PyObjRefCounter Class Referencefinal

A PyObject wrapper to track reference counting of external objects.

This wrapper can be useful in shared ownership scenarios when a C++ object is created on the Python side and there is no easy way to track its ownership on the C++ side. If multiple instances of this class are given the same Python proxy, they will increase/decrease its reference counting following Python rules and ensure proper destruction of the underlying C++ object when no other Python objects are referencing it.

Definition at line 72 of file PyROOTModule.cxx.

Public Member Functions

 PyObjRefCounter (const PyObjRefCounter &other)
 
 PyObjRefCounter (PyObject *object)
 
 PyObjRefCounter (PyObjRefCounter &&other)
 
 ~PyObjRefCounter ()
 
PyObjRefCounteroperator= (const PyObjRefCounter &other)
 
PyObjRefCounteroperator= (PyObjRefCounter &&other)
 

Private Member Functions

void Reset (PyObject *object)
 

Private Attributes

PyObjectfObject {nullptr}
 

Constructor & Destructor Documentation

◆ PyObjRefCounter() [1/3]

PyROOT::PyObjRefCounter::PyObjRefCounter ( PyObject * object)
inline

Definition at line 88 of file PyROOTModule.cxx.

◆ ~PyObjRefCounter()

PyROOT::PyObjRefCounter::~PyObjRefCounter ( )
inline

Definition at line 90 of file PyROOTModule.cxx.

◆ PyObjRefCounter() [2/3]

PyROOT::PyObjRefCounter::PyObjRefCounter ( const PyObjRefCounter & other)
inline

Definition at line 92 of file PyROOTModule.cxx.

◆ PyObjRefCounter() [3/3]

PyROOT::PyObjRefCounter::PyObjRefCounter ( PyObjRefCounter && other)
inline

Definition at line 100 of file PyROOTModule.cxx.

Member Function Documentation

◆ operator=() [1/2]

PyObjRefCounter & PyROOT::PyObjRefCounter::operator= ( const PyObjRefCounter & other)
inline

Definition at line 94 of file PyROOTModule.cxx.

◆ operator=() [2/2]

PyObjRefCounter & PyROOT::PyObjRefCounter::operator= ( PyObjRefCounter && other)
inline

Definition at line 106 of file PyROOTModule.cxx.

◆ Reset()

void PyROOT::PyObjRefCounter::Reset ( PyObject * object)
inlineprivate

Definition at line 75 of file PyROOTModule.cxx.

Member Data Documentation

◆ fObject

PyObject* PyROOT::PyObjRefCounter::fObject {nullptr}
private

Definition at line 73 of file PyROOTModule.cxx.

  • bindings/pyroot/pythonizations/src/PyROOTModule.cxx