35 #ifndef CARTOBASE_SMART_RCPTRTRICK_H
36 #define CARTOBASE_SMART_RCPTRTRICK_H
74 template <
typename T>
inline
77 if( x._pcount && *x._pcount > 0 )
84 if( x._refCounter > 0 )
89 template <
typename T>
inline
92 if( x._pcount && *x._pcount > 0 )
99 if( x._refCounter > 0 )
104 template <
typename T>
inline
107 return x->_refCounter;
111 template <
typename T>
inline
120 return x._refCounter;
124 template <
typename T>
inline
128 return x->weak_count;
Base class for reference counted objects (intrusive)
SharedObject allows to work with combined reference counting pointers and weak (Observer) pointers.
rc_ptr_trick merely makes a public access to the reference counter inside a rc_ptr.
static RCObject::RefCounterType & refCount(shared_ptr< T > &)
allows complete read-write access to the counter
static void releaseOwnership(rc_ptr< T > &)
just increments the ref-counter of the underlying rc_ptr so that the rc_ptr will never delete the obj...
static void restoreOwnership(rc_ptr< T > &)
decrements the ref-counter
static RCObject::RefCounterType & weakCount(weak_shared_ptr< T > &)
Reference-counting pointer.
A multi-purpose general smart pointer, which can act as either a rc_ptr, a weak_ptr or a weak_shared_...
weak_shared_ptr: increments a reference count, is told and becomes null whenever the shared object is...