|
Nebula
|
#include <ptr.h>
Nebula's smart pointer class which manages the life time of RefCounted objects.
Can be used like a normal C++ pointer in most cases.
NOTE: the Ptr class is not part of the Core namespace for convenience reasons.
Public Member Functions | |
| Ptr () | |
| constructor | |
| Ptr (TYPE *p) | |
| construct from C++ pointer | |
| Ptr (std::nullptr_t rhs) | |
| constructor from nullptr | |
| Ptr (const Ptr< TYPE > &p) | |
| construct from smart pointer | |
| Ptr (Ptr< TYPE > &&p) | |
| implement move constructor | |
| template<class OTHERTYPE> | |
| Ptr (OTHERTYPE *rhs) | |
| construct from C++ pointer of other type | |
| template<class OTHERTYPE> | |
| Ptr (const Ptr< OTHERTYPE > &rhs) | |
| construct from smart pointer of other type | |
| template<class OTHERTYPE> | |
| Ptr (Ptr< OTHERTYPE > &&rhs) | |
| construct from smart pointer of other type | |
| ~Ptr () | |
| destructor | |
| void | operator= (TYPE *rhs) |
| assignment operator | |
| void | operator= (const Ptr< TYPE > &rhs) |
| assignment operator | |
| void | operator= (Ptr< TYPE > &&rhs) |
| move operator | |
| void | operator= (std::nullptr_t rhs) |
| unassignment operator | |
| template<class OTHERTYPE> | |
| void | operator= (OTHERTYPE *rhs) |
| assign operator to pointer of other type | |
| template<class OTHERTYPE> | |
| void | operator= (const Ptr< OTHERTYPE > &rhs) |
| assign operator to Ptr of other type | |
| template<class OTHERTYPE> | |
| void | operator= (Ptr< OTHERTYPE > &&rhs) |
| move assignment to Ptr of other type | |
| bool | operator== (const Ptr< TYPE > &rhs) const |
| equality operator | |
| bool | operator!= (const Ptr< TYPE > &rhs) const |
| inequality operator | |
| bool | operator== (const TYPE *rhs) const |
| shortcut equality operator | |
| bool | operator!= (const TYPE *rhs) const |
| shortcut inequality operator | |
| TYPE * | operator-> () const |
| safe -> operator | |
| TYPE & | operator* () const |
| safe dereference operator | |
| operator TYPE * () const | |
| safe pointer cast operator | |
| template<class DERIVED> | |
| const Ptr< DERIVED > & | downcast () const |
| type-safe downcast operator to other smart pointer | |
| template<class BASE> | |
| const Ptr< BASE > & | upcast () const |
| type-safe upcast operator to other smart pointer | |
| template<class OTHERTYPE> | |
| const Ptr< OTHERTYPE > & | cast () const |
| unsafe(!) cast to anything, unless classes have no inheritance-relationship, call upcast/downcast instead, they are type-safe | |
| bool | isvalid () const |
| check if pointer is valid | |
| TYPE * | get () const |
| return direct pointer (asserts if null pointer) | |
| TYPE * | get_unsafe () const |
| return direct pointer (returns null pointer) | |
| uint32_t | HashCode () const |
| calculate hash code for Util::HashTable (basically just the adress) | |
Private Attributes | |
| TYPE * | ptr |
Friends | |
| template<class OTHERTYPE> | |
| class | Ptr |
| make other type Ptr classes friend | |
construct from C++ pointer of other type
|
inline |
construct from smart pointer of other type
construct from smart pointer of other type
unsafe(!) cast to anything, unless classes have no inheritance-relationship, call upcast/downcast instead, they are type-safe
type-safe downcast operator to other smart pointer
| TYPE * Ptr< TYPE >::get | ( | ) | const |
return direct pointer (asserts if null pointer)
| TYPE * Ptr< TYPE >::get_unsafe | ( | ) | const |
return direct pointer (returns null pointer)
| uint32_t Ptr< TYPE >::HashCode | ( | ) | const |
calculate hash code for Util::HashTable (basically just the adress)
| bool Ptr< TYPE >::isvalid | ( | ) | const |
check if pointer is valid
| Ptr< TYPE >::operator TYPE * | ( | ) | const |
safe pointer cast operator
inequality operator
| bool Ptr< TYPE >::operator!= | ( | const TYPE * | rhs | ) | const |
shortcut inequality operator
| TYPE & Ptr< TYPE >::operator* | ( | ) | const |
safe dereference operator
| TYPE * Ptr< TYPE >::operator-> | ( | ) | const |
safe -> operator
|
inline |
assign operator to Ptr of other type
|
inline |
assign operator to pointer of other type
|
inline |
move assignment to Ptr of other type
|
inline |
unassignment operator
| void Ptr< TYPE >::operator= | ( | TYPE * | rhs | ) |
assignment operator
equality operator
| bool Ptr< TYPE >::operator== | ( | const TYPE * | rhs | ) | const |
shortcut equality operator
type-safe upcast operator to other smart pointer
make other type Ptr classes friend
|
private |