34#ifndef CARTOBASE_SMART_SHAREDPTR_H
35#define CARTOBASE_SMART_SHAREDPTR_H
106 {
return get() == x; }
110 {
return get() == x.
get(); }
112 {
return get() == x.
get(); }
114 {
return get() != x; }
118 {
return get() != x.
get(); }
120 {
return get() != x.
get(); }
124 {
return get() < x.
get(); }
126 {
return get() < x.
get(); }
151 template <
typename T>
163 bool externalowner =
false );
215 template <
typename T>
224 x->attachWeakPtr( *
this );
229 template <
typename T>
238 x->attachWeakPtr( *this );
243 template <
typename T>
252 x->attachWeakPtr( *this );
257 template <
typename T>
266 x->attachWeakPtr( *this );
271 template <
typename T>
280 template <
typename T>
282 void weak_shared_ptr<T>::update()
289 template <
typename T>
304 x->attachWeakPtr( *
this );
311 template <
typename T>
322 template <
typename T>
333 template <
typename T>
344 r->attachWeakPtr( *
this );
352 template <
typename T>
373 template <
typename T>
394 template <
typename T>
402 template <
typename T>
412 template <
typename T>
422 template <
typename T>
430 ++this->
get()->weak_count;
442 template <
typename T>
450 template <
typename T>
455 reset( x.referenceType(), x.get() );
460 template <
typename T>
470 template <
typename T>
479 template <
typename T>
488 template <
typename T>
494 --this->
get()->weak_count;
501 template <
typename T>
505 if( r == this->
get() )
543 r->attachWeakPtr(
static_cast<weak_ptr<T> &
>( *
this ) );
546 if( r->_refCounter == 1 )
583 r->attachWeakPtr( *
this );
bool tryDelete()
tests if the shared object can be deleted.
bool testDeletable()
tests if the shared object can be deleted (no strong pointers to it).
void disableRefCount()
called by destructors to avoid double deletion.
friend class weak_shared_ptr
SharedObject & operator=(const SharedObject &)
SharedObject(const SharedObject &x)
friend class rc_ptr_trick
virtual ~SharedObject()
notifies observers
const_ref< T > & operator=(const ref< T > &other)
Reference-counting pointer.
A multi-purpose general smart pointer, which can act as either a rc_ptr, a weak_ptr or a weak_shared_...
bool operator==(const shared_ptr< T > &x) const
bool operator<(const shared_ptr< T > &x) const
shared_ptr< T > & operator=(const shared_ptr< T > &x)
void reset(ReferenceType t, T *r=0)
shared_ptr(ReferenceType t=Weak, T *x=0, bool externalowner=false)
ReferenceType referenceType() const
bool operator!=(const shared_ptr< T > &x) const
Observer pointer, observing a shfj::WeakObject.
bool operator!=(const weak_ptr< T > &x) const
weak_ptr & operator=(const weak_ptr< Y > &r)
bool operator<(const weak_ptr< T > &x) const
bool operator==(const weak_ptr< T > &x) const
weak_shared_ptr: increments a reference count, is told and becomes null whenever the shared object is...
bool operator==(const T *x) const
weak_shared_ptr(const weak_shared_ptr< T > &x)
bool operator<(const weak_shared_ptr< T > &x) const
bool operator!=(const T *x) const
weak_shared_ptr< T > & operator=(const weak_shared_ptr< T > &x)
weak_shared_ptr(const weak_ptr< T > &x)
weak_shared_ptr(T *x=0, bool externalowner=false)
weak_shared_ptr(const rc_ptr< T > &x)
friend class rc_ptr_trick