blocxx
|
COWReference A smart pointer that uses non-intrusive reference counting. More...
#include <COWReference.hpp>
Public Types | |
typedef T | element_type |
Public Member Functions | |
COWReference () | |
Default constructor The underlying object pointer will be NULL. | |
COWReference (T *ptr) | |
Construct a COWReference that will take ownership of a given pointer. | |
COWReference (const COWReference< T > &arg) | |
Copy constructor. | |
template<class U > | |
COWReference (const COWReference< U > &arg) | |
Copy constructor. | |
~COWReference () | |
Destroy this COWReference. | |
COWReference< T > & | operator= (const COWReference< T > &arg) |
Assignment operator. | |
COWReference< T > & | operator= (T *newObj) |
Assignment operator. | |
void | swap (COWReference< T > &arg) |
T * | operator-> () |
const T * | operator-> () const |
T & | operator* () |
const T & | operator* () const |
const T * | getPtr () const |
bool | isNull () const BLOCXX_DEPRECATED |
template<class U > | |
COWReference< U > | cast_to () const |
template<class U > | |
void | useRefCountOf (const COWReference< U > &) |
Private Member Functions | |
void | decRef () |
void | getWriteLock () |
Private Attributes | |
T *volatile | m_pObj |
Friends | |
class | COWReference |
COWReference A smart pointer that uses non-intrusive reference counting.
It supports 'copy on write' functionality.
Definition at line 54 of file COWReference.hpp.
typedef T BLOCXX_NAMESPACE::COWReference< T >::element_type |
Definition at line 57 of file COWReference.hpp.
BLOCXX_NAMESPACE::COWReference< T >::COWReference | ( | ) |
Default constructor The underlying object pointer will be NULL.
BLOCXX_NAMESPACE::COWReference< T >::COWReference | ( | T * | ptr | ) | [inline, explicit] |
Construct a COWReference that will take ownership of a given pointer.
ptr | The pointer that will be owned by this COWReference. |
Definition at line 170 of file COWReference.hpp.
BLOCXX_NAMESPACE::COWReference< T >::COWReference | ( | const COWReference< T > & | arg | ) | [inline] |
Copy constructor.
This constructor will cause this COWReference object to share the same underlying object pointer with another. This will cause the reference count to get incremented the underlying object.
arg | The object to copy the object pointer from. |
Definition at line 176 of file COWReference.hpp.
BLOCXX_NAMESPACE::COWReference< T >::COWReference | ( | const COWReference< U > & | arg | ) | [inline] |
Copy constructor.
This takes a COWReference of a type derived from T This constructor will cause this COWReference object to share the same underlying object pointer with another. This will cause the reference count to get incremented on the underlying object.
arg | The object to copy the object pointer from. |
Definition at line 183 of file COWReference.hpp.
BLOCXX_NAMESPACE::COWReference< T >::~COWReference | ( | ) | [inline] |
Destroy this COWReference.
If the reference count to the underlying object is zero after it is decremented in this method it will be deleted.
Definition at line 189 of file COWReference.hpp.
COWReference< U > BLOCXX_NAMESPACE::COWReference< T >::cast_to | ( | ) | const [inline] |
Definition at line 315 of file COWReference.hpp.
References BLOCXX_NAMESPACE::COWReference< T >::m_pObj, and BLOCXX_NAMESPACE::COWReference< T >::useRefCountOf().
void BLOCXX_NAMESPACE::COWReference< T >::decRef | ( | ) | [inline, private] |
Reimplemented from BLOCXX_NAMESPACE::COWReferenceBase.
Definition at line 202 of file COWReference.hpp.
References BLOCXX_NAMESPACE::COWReferenceBase::decRef().
const T * BLOCXX_NAMESPACE::COWReference< T >::getPtr | ( | ) | const [inline] |
Definition at line 301 of file COWReference.hpp.
Referenced by BLOCXX_NAMESPACE::operator!=(), BLOCXX_NAMESPACE::operator<(), and BLOCXX_NAMESPACE::operator==().
void BLOCXX_NAMESPACE::COWReference< T >::getWriteLock | ( | ) | [inline, private] |
Reimplemented from BLOCXX_NAMESPACE::COWReferenceBase.
Definition at line 214 of file COWReference.hpp.
References BLOCXX_NAMESPACE::COWReferenceClone(), BLOCXX_NAMESPACE::COWReferenceBase::getWriteLock(), and BLOCXX_NAMESPACE::COWReferenceBase::refCountGreaterThanOne().
bool BLOCXX_NAMESPACE::COWReference< T >::isNull | ( | ) | const [inline] |
Definition at line 307 of file COWReference.hpp.
T & BLOCXX_NAMESPACE::COWReference< T >::operator* | ( | ) | [inline] |
Definition at line 267 of file COWReference.hpp.
const T & BLOCXX_NAMESPACE::COWReference< T >::operator* | ( | ) | const [inline] |
Definition at line 290 of file COWReference.hpp.
const T * BLOCXX_NAMESPACE::COWReference< T >::operator-> | ( | ) | const [inline] |
Definition at line 279 of file COWReference.hpp.
T * BLOCXX_NAMESPACE::COWReference< T >::operator-> | ( | ) | [inline] |
Definition at line 255 of file COWReference.hpp.
COWReference< T > & BLOCXX_NAMESPACE::COWReference< T >::operator= | ( | const COWReference< T > & | arg | ) | [inline] |
Assignment operator.
This changes the underlying object pointer to the one contained by the COWReference object passed as the argument.
arg | The COWReference object that contains the object pointer that will be assigned to this on. |
Definition at line 234 of file COWReference.hpp.
References BLOCXX_NAMESPACE::swap().
COWReference< T > & BLOCXX_NAMESPACE::COWReference< T >::operator= | ( | T * | newObj | ) | [inline] |
Assignment operator.
This will cause thise COWReference to release ownership of it's existing object pointer and assume ownership of another.
newObj | The new object pointer this COWReference will assume ownership of. |
Definition at line 241 of file COWReference.hpp.
References BLOCXX_NAMESPACE::swap().
void BLOCXX_NAMESPACE::COWReference< T >::swap | ( | COWReference< T > & | arg | ) | [inline] |
Definition at line 248 of file COWReference.hpp.
References BLOCXX_NAMESPACE::COWRefSwap(), BLOCXX_NAMESPACE::COWReference< T >::m_pObj, and BLOCXX_NAMESPACE::COWReferenceBase::swap().
Referenced by BLOCXX_NAMESPACE::SortedVectorSet< String >::swap(), BLOCXX_NAMESPACE::SortedVectorMap< Select_t, Data >::swap(), BLOCXX_NAMESPACE::Map< String, String >::swap(), and BLOCXX_NAMESPACE::List< T >::swap().
void BLOCXX_NAMESPACE::COWReference< T >::useRefCountOf | ( | const COWReference< U > & | arg | ) | [inline] |
Definition at line 329 of file COWReference.hpp.
References BLOCXX_NAMESPACE::COWReferenceBase::useRefCountOf().
Referenced by BLOCXX_NAMESPACE::COWReference< T >::cast_to().
BLOCXX_NAMESPACE::COWReference< T >::COWReference [friend] |
Definition at line 155 of file COWReference.hpp.
T* volatile BLOCXX_NAMESPACE::COWReference< T >::m_pObj [private] |
Definition at line 158 of file COWReference.hpp.
Referenced by BLOCXX_NAMESPACE::COWReference< T >::cast_to(), and BLOCXX_NAMESPACE::COWReference< T >::swap().