|
ADTF
|
Implementation of a weak pointer for usage with iobject_ptr and object_ptr.
More...
#include <weak_object_ptr.h>
Public Member Functions | |
| constexpr | weak_object_ptr () noexcept |
| Default constructor for empty construction. | |
| ~weak_object_ptr () noexcept | |
| Destructs the weak_object_ptr. | |
| constexpr | weak_object_ptr (std::nullptr_t) noexcept |
Construct the weak_ptr from a nullptr - for empty construction. | |
| weak_object_ptr (const weak_object_ptr &i_oOther) noexcept | |
| Copy constructor. | |
| weak_object_ptr & | operator= (weak_object_ptr oOther) noexcept |
| Assignment operator. | |
| weak_object_ptr (weak_object_ptr &&oOther) noexcept | |
| Move constructor. | |
| template<typename U> | |
| weak_object_ptr (const iobject_ptr< U > &i_pOther) noexcept | |
Copy construction from an iobject_ptr. | |
| template<typename U> | |
| weak_object_ptr & | operator= (const iobject_ptr< U > &i_pOther) noexcept |
Assignment from an iobject_ptr. | |
| template<typename U> | |
| tResult | Reset (const iobject_ptr< U > &i_oOther) noexcept |
Reset this weak_object_ptr<> with the content of another iobject_ptr<> | |
| tResult | Reset (const iobject_ptr< T > &i_oOther) noexcept |
Reset this weak_object_ptr<> with the content of another iobject_ptr<> | |
| void | Reset () noexcept |
Reset to an empty weak_ptr object. | |
| void | Swap (weak_object_ptr &o_oOther) noexcept |
Swap content of *this with o_oOther (only shallow copies are performed!) | |
| object_ptr< T > | Lock () const noexcept |
Create an object_ptr<> from *this weak pointer (thread safe). | |
Implementation of a weak pointer for usage with iobject_ptr and object_ptr.
This weak_ptr<> implementation is almost exactly according to the standard. Some functionality required by the standard has been left out to focus on the main task - weak counting! For a detailed explanation of a weak pointer implementation, C++-11 reference websites may be consulted.
| T | Type of the shared resource the weak reference counting is performed on. |
|
inlinenoexcept |
Destructs the weak_object_ptr.
Does not have any effect on the shared resource. The weak_count is decreased by one.
|
inlinenoexcept |
Copy constructor.
Does not have any effect on the shared count.
| [in] | i_oOther | weak_ptr to copy from. |
nullptr, the weak count of the reference counting object gets increased by one.
|
inlinenoexcept |
Move constructor.
| [in] | oOther | weak_object_ptr object to create this from. Will be reset. |
|
inlinenoexcept |
Copy construction from an iobject_ptr.
Does not have any effect on the shared count.
| U | Type of managed resource - must be ucom_cast castable to object of type T |
| [in] | i_pOther | Shared object pointer *this gets created from. |
|
inlinenoexcept |
Create an object_ptr<> from *this weak pointer (thread safe).
Does not have any effect on the weak count.
object_ptr<> referencing the shared resource. Empty object_ptr<> otherwise.
|
inlinenoexcept |
Assignment from an iobject_ptr.
Does not have any effect on the shared count.
| U | Type of managed resource - must be ucom_cast castable to object of type T |
| [in] | i_pOther | Shared object pointer *this gets created from. |
|
inlinenoexcept |
Assignment operator.
Does not have any effect on the shared count.
| [in] | oOther | Other weak_object_ptr<> to create this from. Call-by-value is intentional to make use of the copy-swap-idiom and the copy elision. |
nullptr, the weak count of the reference counting object gets increased by one.
|
inlinenoexcept |
Reset to an empty weak_ptr object.
|
inlinenoexcept |
Reset this weak_object_ptr<> with the content of another iobject_ptr<>
| [in] | i_oOther | Contains the shared object to reset this type with |
i_oOther manages a valid shared resource, the weak count gets increased by one for this resource | ERR_NOERROR | Everything went fine |
|
inlinenoexcept |
Reset this weak_object_ptr<> with the content of another iobject_ptr<>
| [in] | i_oOther | Contains the shared object to reset this type with |
i_oOther manages a valid shared resource, the weak count gets increased by one for this resource | ERR_NOERROR | Everything went fine |
| ERR_NO_INTERFACE | Managed resource owned by i_oOther does not expose interface type T. *this is reset to nullptr |
|
inlinenoexcept |
Swap content of *this with o_oOther (only shallow copies are performed!)
| [in,out] | o_oOther | Other object_ptr object whose content is swapped with *this. |