cartobase  4.5.0
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 ()
 
T * release ()
 
MutexRcPtr< T > & operator= (MutexRcPtr< T > &other)
 
T * operator-> ()
 
T & operator* ()
 
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

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

Definition at line 147 of file mutexrcptr.h.

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

Definition at line 153 of file mutexrcptr.h.

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

Definition at line 174 of file mutexrcptr.h.

Member Function Documentation

template<typename T >
T * carto::MutexRcPtr< T >::get ( )
inline
template<typename T >
void carto::MutexRcPtr< T >::lock ( )
inline
template<typename T >
MutexedObject::Mutex * carto::MutexRcPtr< T >::mutex ( )
inline

Definition at line 296 of file mutexrcptr.h.

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

Definition at line 272 of file mutexrcptr.h.

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

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

Definition at line 251 of file mutexrcptr.h.

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

Definition at line 244 of file mutexrcptr.h.

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

Definition at line 258 of file mutexrcptr.h.

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

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

Definition at line 265 of file mutexrcptr.h.

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

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

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

Definition at line 289 of file mutexrcptr.h.

template<typename T >
int carto::MutexRcPtr< T >::refCount ( ) const
inline

Definition at line 279 of file mutexrcptr.h.

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

Definition at line 221 of file mutexrcptr.h.

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

Definition at line 181 of file mutexrcptr.h.

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

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