cartobase  5.0.5
carto::weak_shared_ptr< T > Class Template Reference

weak_shared_ptr: increments a reference count, is told and becomes null whenever the shared object is deleted externally. More...

#include <cartobase/smart/sharedptr.h>

Inheritance diagram for carto::weak_shared_ptr< T >:
Collaboration diagram for carto::weak_shared_ptr< T >:

Public Member Functions

 weak_shared_ptr (T *x=0, bool externalowner=false)
 
 weak_shared_ptr (const weak_shared_ptr< T > &x)
 
 weak_shared_ptr (const rc_ptr< T > &x)
 
 weak_shared_ptr (const weak_ptr< T > &x)
 
 ~weak_shared_ptr ()
 
T * get () const
 
bool operator== (const T *x) const
 
bool operator== (const weak_shared_ptr< T > &x) const
 
bool operator== (const rc_ptr< T > &x) const
 
bool operator== (const weak_ptr< T > &x) const
 
bool operator!= (const T *x) const
 
bool operator!= (const weak_shared_ptr< T > &x) const
 
bool operator!= (const rc_ptr< T > &x) const
 
bool operator!= (const weak_ptr< T > &x) const
 
bool operator< (const weak_shared_ptr< T > &x) const
 
bool operator< (const rc_ptr< T > &x) const
 
bool operator< (const weak_ptr< T > &x) const
 
T & operator* () const
 
T * operator-> () const
 
weak_shared_ptr< T > & operator= (const weak_shared_ptr< T > &x)
 
weak_shared_ptr< T > & operator= (const rc_ptr< T > &x)
 
weak_shared_ptr< T > & operator= (const weak_ptr< T > &x)
 
T * release ()
 
void reset (T *r=0)
 
- Public Member Functions inherited from carto::rc_ptr< T >
 rc_ptr ()
 
 rc_ptr (T *p)
 
 rc_ptr (T *p, bool externalowner)
 
template<class U >
 rc_ptr (std::auto_ptr< U > r)
 
void reset (T *p=NULL)
 
T * get () const
 
bool operator< (const rc_ptr< T > &other) const
 
 operator insipid * () const
 
- Public Member Functions inherited from carto::ref< T >
 ref ()
 
 ref (T *pObject)
 
 ref (T *pObject, bool externalowner)
 
template<class U >
 ref (std::auto_ptr< U > r)
 
 ref (const ref< T > &other)
 
template<class R >
 ref (const ref< R > &other)
 
 ~ref ()
 
T * release ()
 
ref< T > & operator= (const ref< T > &other)
 
T * operator-> () const
 
T & operator* () const
 
T * pointer () const
 
- Public Member Functions inherited from carto::const_ref< T >
 const_ref ()
 
 const_ref (const T *pObject)
 
 const_ref (const T *pObject, bool externalowner)
 
template<class U >
 const_ref (std::auto_ptr< U > r)
 
 const_ref (const ref< T > &other)
 
 const_ref (const const_ref< T > &other)
 
template<class R >
 const_ref (const ref< R > &o)
 
template<class R >
 const_ref (const const_ref< R > &other)
 
 ~const_ref ()
 
const_ref< T > & operator= (const ref< T > &other)
 
const_ref< T > & operator= (const const_ref< T > &other)
 
bool isNull () const
 
bool operator== (const ref< T > &other) const
 
bool operator== (const T *pointer) const
 
bool operator== (const const_ref< T > &other) const
 
bool operator!= (const ref< T > &other) const
 
bool operator!= (const const_ref< T > &other) const
 
bool operator!= (const T *pointer) const
 
const T * operator-> () const
 
const T & operator* () const
 
const T * pointer () const
 
int refCount () const
 
- Public Member Functions inherited from carto::RefData< T >
int count () const
 
- Public Member Functions inherited from carto::weak_ptr< T >
 weak_ptr (T *p=0)
 
void reset (T *r=0)
 
