Private sub class for use by WeakPointer. More...
Public Member Functions | |
WeakPointerAnchor () noexcept | |
Sets the pointer to the proxy to nullptr. | |
~WeakPointerAnchor () | |
Sends a destruction message. | |
ProxyReferenceCounter * | GetProxyReferenceCounter (void) const noexcept |
Returns the owned ProxyReferenceCounter object. | |
Private Attributes | |
ProxyReferenceCounter * | m_pReferenceCounter |
Pointer to reference counter common object. | |
Private sub class for use by WeakPointer.
When using a WeakPointer, it needs to be able to keep track of an object's status in case the object is deleted. To handle this, a reference counted object will create by this sub class if one is requested. Once created, ProxyReferenceCounter::AddRef() is called on it to ensure it's instantiation until the parent object is deleted, in which the object will have ProxyReferenceCounter::Release() called.
If there are no WeakPointer objects pointing to the ProxyReferenceCounter object, it will also self destruct, otherwise, it will stay active with a message stating that the parent is gone until all WeakPointer objects have gotten the message and released their references.
This class is not meant to be used as a stand alone class, it's mean to be instantiated by the macro BURGER_ALLOW_WEAK_POINTERS()
|
inlinenoexcept |
Sets the pointer to the proxy to nullptr.
Burger::WeakPointerAnchor::~WeakPointerAnchor | ( | ) |
Sends a destruction message.
If a ProxyReferenceCounter was created, send a message to it that the parent has self destructed and then call ProxyReferenceCounter::Release() to give up ownership of the ProxyReferenceCounter object.
|
noexcept |
Returns the owned ProxyReferenceCounter object.
If a ProxyReferenceCounter object exists, return the pointer, otherwise, create the object and return the pointer while taking ownership of it.
There will be only one shared ProxyReferenceCounter object created for each instantiation of this sub class.
|
mutableprivate |
Pointer to reference counter common object.