MCPcopy Create free account
hub / github.com/Vector35/debugger / DbgRef

Class DbgRef

core/refcountobject.h:51–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50 template <class T>
51 class DbgRef
52 {
53 T* m_obj;
54#ifdef BN_REF_COUNT_DEBUG
55 void* m_assignmentTrace = nullptr;
56#endif
57
58 public:
59 DbgRef<T>() : m_obj(NULL) {}
60
61 DbgRef<T>(T* obj) : m_obj(obj)
62 {
63 if (m_obj)
64 {
65 m_obj->AddRef();
66#ifdef BN_REF_COUNT_DEBUG
67 m_assignmentTrace = BNRegisterObjectRefDebugTrace(typeid(T).name());
68#endif
69 }
70 }
71
72 DbgRef<T>(const DbgRef<T>& obj) : m_obj(obj.m_obj)
73 {
74 if (m_obj)
75 {
76 m_obj->AddRef();
77#ifdef BN_REF_COUNT_DEBUG
78 m_assignmentTrace = BNRegisterObjectRefDebugTrace(typeid(T).name());
79#endif
80 }
81 }
82
83 ~DbgRef<T>()
84 {
85 if (m_obj)
86 {
87 m_obj->Release();
88#ifdef BN_REF_COUNT_DEBUG
89 BNUnregisterObjectRefDebugTrace(typeid(T).name(), m_assignmentTrace);
90#endif
91 }
92 }
93
94 // move constructor

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected