13 #include <type_traits>
21 template<
typename Implementation,
bool Fuse,
typename Allocator,
typename... Args>
22 inline object_ptr<Implementation>
allocate_object_ptr(Allocator&& allocator, Args&&... args);
74 template<
typename Implementation,
bool Fuse,
typename Allocator,
typename... Args>
128 template<
typename Implementation,
typename... Args>
131 return vision::allocate_object_ptr<Implementation, true>(std::allocator<void>(), std::forward<Args>(args)...);
147 template<
typename T,
typename U>
151 if (
nullptr == i_oSrc.
Get())
158 const auto pTmp = ucom_object_ptr_cast<const T>(i_oSrc);
162 return ERR_NO_INTERFACE;
165 return o_oDest.
Reset(pTmp);
181 return o_oDest.
Reset(pTmp);
226 template<
typename Implementation,
bool Fuse,
typename Allocator,
typename... Args>
229 static_assert(!std::is_reference_v<Implementation> && !std::is_volatile_v<Implementation>);
230 using implementation_base_type = std::remove_const_t<Implementation>;
231 using allocator_base =
typename std::allocator_traits<Allocator>::template rebind_alloc<void>;
232 using counter_type = detail::fused_object_reference_counter<implementation_base_type, allocator_base, Fuse>;
234 auto pCounter = counter_type::Create(std::forward<Allocator>(allocator), std::forward<Args>(args)...);
235 auto pSharedObject = pCounter->GetSharedObject();
242 pEnabler->
Assign(oResult);
266 using vision::allocate_object_ptr;
A common result class usable as return value throughout.
Safely retrieve a valid object_ptr<> instance to *this when all we have is *this.
~enable_object_ptr_from_this()=default
Default destructor.
object_ptr< const T > object_ptr_from_this() const
Retrieve an object_ptr with *this being the shared resource - const correct.
enable_object_ptr_from_this & operator=(const enable_object_ptr_from_this &)=default
Default copy assignment.
void Assign(const object_ptr< T > &i_pObject)
Assign an existing shared resource in form of the managing object ptr.
enable_object_ptr_from_this()=default
Default constructor.
object_ptr< T > object_ptr_from_this()
Retrieve an object_ptr with *this being the shared resource.
enable_object_ptr_from_this(const enable_object_ptr_from_this &)=default
Default copy construction.
weak_object_ptr< T > m_pWeak
weak pointer managing the object_ptr to enable
Base object pointer to realize binary compatible reference counting in interface methods.
virtual tResult Reset(const iobject_ptr< T > &i_oOther)=0
Reset this object_ptr<> with the content of another iobject_ptr<>
virtual T * Get() const =0
Get raw pointer to shared object.
Base object pointer to realize binary compatible reference counting in interface methods.
Implementation of a weak pointer for usage with iobject_ptr and object_ptr.
object_ptr< Implementation > make_object_ptr(Args &&... args)
Create an instance of type object_ptr with Implementation as the shared resource.
tResult reset_object_ptr(iobject_ptr< const T > &o_oDest, const iobject_ptr< U > &i_oSrc)
Reset an iobject_ptr with const T.
object_ptr< T > ucom_object_ptr_cast(object_ptr< T > oCasted)
Create an object_ptr with an already shared resource of implicitly convertible type.
ant::object_ptr< T > ucom_object_ptr_const_cast(const ant::iobject_ptr< const T > &i_oOther)
Create an object_ptr with a mutable shared resource of an existing const resource.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
object_ptr< Implementation > allocate_object_ptr(Allocator &&allocator, Args &&... args)
Create an instance of type object_ptr with Implementation as the shared resource.