5#if REFERENCING_DEBUGGING
8CLASS_DECL_ACME
bool refdbg_add_top_track(
::subparticle* pparticle);
9CLASS_DECL_ACME
void refdbg_erase_top_track(
::subparticle* pparticle);
12CLASS_DECL_ACME::subparticle* refdbg_get_track_allocation();
13CLASS_DECL_ACME::reference_referer* refdbg_get_top_referer();
14CLASS_DECL_ACME::reference_referer* refdbg_get_top_releaser();
16CLASS_DECL_ACME
void __check_refdbg
20#include "acme/prototype/prototype/interlocked_count.h"
21#include "acme/prototype/string/c_string.h"
24CLASS_DECL_ACME ::i64 new_reference_referer_serial();
27class CLASS_DECL_ACME reference_referer
33 ::subparticle * m_psubparticle;
36 ::c::string m_cstringType;
37 ::c::string m_cstringFunctionName;
38 ::c::string m_cstringDebug;
41 static ::i64 new_serial() {
return new_reference_referer_serial(); }
42 reference_referer(const_char_pointer pszType =
nullptr, const_char_pointer pszFunctionName =
nullptr, const_char_pointer pszDebug =
nullptr) :
45 m_psubparticle(nullptr),
47 m_cstringType(pszType),
48 m_cstringFunctionName(pszFunctionName),
49 m_cstringDebug(pszDebug),
50 m_iSerial(new_serial())
54 reference_referer(
const reference_referer & referer) :
57 m_psubparticle(referer.m_psubparticle),
58 m_cstringType(referer.m_cstringType),
59 m_cstringFunctionName(referer.m_cstringFunctionName),
60 m_cstringDebug(referer.m_cstringDebug),
62 m_iSerial(referer.m_iSerial)
66 reference_referer(reference_referer && referer) :
69 m_psubparticle(referer.m_psubparticle),
70 m_cstringType(::transfer(referer.m_cstringType)),
71 m_cstringFunctionName(::transfer(referer.m_cstringFunctionName)),
72 m_cstringDebug(::transfer(referer.m_cstringDebug)),
74 m_iSerial(referer.m_iSerial)
77 referer.m_psubparticle =
nullptr;
78 referer.m_p =
nullptr;
79 referer.m_iSerial = -1;
83 template < prototype_subparticle A_SUBPARTICLE >
85 reference_referer(A_SUBPARTICLE * pparticle, const_char_pointer pszFunctionName =
nullptr, const_char_pointer pszDebug =
nullptr) :
88 m_psubparticle(pparticle),
89 m_cstringType(typeid(*pparticle).name()),
90 m_cstringFunctionName(pszFunctionName),
91 m_cstringDebug(pszDebug),
93 m_iSerial(new_serial())
97 template < non_primitive_subparticle NON_SUBPARTICLE >
99 reference_referer(NON_SUBPARTICLE * p, const_char_pointer pszFunctionName, const_char_pointer pszDebug =
nullptr) :
102 m_psubparticle(nullptr),
103 m_cstringType(typeid(*p).name()),
104 m_cstringFunctionName(pszFunctionName),
105 m_cstringDebug(pszDebug),
107 m_iSerial(new_serial())
119 m_cstringType.destroy();
120 m_cstringFunctionName.destroy();
121 m_cstringDebug.destroy();
122 m_psubparticle =
nullptr;
125 bool operator ==(
const reference_referer & referer)
const
127 return m_iSerial == referer.m_iSerial;
129 void reset(const_char_pointer pszType =
nullptr, const_char_pointer pszFunctionName =
nullptr, const_char_pointer pszDebug =
nullptr)
132 m_cstringType = pszType;
133 m_cstringFunctionName = pszFunctionName;
134 m_cstringDebug = pszDebug;
136 reference_referer & operator=(
const reference_referer & referer)
138 if (
this != &referer)
143 m_psubparticle = referer.m_psubparticle;
144 m_cstringType = referer.m_cstringType;
145 m_cstringFunctionName = referer.m_cstringFunctionName;
146 m_cstringDebug = referer.m_cstringDebug;
148 m_iSerial = referer.m_iSerial;
153 reference_referer & operator =(reference_referer && referer)
noexcept
155 if (
this != &referer)
160 m_psubparticle = referer.m_psubparticle;
161 m_cstringType = ::transfer(referer.m_cstringType);
162 m_cstringFunctionName = ::transfer(referer.m_cstringFunctionName);
163 m_cstringDebug = ::transfer(referer.m_cstringDebug);
166 m_iSerial = referer.m_iSerial;
169 referer.m_psubparticle =
nullptr;
170 referer.m_p =
nullptr;
171 referer.m_iSerial = -1;
176 bool operator!()
const
178 return m_p ==
nullptr && m_psubparticle ==
nullptr;
181 explicit operator bool()
const
183 return !this->operator!();
186 void common_construct();
200#if REFERENCING_DEBUGGING
203 ::reference_referer* m_preferer;
206 __new_site(const ::reference_referer& referer, ::reference_referer** pprefererGet =
nullptr)
209 ASSERT(!::allocator::is_suppressing_referencing_debugging());
211 if (!::allocator::is_suppressing_referencing_debugging())
214 m_preferer = ::allocator::push_referer(referer);
219 *pprefererGet = m_preferer;
240 template < prototype_subparticle T >
241 T* operator << (T* p)
245#if REFERENCING_DEBUGGING
248 p->on_after_construct(m_preferer);
260 template < non_primitive_subparticle T >
261 T * operator << (T * p)
265#if REFERENCING_DEBUGGING
269 ::allocator::__on_after_construct_non_subparticle();
289 bool m_bOldSuppressingReferencingDebugging;
295#if REFERENCING_DEBUGGING
297 m_bOldSuppressingReferencingDebugging = ::allocator::is_suppressing_referencing_debugging();
299 if (!m_bOldSuppressingReferencingDebugging)
302 ::allocator::start_suppressing_referencing_debugging();
311 template < prototype_subparticle T >
312 T* operator << (T* p)
315#if REFERENCING_DEBUGGING
317 if (!m_bOldSuppressingReferencingDebugging)
320 ::allocator::cease_referencing_debugging_suppression();
324 p->on_after_construct(
nullptr);
333 template < non_primitive_subparticle T >
334 T* operator << (T* p)
337#if REFERENCING_DEBUGGING
339 if (!m_bOldSuppressingReferencingDebugging)
342 ::allocator::cease_referencing_debugging_suppression();
346 ::allocator::__on_after_construct_non_subparticle();
358class __new_refdbg_continuation_site
363#if REFERENCING_DEBUGGING
365 ::reference_referer * m_preferencerefererTransferStack;
370 __new_refdbg_continuation_site()
373#if REFERENCING_DEBUGGING
375 if(::allocator::get_top_referer())
378 m_preferencerefererTransferStack = ::allocator::get_top_referer();
387 template < prototype_subparticle T >
388 T* operator << (T* p)
391#if REFERENCING_DEBUGGING
393 p->on_after_construct(
nullptr);
395 p->m_prefererTransfer2 = m_preferencerefererTransferStack;
404 template < non_primitive_subparticle T >
405 T* operator << (T* p)
408#if REFERENCING_DEBUGGING
410 ::allocator::__on_after_construct_non_subparticle();
427#if REFERENCING_DEBUGGING
428 ::reference_referer* m_preferer;
429 __delete_site(::reference_referer * preferer)
431 m_preferer = preferer;
439 template <
typename T >
440 T* operator << (T* p)
442#if REFERENCING_DEBUGGING
443 p->add_referer(m_preferer);
Definition subparticle.h:78