ADTF
|
Safely retrieve a valid object_ptr<> instance to *this when all we have is *this. More...
Public Member Functions | |
object_ptr< T > | object_ptr_from_this () |
Retrieve an object_ptr with *this being the shared resource. More... | |
object_ptr< const T > | object_ptr_from_this () const |
Retrieve an object_ptr with *this being the shared resource - const correct. More... | |
Protected Member Functions | |
enable_object_ptr_from_this ()=default | |
Default constructor. | |
~enable_object_ptr_from_this ()=default | |
Default destructor. | |
enable_object_ptr_from_this (const enable_object_ptr_from_this &)=default | |
Default copy construction. | |
enable_object_ptr_from_this & | operator= (const enable_object_ptr_from_this &)=default |
Default copy assignment. | |
Private Member Functions | |
void | Assign (const object_ptr< T > &i_pObject) |
Assign an existing shared resource in form of the managing object ptr. More... | |
Private Attributes | |
weak_object_ptr< T > | m_pWeak |
weak pointer managing the object_ptr to enable | |
Safely retrieve a valid object_ptr<> instance to *this when all we have is *this.
This may be used in complete analogy to std::enable_shared_from_this
, so please consult a documentation for that for further questions on the usage of this class.
object_ptr
is from an shared resource managed by an already existing object_ptr
, friend function make_object_ptr is the only possible way to assign a valid object_ptr
. In other words, retrieving an object_ptr
of *this from an object not managed by an object_ptr
results in an empty object_ptr<T>
. T | Type of the shared resource that is managed by the object_ptr<> to retrieve. |
Definition at line 29 of file object_ptr_utilities.h.
|
inlineprivate |
Assign an existing shared resource in form of the managing object ptr.
[in] | i_pObject | The object ptr *this gets assigned to. |
Definition at line 81 of file object_ptr_utilities.h.
References enable_object_ptr_from_this< T >::m_pWeak.
Referenced by adtf::ucom::ant::make_object_ptr().
|
inline |
Retrieve an object_ptr
with *this being the shared resource.
object_ptr
with *this as the shared resource. If *this is not managed by a valid object_ptr
, the returned object_ptr
is empty. Definition at line 47 of file object_ptr_utilities.h.
References enable_object_ptr_from_this< T >::m_pWeak.
Referenced by cGraphObject::CreateInterfaceServer().
|
inline |
Retrieve an object_ptr
with *this being the shared resource - const correct.
object_ptr
with *this as the shared resource. If *this is not managed by a valid object_ptr
, the returned object_ptr
is empty. Definition at line 57 of file object_ptr_utilities.h.
References enable_object_ptr_from_this< T >::m_pWeak.