![]() |
Murl Engine API
Version 2025.1
|
The SharedPointer class. More...
#include <murl_shared_pointer.h>
The SharedPointer class.
The SharedPointer holds a reference counted memory pointer, which is deleted when the last reference is removed. To avoid cross-references a WeakPointer can be used.
Public Types | |
| using | ValueType = DataType |
| The template parameter value type. | |
Public Member Functions | |
| SharedPointer () | |
| The default constructor creating a null pointer. | |
| template<class RawType > | |
| SharedPointer (RawType *rawPointer) | |
| Constructor taking a pointer to a specified object. More... | |
| template<class RawType , class DeleterType > | |
| SharedPointer (RawType *rawPointer, DeleterType deleter) | |
| Constructor taking a pointer to a specified object and a corresponding deleter functor object. More... | |
| template<class RawType > | |
| SharedPointer (AutoPointer< RawType > autoPointer) | |
| Constructor taking the ownership of an AutoPointer. More... | |
| template<class RawType > | |
| SharedPointer (const WeakPointer< RawType > &weakPointer) | |
| Constructor taking a WeakPointer. More... | |
| template<class RawType > | |
| SharedPointer (const SharedPointer< RawType > &sharedPointer) | |
| Constructor for automatic downcast. More... | |
| DataType & | operator* () const |
| Indirection operator. More... | |
| DataType * | operator-> () const |
| Dereference operator. More... | |
| operator UnspecifiedBoolType () const | |
| User define conversion to support statements like. More... | |
| bool | operator! () const |
| User define conversion to support statements like. More... | |
| Bool | IsNull () const |
| Check if the memory pointer is null. More... | |
| UInt32 | GetCount () const |
| Get the SharedPointer's usage counter. More... | |
| Bool | IsUnique () const |
| Check if the SharedPointer is the only one instance which is referencing the memory pointer. More... | |
| void | Reset () |
| Release the reference from the SharedPointer and set the memory pointer to null. | |
| template<class RawType > | |
| void | Reset (RawType *rawPointer) |
| Set the memory pointer to a new object. More... | |
| template<class RawType , class DeleterType > | |
| void | Reset (RawType *rawPointer, DeleterType deleter) |
| Set the memory pointer to a new object and a corresponding deleter functor object. More... | |
| void | Swap (SharedPointer< DataType > &sharedPointer) |
| Swap with another SharedPointer. More... | |
| template<class RawType > | |
| bool | operator== (const SharedPointer< RawType > &rhs) const |
| Equal to comparison operator. More... | |
| template<class RawType > | |
| bool | operator!= (const SharedPointer< RawType > &rhs) const |
| Not equal to comparison operator. More... | |
| template<class RawType > | |
| bool | operator< (const SharedPointer< RawType > &rhs) const |
| Less than operator. More... | |
| bool | operator== (void *rhs) const |
| Equal to comparison operator with an unspecified pointer type. More... | |
| bool | operator!= (void *rhs) const |
| Not equal to comparison operator with an unspecified pointer type. More... | |
| DataType * | Get () const |
| Get the pointer to the memory. More... | |
Static Public Member Functions | |
| template<class RawType > | |
| static SharedPointer< DataType > | DynamicCast (const SharedPointer< RawType > &source) |
| Create a SharedPointer from a SharedPointer of different type using the dynamic_cast for transfering the memory pointer. More... | |
| template<class RawType > | |
| static SharedPointer< DataType > | StaticCast (const SharedPointer< RawType > &source) |
| Create a SharedPointer from a SharedPointer of different type using the static_cast for transfering the memory pointer. More... | |
| template<class RawType > | |
| static SharedPointer< DataType > | ConstCast (const SharedPointer< RawType > &source) |
| Create a SharedPointer from a SharedPointer of different type using the const_cast for transfering the memory pointer. More... | |
|
inlineexplicit |
Constructor taking a pointer to a specified object.
| rawPointer | The pointer to the object. |
|
inline |
Constructor taking a pointer to a specified object and a corresponding deleter functor object.
| rawPointer | The pointer to the object. |
| deleter | The deleter functor. |
|
inline |
Constructor taking the ownership of an AutoPointer.
| autoPointer | The AutoPointer object to take over. |
|
inlineexplicit |
Constructor taking a WeakPointer.
| weakPointer | The WeakPointer object. |
|
inline |
Constructor for automatic downcast.
| sharedPointer | The SharedPointer object. |
|
inline |
Indirection operator.
|
inline |
Dereference operator.
|
inline |
User define conversion to support statements like.
|
inline |
User define conversion to support statements like.
|
inline |
Check if the memory pointer is null.
|
inline |
Get the SharedPointer's usage counter.
|
inline |
Check if the SharedPointer is the only one instance which is referencing the memory pointer.
|
inline |
Set the memory pointer to a new object.
| rawPointer | The pointer to the object. |
|
inline |
Set the memory pointer to a new object and a corresponding deleter functor object.
| rawPointer | The pointer to the object. |
| deleter | The deleter functor. |
|
inline |
Swap with another SharedPointer.
| sharedPointer | The SharedPointer to swap with. |
|
inline |
Equal to comparison operator.
| rhs | The right hand side SharedPointer to compare. |
|
inline |
Not equal to comparison operator.
| rhs | The right hand side SharedPointer to compare. |
|
inline |
Less than operator.
| rhs | The right hand side SharedPointer to compare. |
|
inline |
Equal to comparison operator with an unspecified pointer type.
| rhs | The right hand side memory pointer to compare. |
|
inline |
Not equal to comparison operator with an unspecified pointer type.
| rhs | The right hand side memory pointer to compare. |
|
inline |
Get the pointer to the memory.
The memory pointer should be used within local scope only! If the SharedPointer object goes out-of-scope, the validity of the memory location it is no longer guaranteed.
|
inlinestatic |
Create a SharedPointer from a SharedPointer of different type using the dynamic_cast for transfering the memory pointer.
| source | The SharedPointer to cast the memory from. |
|
inlinestatic |
Create a SharedPointer from a SharedPointer of different type using the static_cast for transfering the memory pointer.
| source | The SharedPointer to cast the memory from. |
|
inlinestatic |
Create a SharedPointer from a SharedPointer of different type using the const_cast for transfering the memory pointer.
| source | The SharedPointer to cast the memory from. |