cartobase  4.5.0
carto::shared_ptr< T > Class Template Reference

A multi-purpose general smart pointer, which can act as either a rc_ptr, a weak_ptr or a weak_shared_ptr. More...

#include <cartobase/smart/sharedptr.h>

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

Public Types

enum  ReferenceType { Strong, WeakShared, Weak }
 
- Public Types inherited from carto::ref< T >
typedef T referenced_type
 
- Public Types inherited from carto::const_ref< T >
typedef T referenced_type
 

Public Member Functions

 shared_ptr (ReferenceType t=Weak, T *x=0, bool externalowner=false)
 
 shared_ptr (const shared_ptr< T > &x)
 
 shared_ptr (const weak_shared_ptr< T > &x)
 
 shared_ptr (const rc_ptr< T > &x)
 
 shared_ptr (const weak_ptr< T > &x)
 
 ~shared_ptr ()
 
bool operator== (const shared_ptr< T > &x) const
 
bool operator== (const 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 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
 
shared_ptr< T > & operator= (const shared_ptr< T > &x)
 
shared_ptr< T > & operator= (const weak_shared_ptr< T > &x)
 
shared_ptr< T > & operator= (const rc_ptr< T > &x)
 
shared_ptr< T > & operator= (const weak_ptr< T > &x)
 
T * release ()
 
void reset (ReferenceType t, T *r=0)
 
ReferenceType referenceType () const
 
- Public Member Functions inherited from carto::weak_shared_ptr< T >
 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
 

Detailed Description

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

A multi-purpose general smart pointer, which can act as either a rc_ptr, a weak_ptr or a weak_shared_ptr.

As the behaviour is stored as an instance variable, this pointer is a bit less light-weight than the lower-level smart pointers it emulates.

Definition at line 144 of file sharedptr.h.

Member Enumeration Documentation

template<typename T>
enum carto::shared_ptr::ReferenceType
Enumerator
Strong 
WeakShared 
Weak 

Definition at line 147 of file sharedptr.h.

Constructor & Destructor Documentation

template<typename T >
carto::shared_ptr< T >::shared_ptr ( ReferenceType  t = Weak,
T *  x = 0,
bool  externalowner = false 
)
inlineexplicit
template<typename T >
carto::shared_ptr< T >::shared_ptr ( const weak_shared_ptr< T > &  x)
inline

Definition at line 378 of file sharedptr.h.

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

Definition at line 386 of file sharedptr.h.

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

Definition at line 406 of file sharedptr.h.

Member Function Documentation

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

Definition at line 172 of file sharedptr.h.

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

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

Definition at line 174 of file sharedptr.h.

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

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

Definition at line 176 of file sharedptr.h.

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

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

Definition at line 178 of file sharedptr.h.

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

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

Definition at line 435 of file sharedptr.h.

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

Definition at line 445 of file sharedptr.h.

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

Definition at line 454 of file sharedptr.h.

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

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

Definition at line 463 of file sharedptr.h.

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

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

Definition at line 162 of file sharedptr.h.

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

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

Definition at line 164 of file sharedptr.h.

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

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

Definition at line 166 of file sharedptr.h.

References carto::weak_ptr< T >::get(), and carto::rc_ptr< T >::get().

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

Definition at line 168 of file sharedptr.h.

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

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

Definition at line 170 of file sharedptr.h.

References carto::weak_shared_ptr< T >::get(), and carto::weak_ptr< T >::get().

template<typename T >
shared_ptr< T >::ReferenceType carto::shared_ptr< T >::referenceType ( ) const
inline

Definition at line 426 of file sharedptr.h.

Referenced by carto::shared_ptr< T >::shared_ptr().

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

Definition at line 472 of file sharedptr.h.

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

template<typename T >
void carto::shared_ptr< T >::reset ( ReferenceType  t,
T *  r = 0 
)
inline

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