template<typename Y >
 weak_ptr (const weak_ptr< Y > &r)
 
template<typename Y >
 weak_ptr (const rc_ptr< Y > &r)
 
template<typename Y >
 weak_ptr (const std::unique_ptr< Y > &r)
 
template<typename Y >
weak_ptroperator= (const weak_ptr< Y > &r)
 
template<typename Y >
weak_ptroperator= (const rc_ptr< Y > &r)
 
template<typename Y >
weak_ptroperator= (const std::unique_ptr< Y > &r)
 
 weak_ptr (const weak_ptr &r)
 
weak_ptroperator= (const weak_ptr &w)
 
 ~weak_ptr ()
 
 operator InsipidProxyPointer * () const
 
T & operator* () const
 
T * operator-> () const
 
T * get () const
 
T * release ()
 
bool operator== (const weak_ptr< T > &x) const
 
bool operator== (const weak_shared_ptr< T > &x) const
 
bool operator== (const rc_ptr< T > &x) const
 
bool operator== (const shared_ptr< T > &x) const
 
bool operator!= (const weak_ptr< T > &x) const
 
bool operator!= (const weak_shared_ptr< T > &x) const
 
bool operator!= (const rc_ptr< T > &x) const
 
bool operator!= (const shared_ptr< T > &x) const
 
bool operator< (const weak_ptr< T > &x) const
 
bool operator< (const weak_shared_ptr< T > &x) const
 
bool operator< (const shared_ptr< T > &x) const
 
bool operator< (const rc_ptr< T > &x) const
 

Friends

class WeakObject
 
class rc_ptr_trick
 

Additional Inherited Members

- Public Types inherited from carto::ref< T >
typedef T referenced_type
 
- Public Types inherited from carto::const_ref< T >
typedef T referenced_type
 

Detailed Description

template<typename T>
class carto::weak_shared_ptr< T >

weak_shared_ptr: increments a reference count, is told and becomes null whenever the shared object is deleted externally.

When the shared counter reaches 0, the shared object is deleted (standard rc_ptr behaviour). T must inherit SharedObject.

See also
rc_ptr, weak_ptr, WeakObject

Definition at line 94 of file sharedptr.h.

Constructor & Destructor Documentation

◆ weak_shared_ptr() [1/4]

template<typename T >
carto::weak_shared_ptr< T >::weak_shared_ptr ( T *  x = 0,
bool  externalowner = false 
)
inlineexplicit

Definition at line 217 of file sharedptr.h.

◆ weak_shared_ptr() [2/4]

template<typename T >
carto::weak_shared_ptr< T >::weak_shared_ptr ( const weak_shared_ptr< T > &  x)
inline

Definition at line 231 of file sharedptr.h.

References carto::weak_shared_ptr< T >::get().

◆ weak_shared_ptr() [3/4]

template<typename T >
carto::weak_shared_ptr< T >::weak_shared_ptr ( const rc_ptr< T > &  x)
inline

Definition at line 245 of file sharedptr.h.

References carto::rc_ptr< T >::get().

◆ weak_shared_ptr() [4/4]

template<typename T >
carto::weak_shared_ptr< T >::weak_shared_ptr ( const weak_ptr< T > &  x)
inline

Definition at line 259 of file sharedptr.h.

References carto::weak_ptr< T >::get().

◆ ~weak_shared_ptr()

template<typename T >
carto::weak_shared_ptr< T >::~weak_shared_ptr ( )
inline

Definition at line 273 of file sharedptr.h.

References carto::rc_ptr< T >::reset().

Member Function Documentation

◆ get()

◆ operator!=() [1/4]

template<typename T>
bool carto::weak_shared_ptr< T >::operator!= ( const T *  x) const
inline

Definition at line 113 of file sharedptr.h.

◆ operator!=() [2/4]

template<typename T>
bool carto::weak_shared_ptr< T >::operator!= ( const weak_shared_ptr< T > &  x) const
inline

