cartobase  5.1.2
carto::MutexRcPtr< T > Class Template Reference

Mutex-protected rc_ptr. More...

#include <cartobase/smart/mutexrcptr.h>

Public Member Functions

 MutexRcPtr ()
 
 MutexRcPtr (T *ptr)
 
 MutexRcPtr (MutexRcPtr< T > &ptr)
 
 ~MutexRcPtr ()
 
void reset (T *p=0)
 
T * get ()
 
const T * get () const
 
T * release ()
 
MutexRcPtr< T > & operator= (MutexRcPtr< T > &other)
 
T * operator-> ()
 
const T * operator-> () const
 
T & operator* ()
 
const T & operator* () const
 
bool operator< (const MutexRcPtr< T > &other) const
 
bool operator== (const MutexRcPtr< T > &other) const
 
bool operator!= (const MutexRcPtr< T > &other) const
 
int refCount () const
 
rc_ptr< T > rcptr ()
 not thread-safe, almost private, for low-level operation only More...
 
MutexedObject::Mutexmutex ()
 
void lock ()
 
void unlock ()
 

Detailed Description

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

Mutex-protected rc_ptr.

This class is a "temporary" solution to have thread-safe rc_ptr. In the future version, the normal rc_ptr class should be thread-safe using atomic operations.

Here we are using a mutex to access the pointer and ref-counter. The API is willingly not related to the rc_ptr API (no inheritance)

Definition at line 83 of file mutexrcptr.h.

Constructor & Destructor Documentation

◆ MutexRcPtr() [1/3]

template<typename T >
carto::MutexRcPtr< T >::MutexRcPtr
inline

Definition at line 150 of file mutexrcptr.h.

◆ MutexRcPtr() [2/3]

template<typename T >
carto::MutexRcPtr< T >::MutexRcPtr ( T *  ptr)
inline

Definition at line 156 of file mutexrcptr.h.

◆ MutexRcPtr() [3/3]

template<typename T >
carto::MutexRcPtr< T >::MutexRcPtr ( MutexRcPtr< T > &  ptr)
inline

◆ ~MutexRcPtr()

template<typename T >
carto::MutexRcPtr< T >::~MutexRcPtr
inline

Definition at line 177 of file mutexrcptr.h.

Member Function Documentation

◆ get() [1/2]

template<typename T >
T * carto::MutexRcPtr< T >::get
inline

◆ get() [2/2]

template<typename T >
const T * carto::MutexRcPtr< T >::get
inline

Definition at line 224 of file mutexrcptr.h.

◆ lock()

template<typename T >
void carto::MutexRcPtr< T >::lock
inline

◆ mutex()

template<typename T >
MutexedObject::Mutex * carto::MutexRcPtr< T >::mutex
inline

Definition at line 324 of file mutexrcptr.h.

◆ operator!=()

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

Definition at line 300 of file mutexrcptr.h.

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

◆ operator*() [1/2]

template<typename T >
T & carto::MutexRcPtr< T >::operator*
inline

Definition at line 272 of file mutexrcptr.h.

◆ operator*() [2/2]

template<typename T >
const T & carto::MutexRcPtr< T >::operator*
inline

Definition at line 279 of file mutexrcptr.h.

◆ operator->() [1/2]

template<typename T >
T * carto::MutexRcPtr< T >::operator->
inline

Definition at line 258 of file mutexrcptr.h.

◆ operator->() [2/2]

template<typename T >
const T * carto::MutexRcPtr< T >::operator->
inline

Definition at line 265 of file mutexrcptr.h.

◆ operator<()

template<typename T >
bool carto::MutexRcPtr< T >::operator< ( const MutexRcPtr< T > &  other) const
inline

Definition at line 286 of file mutexrcptr.h.

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

◆ operator=()

template<typename T >
MutexRcPtr< T > & carto::MutexRcPtr< T >::operator= ( MutexRcPtr< T > &  other)
inline

◆ operator==()

template<typename T >
bool carto::MutexRcPtr< T >::operator== ( const MutexRcPtr< T > &  other) const
inline

Definition at line 293 of file mutexrcptr.h.

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

◆ rcptr()

template<typename T >
rc_ptr< T > carto::MutexRcPtr< T >::rcptr
inline

not thread-safe, almost private, for low-level operation only

Definition at line 317 of file mutexrcptr.h.

◆ refCount()

template<typename T >
int carto::MutexRcPtr< T >::refCount
inline

Definition at line 307 of file mutexrcptr.h.

◆ release()

template<typename T >
T * carto::MutexRcPtr< T >::release
inline

Definition at line 235 of file mutexrcptr.h.

◆ reset()

template<typename T >
void carto::MutexRcPtr< T >::reset ( T *  p = 0)
inline

Definition at line 184 of file mutexrcptr.h.

◆ unlock()

template<typename T >
void carto::MutexRcPtr< T >::unlock
inline

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