42 ObjectMap_t::iterator ppo = fObjectMap.find(cppobj);
43 if (ppo == fObjectMap.end()) {
44 fObjectMap.insert({cppobj, klass});
62 ObjectMap_t::iterator ppo = fObjectMap.find(cppobj);
63 if (ppo != fObjectMap.end()) {
64 fObjectMap.erase(ppo);
80 ObjectMap_t::iterator ppo = fObjectMap.find(cppobj);
81 if (ppo != fObjectMap.end()) {
83 MemoryRegulator::RecursiveRemove(cppobj, klass);
84 fObjectMap.erase(ppo);
92 while (!fObjectMap.empty()) {
93 auto elem = fObjectMap.begin();
94 auto cppobj = elem->first;
95 auto klassid = elem->second;
97 auto pyobj = (
CPPInstance *)MemoryRegulator::RetrievePyObject(cppobj, pyclass);
99 if (pyobj && (pyobj->fFlags & CPPInstance::kIsOwner)) {
103 auto o =
static_cast<TObject *
>(cppobj);
104 bool isValue = pyobj->fFlags & CPPInstance::kIsValue;
112 MemoryRegulator::UnregisterPyObject(pyobj, pyclass);
static std::pair< bool, bool > RegisterHook(Cppyy::TCppObject_t, Cppyy::TCppType_t)
Register a hook that Cppyy runs when constructing an object.
TMemoryRegulator()
Constructor.
virtual void RecursiveRemove(TObject *)
Get the class id of the TObject being deleted and run Cppyy's RecursiveRemove.
static ObjectMap_t fObjectMap
void ClearProxiedObjects()
Clean up all tracked objects.
static std::pair< bool, bool > UnregisterHook(Cppyy::TCppObject_t, Cppyy::TCppType_t)
Register a hook that Cppyy runs when deleting an object.
Mother of all ROOT objects.
PyObject * CreateScopeProxy(Cppyy::TCppScope_t)
RPY_EXPORTED bool IsSubtype(TCppType_t derived, TCppType_t base)
RPY_EXPORTED TCppScope_t GetScope(const std::string &scope_name)
std::unordered_map< Cppyy::TCppObject_t, Cppyy::TCppType_t > ObjectMap_t