Definition at line 115 of file sharedptr.h.

References carto::weak_ptr< T >::operator!=().

◆ operator!=() [3/4]

template<typename T>
bool carto::weak_shared_ptr< T >::operator!= ( const rc_ptr< T > &  x) const
inline

Definition at line 117 of file sharedptr.h.

References carto::rc_ptr< T >::get().

◆ operator!=() [4/4]

template<typename T>
bool carto::weak_shared_ptr< T >::operator!= ( const weak_ptr< T > &  x) const
inline

Definition at line 119 of file sharedptr.h.

References carto::weak_ptr< T >::get().

◆ operator*()

template<typename T>
T& carto::weak_shared_ptr< T >::operator* ( ) const
inline

Definition at line 127 of file sharedptr.h.

References carto::weak_ptr< T >::operator*().

◆ operator->()

template<typename T>
T* carto::weak_shared_ptr< T >::operator-> ( ) const
inline

◆ operator<() [1/3]

template<typename T>
bool carto::weak_shared_ptr< T >::operator< ( const weak_shared_ptr< T > &  x) const
inline

Definition at line 121 of file sharedptr.h.

References carto::weak_ptr< T >::operator<().

◆ operator<() [2/3]

template<typename T>
bool carto::weak_shared_ptr< T >::operator< ( const rc_ptr< T > &  x) const
inline

Definition at line 123 of file sharedptr.h.

References carto::weak_ptr< T >::get().

◆ operator<() [3/3]

template<typename T>
bool carto::weak_shared_ptr< T >::operator< ( const weak_ptr< T > &  x) const
inline

Definition at line 125 of file sharedptr.h.

References carto::weak_ptr< T >::get().

◆ operator=() [1/3]

template<typename T >
weak_shared_ptr< T > & carto::weak_shared_ptr< T >::operator= ( const weak_shared_ptr< T > &  x)
inline

Definition at line 292 of file sharedptr.h.

References carto::weak_ptr< T >::operator=(), and carto::ref< T >::operator=().

◆ operator=() [2/3]

template<typename T >
weak_shared_ptr< T > & carto::weak_shared_ptr< T >::operator= ( const rc_ptr< T > &  x)
inline

Definition at line 314 of file sharedptr.h.

References carto::weak_shared_ptr< T >::reset().

◆ operator=() [3/3]

template<typename T>
weak_shared_ptr<T>& carto::weak_shared_ptr< T >::operator= ( const weak_ptr< T > &  x)

◆ operator==() [1/4]

template<typename T>
bool carto::weak_shared_ptr< T >::operator== ( const T *  x) const
inline

Definition at line 105 of file sharedptr.h.

◆ operator==() [2/4]

template<typename T>
bool carto::weak_shared_ptr< T >::operator== ( const weak_shared_ptr< T > &  x) const
inline

Definition at line 107 of file sharedptr.h.

References carto::weak_ptr< T >::operator==().

◆ operator==() [3/4]

template<typename T>
bool carto::weak_shared_ptr< T >::operator== ( const rc_ptr< T > &  x) const
inline

Definition at line 109 of file sharedptr.h.

References carto::rc_ptr< T >::get().

◆ operator==() [4/4]

template<typename T>
bool carto::weak_shared_ptr< T >::operator== ( const weak_ptr< T > &  x) const
inline

Definition at line 111 of file sharedptr.h.

References carto::weak_ptr< T >::get().

◆ release()

template<typename T >
T * carto::weak_shared_ptr< T >::release ( )
inline

◆ reset()

template<typename T >
void carto::weak_shared_ptr< T >::reset ( T *  r = 0)
inline

Friends And Related Function Documentation

◆ rc_ptr_trick

template<typename T>
friend class rc_ptr_trick
friend

Definition at line 140 of file sharedptr.h.

◆ WeakObject

template<typename T>
friend class WeakObject
friend

Definition at line 139 of file sharedptr.h.


The documentation for this class was generated from the following file: