Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MemoryRegulator.h
Go to the documentation of this file.
1#ifndef CPYCPPYY_MEMORYREGULATOR_H
2#define CPYCPPYY_MEMORYREGULATOR_H
3
4#include <functional>
5#include <utility>
6
7namespace CPyCppyy {
8
9class CPPInstance;
10
11typedef std::function<std::pair<bool, bool>(Cppyy::TCppObject_t, Cppyy::TCppType_t)> MemHook_t;
12
14private:
16
17public:
19
20// callback from C++-side frameworks
21 static bool RecursiveRemove(Cppyy::TCppObject_t cppobj, Cppyy::TCppType_t klass);
22
23// called when a new python proxy object is created
24 static bool RegisterPyObject(CPPInstance* pyobj, void* cppobj);
25
26// called when a the python proxy object is about to be garbage collected or when it is
27// about to delete the proxied C++ object, if owned
28 static bool UnregisterPyObject(CPPInstance* pyobj, PyObject* pyclass);
29
30// new reference to python object matching cppobj, or 0 on failure
31 static PyObject* RetrievePyObject(Cppyy::TCppObject_t cppobj, PyObject* pyclass);
32
33// set hooks for custom memory regulation
34 static void SetRegisterHook(MemHook_t h);
35 static void SetUnregisterHook(MemHook_t h);
36};
37
38} // namespace CPyCppyy
39
40#endif // !CPYCPPYY_MEMORYREGULATOR_H
_object PyObject
#define h(i)
Definition RSha256.hxx:106
static MemHook_t unregisterHook
static bool RecursiveRemove(Cppyy::TCppObject_t cppobj, Cppyy::TCppType_t klass)
static PyObject * RetrievePyObject(Cppyy::TCppObject_t cppobj, PyObject *pyclass)
static bool RegisterPyObject(CPPInstance *pyobj, void *cppobj)
static MemHook_t registerHook
static void SetUnregisterHook(MemHook_t h)
static void SetRegisterHook(MemHook_t h)
static bool UnregisterPyObject(CPPInstance *pyobj, PyObject *pyclass)
std::function< std::pair< bool, bool >(Cppyy::TCppObject_t, Cppyy::TCppType_t)> MemHook_t
void * TCppObject_t
Definition cpp_cppyy.h:21
TCppScope_t TCppType_t
Definition cpp_cppyy.h:19