![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <SafeReferenceable.hpp>
Public Member Functions | |
WeakReference ()=default | |
Default constructor. More... | |
WeakReference (const SafeReferenceable< T > &ref) | |
Constructor for initializing from a SafeReferenceable object. More... | |
bool | expired () const |
Check if this reference is expired. More... | |
void | reset () |
Reset this reference. More... | |
T * | get () |
Get a pointer to the bound object. More... | |
const T * | get () const |
Get a pointer to the bound object. More... | |
T & | operator* () |
Dereference operator. More... | |
const T & | operator* () const |
Dereference operator. More... | |
operator T & () | |
Dereference operator. More... | |
operator const T & () const | |
Dereference operator. More... | |
T * | operator-> () |
Get a pointer to the bound object. More... | |
const T * | operator-> () const |
Get a pointer to the bound object. More... | |
operator bool () const | |
Check if this reference is not expired. More... | |
WeakReference & | operator= (const SafeReferenceable< T > &other) |
Assignment operator for assigning a SafeReferenceable object. More... | |
Friends | |
template<typename To , typename From > | |
WeakReference< To > | static_ref_cast (const WeakReference< From > &) |
Statically cast a weak reference. More... | |
template<typename To , typename From > | |
WeakReference< To > | dynamic_ref_cast (const WeakReference< From > &) |
Dynamically cast a weak reference. More... | |
Definition at line 38 of file SafeReferenceable.hpp.
|
default |
Default constructor.
Initializes the internal reference to be empty
jop::WeakReference< T >::WeakReference | ( | const SafeReferenceable< T > & | ref | ) |
Constructor for initializing from a SafeReferenceable object.
ref | The object to bind |
bool jop::WeakReference< T >::expired | ( | ) | const |
Check if this reference is expired.
T* jop::WeakReference< T >::get | ( | ) |
Get a pointer to the bound object.
const T* jop::WeakReference< T >::get | ( | ) | const |
Get a pointer to the bound object.
jop::WeakReference< T >::operator bool | ( | ) | const |
Check if this reference is not expired.
This is the same as !expired()
jop::WeakReference< T >::operator const T & | ( | ) | const |
Dereference operator.
Calling this operator when this reference is expired will cause a segmentation fault.
jop::WeakReference< T >::operator T & | ( | ) |
Dereference operator.
Calling this operator when this reference is expired will cause a segmentation fault.
T& jop::WeakReference< T >::operator* | ( | ) |
Dereference operator.
Calling this operator when this reference is expired will cause a segmentation fault.
const T& jop::WeakReference< T >::operator* | ( | ) | const |
Dereference operator.
Calling this operator when this reference is expired will cause a segmentation fault.
T* jop::WeakReference< T >::operator-> | ( | ) |
Get a pointer to the bound object.
const T* jop::WeakReference< T >::operator-> | ( | ) | const |
Get a pointer to the bound object.
WeakReference& jop::WeakReference< T >::operator= | ( | const SafeReferenceable< T > & | other | ) |
Assignment operator for assigning a SafeReferenceable object.
other | The object to bind |
void jop::WeakReference< T >::reset | ( | ) |
Reset this reference.
After this call, this reference won't point to anything.
|
friend |
Dynamically cast a weak reference.
other | The reference to cast |
|
friend |
Statically cast a weak reference.
other | The reference to cast |