7 #ifndef __core_Protectable_h__ 8 #define __core_Protectable_h__ 10 #define FE_PROTECTED_DEBUG FALSE 11 #define FE_CP_DEBUG FALSE 13 #define FE_PROTECTED_MT TRUE 16 #define SAFEGUARD_PROTECTED \ 17 RecursiveMutex::Guard __fe_thread_safeguard(m_counted_mutex) 19 #define SAFEGUARD_PROTECTED 34 virtual I32 protection(
void)
const 36 #if FE_PROTECTED_DEBUG 37 feLog(
"Protectable::protection" 38 " %p SAFEGUARD_PROTECTED\n",
this);
41 FEASSERT(m_protection>=0);
44 virtual void protect(
void)
46 #if FE_PROTECTED_DEBUG 47 feLog(
"Protectable::protect" 48 " %p SAFEGUARD_PROTECTED\n",
this);
51 FEASSERT(m_protection>=0);
54 virtual void unprotect(
void)
56 #if FE_PROTECTED_DEBUG 57 feLog(
"Protectable::unprotect" 58 " %p SAFEGUARD_PROTECTED\n",
this);
62 FEASSERT(m_protection>=0);
74 mutable RecursiveMutex m_counted_mutex;
96 cp(
void):
sp<T>(), m_protection(0)
99 feLog(
"cp< %s >::cp\n",FE_TYPESTRING(T));
102 explicit cp(T* pT):
sp<T>(pT), m_protection(0)
105 feLog(
"cp< %s >::cp(T*) %p\n",pT,FE_TYPESTRING(T));
111 feLog(
"cp< %s >::cp(const cp<T>&) %p\n",
112 FE_TYPESTRING(T),rcpT.raw());
118 feLog(
"cp< %s >::cp(const sp<T>&) %p\n",
119 FE_TYPESTRING(T),rspT.raw());
123 cp(
const cp<X>& rcpX):
sp<T>(rcpX), m_protection(0)
126 feLog(
"cp< %s >::cp(const cp<X>&) %p\n",
127 FE_TYPESTRING(T),rcpX.raw());
131 cp(
const sp<X>& rspX):
sp<T>(rspX), m_protection(0)
134 feLog(
"cp< %s >::cp(const sp<X>&) %p\n",
135 FE_TYPESTRING(T),rspX.raw());
139 cp(
const hp<X>& rhpX):
sp<T>(rhpX), m_protection(0)
142 feLog(
"cp< %s >::cp(const hp<X>&) %p\n",
143 FE_TYPESTRING(T),rhpX.
raw());
151 feLog(
"cp< %s >::~cp %p %d\n",
157 cp<T> &operator=(T* pT)
160 feLog(
"cp< %s >::operator=(T*) %p -> %p\n",
173 feLog(
"cp< %s >::operator=(const cp<T>) %p -> %p\n",
186 feLog(
"cp< %s >::operator=(const sp<T>& rspT) %p -> %p\n",
200 feLog(
"cp< %s >::operator=(const cp<X>& rcpX) %p -> %p\n",
211 feLog(
"cp< %s >::operator=(const sp<X>& rspX) %p -> %p\n",
222 feLog(
"cp< %s >::operator=(const hp<X>& rhpX) %p -> %p\n",
230 const T* operator->(
void)
const 235 const T* raw(
void)
const 243 feLog(
"cp< %s >::writable %p %d\n",
249 U32 reprotect=m_protection;
263 I32 protection(
void)
const 264 { FEASSERT(m_protection>=0);
265 return m_protection; }
269 feLog(
"cp< %s >::protect %p %d\n",
272 FEASSERT(m_protection>=0);
282 feLog(
"cp< %s >::unprotect %p %d\n",
290 FEASSERT(m_protection>=0);
294 void releaseProtection(
void)
297 feLog(
"cp< %s >::releaseProtection %p %d\n",
311 virtual void track(
void)
Heap-based support for classes participating in fe::ptr <>
Definition: Counted.h:35
Base class providing protection counting for cp<>
Definition: Protectable.h:28
kernel
Definition: namespace.dox:3
Safe handle for shared pointer.
Definition: Handled.h:61
T * raw(void) const
Returns the handled pointer, potentially NULL.
Definition: Handled.h:144
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
Copy-On-Write shared pointer.
Definition: Protectable.h:93