cartobase  4.5.0
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 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)
 
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)
 
 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)
 
 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::auto_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::auto_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 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

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

Definition at line 199 of file sharedptr.h.

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

Definition at line 213 of file sharedptr.h.

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

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

Definition at line 227 of file sharedptr.h.

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

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

Definition at line 241 of file sharedptr.h.

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

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

Definition at line 255 of file sharedptr.h.

Member Function Documentation

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

Definition at line 119 of file sharedptr.h.

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

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

Definition at line 121 of file sharedptr.h.

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

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

Definition at line 113 of file sharedptr.h.

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

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

Definition at line 115 of file sharedptr.h.

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

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

Definition at line 117 of file sharedptr.h.

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

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

Definition at line 274 of file sharedptr.h.

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

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

Definition at line 296 of file sharedptr.h.

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

Definition at line 105 of file sharedptr.h.

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==().

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().

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().

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

Friends And Related Function Documentation

template<typename T>
friend class rc_ptr_trick
friend

Definition at line 132 of file sharedptr.h.

template<typename T>
friend class WeakObject
friend

Definition at line 131 of file sharedptr.h.


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