The WeakPointer class. More...
#include "murl_weak_pointer.h"
Public Types | |
using | ValueType = DataType |
The template parameter value type. | |
Public Member Functions | |
WeakPointer () | |
The default constructor creating a null pointer. | |
template<class RawType > | |
WeakPointer (const WeakPointer< RawType > &weakPointer) | |
Constructor for automatic downcast. More... | |
template<class RawType > | |
WeakPointer (const SharedPointer< RawType > &sharedPointer) | |
Constructor taking a SharedPointer. More... | |
SharedPointer< DataType > | Lock () const |
Get the SharedPointer from the WeakPointer. More... | |
UInt32 | GetCount () const |
Get the SharedPointer's usage counter. More... | |
Bool | IsExpired () const |
Check if the SharedPointer is expired. More... | |
void | Clear () |
Release the reference from the WeakPointer and set the memory pointer to null. | |
void | Swap (WeakPointer< DataType > &weakPointer) |
Swap with another WeakPointer. More... | |
template<class RawType > | |
bool | operator== (const WeakPointer< RawType > &rhs) const |
Equal to comparison operator. More... | |
template<class RawType > | |
bool | operator!= (const WeakPointer< RawType > &rhs) const |
Not equal to comparison operator. More... | |
template<class RawType > | |
bool | operator< (const WeakPointer< RawType > &rhs) const |
Less than operator. More... | |
Detailed Description
template<class DataType>
class Murl::WeakPointer< DataType >
The WeakPointer class.
The WeakPointer holds a reference to a shared pointer for obtaining temporary Sharedpointer instances by using the Lock() method. If the SharedPointer do no longer exist, the Lock() method returns a SharedPointer object which holds a null pointer.
Constructor & Destructor Documentation
◆ WeakPointer() [1/2]
|
inline |
Constructor for automatic downcast.
- Parameters
-
weakPointer The WeakPointer object.
◆ WeakPointer() [2/2]
|
inline |
Constructor taking a SharedPointer.
- Parameters
-
sharedPointer The SharedPointer object.
Member Function Documentation
◆ Lock()
|
inline |
Get the SharedPointer from the WeakPointer.
- Returns
- The SharedPointer object. The SharedPointer's pointer is null if the SharedPointer is expired.
References Murl::WeakPointer< DataType >::IsExpired().
◆ GetCount()
|
inline |
Get the SharedPointer's usage counter.
- Returns
- The number of SharePointer instances referencing to the same memory pointer.
References Murl::SharedPointerPrivate::WeakCounter::GetCount().
◆ IsExpired()
|
inline |
Check if the SharedPointer is expired.
- Returns
- true if the SharedPointer is expired.
References Murl::SharedPointerPrivate::WeakCounter::GetCount().
Referenced by Murl::WeakPointer< DataType >::Lock().
◆ Swap()
|
inline |
Swap with another WeakPointer.
- Parameters
-
weakPointer The WeakPointer to swap with.
References Murl::SharedPointerPrivate::WeakCounter::Swap().
Referenced by Murl::WeakPointer< DataType >::Clear().
◆ operator==()
|
inline |
Equal to comparison operator.
- Parameters
-
rhs The right hand side WeakPointer to compare.
- Returns
- true if the memory pointers are equal.
◆ operator!=()
|
inline |
Not equal to comparison operator.
- Parameters
-
rhs The right hand side WeakPointer to compare.
- Returns
- true if the memory pointers are not equal.
◆ operator<()
|
inline |
Less than operator.
- Parameters
-
rhs The right hand side WeakPointer to compare.
- Returns
- true if the left hand side (this) is less than the right hand side.
The documentation for this class was generated from the following files:
- murl_shared_pointer.h
- murl_weak_pointer.h