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

Class DbgRef

api/debuggerapi.h:116–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115 template <class T>
116 class DbgRef
117 {
118 T* m_obj;
119#ifdef BN_REF_COUNT_DEBUG
120 void* m_assignmentTrace = nullptr;
121#endif
122
123 public:
124 DbgRef<T>() : m_obj(NULL) {}
125
126 DbgRef<T>(T* obj) : m_obj(obj)
127 {
128 if (m_obj)
129 {
130 m_obj->AddRef();
131#ifdef BN_REF_COUNT_DEBUG
132 m_assignmentTrace = BNRegisterObjectRefDebugTrace(typeid(T).name());
133#endif
134 }
135 }
136
137 DbgRef<T>(const DbgRef<T>& obj) : m_obj(obj.m_obj)
138 {
139 if (m_obj)
140 {
141 m_obj->AddRef();
142#ifdef BN_REF_COUNT_DEBUG
143 m_assignmentTrace = BNRegisterObjectRefDebugTrace(typeid(T).name());
144#endif
145 }
146 }
147
148 DbgRef<T>(DbgRef<T>&& other) : m_obj(other.m_obj)
149 {
150 other.m_obj = 0;
151#ifdef BN_REF_COUNT_DEBUG
152 m_assignmentTrace = other.m_assignmentTrace;
153#endif
154 }
155
156 ~DbgRef<T>()
157 {
158 if (m_obj)
159 {
160 m_obj->Release();
161#ifdef BN_REF_COUNT_DEBUG
162 BNUnregisterObjectRefDebugTrace(typeid(T).name(), m_assignmentTrace);
163#endif
164 }
165 }
166
167 DbgRef<T>& operator=(const Ref<T>& obj)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected