cartobase  5.0.5
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 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 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
 

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 152 of file sharedptr.h.

Member Enumeration Documentation

◆ ReferenceType

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

Definition at line 155 of file sharedptr.h.

Constructor & Destructor Documentation

◆ shared_ptr() [1/5]

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

◆ shared_ptr() [2/5]

◆ shared_ptr() [3/5]

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

Definition at line 396 of file sharedptr.h.

◆ shared_ptr() [4/5]

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

Definition at line 404 of file sharedptr.h.

◆ shared_ptr() [5/5]

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

◆ ~shared_ptr()

Member Function Documentation

◆ operator!=() [1/5]

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

Definition at line 180 of file sharedptr.h.

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

◆ operator!=() [2/5]

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

Definition at line 182 of file sharedptr.h.

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

◆ operator!=() [3/5]

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

Definition at line 184 of file sharedptr.h.

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

◆ operator!=() [4/5]

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

Definition at line 186 of file sharedptr.h.

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

◆ operator!=() [5/5]

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

Definition at line 188 of file sharedptr.h.

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

◆ operator<() [1/4]

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

Definition at line 190 of file sharedptr.h.

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

◆ operator<() [2/4]

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

Definition at line 192 of file sharedptr.h.

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

◆ operator<() [3/4]

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

Definition at line 194 of file sharedptr.h.

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

◆ operator<() [4/4]

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

Definition at line 196 of file sharedptr.h.

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

◆ operator=() [1/4]

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

Definition at line 453 of file sharedptr.h.

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

◆ operator=() [2/4]

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

◆ operator=() [3/4]

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

◆ operator=() [4/4]

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

◆ operator==() [1/5]

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

Definition at line 170 of file sharedptr.h.

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

◆ operator==() [2/5]

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

Definition at line 172 of file sharedptr.h.

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

◆ operator==() [3/5]

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(), and carto::rc_ptr< T >::get().

◆ operator==() [4/5]

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

◆ operator==() [5/5]

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_shared_ptr< T >::get(), and carto::weak_ptr< T >::get().

◆ referenceType()

◆ release()

◆ reset()


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