7 #ifndef _ADTF_UCOM_ANT_OBJECT_PTR_IMPLEMENTATION_HEADER_
8 #define _ADTF_UCOM_ANT_OBJECT_PTR_IMPLEMENTATION_HEADER_
12 #pragma GCC diagnostic push
13 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
65 bool = std::is_class<T>::value &&
66 detail::has_interface_info_type<typename std::remove_cv<T>::type>::value,
80 template<
typename T,
typename TChild>
94 return static_cast<const TChild* const
>(
this)->m_oDelegateObject;
102 template<
typename T,
typename TChild>
117 return static_cast<TChild* const
>(
this)->m_oDelegateObject;
128 return static_cast<const TChild* const
>(
this)->m_oDelegateObject;
136 "object_ptr<IObject> already implicitly convertible to iobject_ptr<IObject>");
165 template<
typename>
friend class detail::delegate_object_ptr;
167 template<
typename Implementation,
typename ...Args>
friend
168 typename std::enable_if
173 typename std::remove_cv<Implementation>::type
179 template<
typename Implementation,
typename ...Args>
friend
180 typename std::enable_if
185 typename std::remove_cv<Implementation>::type
206 m_oDelegateObject(
nullptr != pSharedObject
207 ?
new (std::nothrow) detail::object_reference_counter(pSharedObject)
209 ucom_cast<T*>(pSharedObject))
214 typedef detail::object_reference_counter::size_type size_type;
220 virtual detail::iobject_ptr_ref<size_type>* GetObjPtrRef()
const
222 return m_oDelegateObject.m_pRefer;
227 typedef detail::delegate_object_ptr<T> storage_type;
229 storage_type m_oDelegateObject;
260 m_oDelegateObject(i_oOther.GetObjPtrRef(), i_oOther.
Get())
283 : m_oDelegateObject(i_oOther.GetObjPtrRef(), pSharedObject)
306 m_oDelegateObject(i_pWeak)
333 *
this = ucom_object_ptr_cast<T, U>(i_oOther);
350 explicit operator bool()
const
352 return (
Get() !=
nullptr);
373 m_oDelegateObject.Swap(o_oOther.m_oDelegateObject);
383 return m_oDelegateObject.m_pSharedObject;
432 #pragma GCC diagnostic pop
A common result class usable as return value throughout.
Base class for every interface type within the uCOM.
Safely retrieve a valid object_ptr<> instance to *this when all we have is *this.
Base object pointer to realize binary compatible reference counting in interface methods.
Base object pointer to realize binary compatible reference counting in interface methods.
iobject_ptr< T >::object_type object_type
const correct IObject type
constexpr object_ptr_base()
Used to test whether object_ptr<IObject> is not inherited from this base.
iobject_ptr< T >::object_type object_type
const correct IObject type
Base class for object_ptr<>
Disables implicit conversion operators to iobject_ptr<const T> (implemented through inheritance)
object_ptr_const_conversion()=default
CTOR.
~object_ptr_const_conversion()=default
DTOR.
Enables implicit conversion operators to iobject_ptr<const T>
__attribute__((noinline)) operator const iobject_ptr< const T > &() const override
Enable implicit conversion to const value type for pointer-like behavior.
object_ptr_const_conversion()=default
CTOR.
~object_ptr_const_conversion()=default
DTOR.
Object pointer implementation used for reference counting on objects of type IObject.
virtual tResult Reset(const iobject_ptr< T > &i_oOther)
Reset this object_ptr<> with the content of another iobject_ptr<>
void Reset()
Reset this object_ptr.
object_ptr & operator=(object_ptr i_oOther)
Assignment operator.
object_ptr(std::nullptr_t)
nullptr_t construction - the object_ptr<T> is created empty
object_ptr(object_ptr &&i_oOther)
Move constructor.
object_ptr()
Default constructor - the object_ptr<T> is created empty.
object_ptr(const weak_object_ptr< U > &i_pWeak)
Construct from weak_object_ptr<>
T & operator*() const
Operator* overload to treat object_ptr<> types like real pointers.
object_ptr(const iobject_ptr< U > &i_oOther, T *pSharedObject)
Aliasing constructor for iobject_ptr containing a different type.
virtual T * operator->() const
Operator-> overload to treat object_ptr<> types like real pointers.
virtual T * Get() const
Get pointer to shared object.
void Swap(object_ptr &o_oOther)
Swap content of *this with o_oOther (only shallow copies are performed!)
object_ptr(const object_ptr &i_oOther)
Copy constructor.
object_ptr & operator=(const object_ptr< U > &i_oOther)
Assignment operator for object_ptr containing a different type.
object_ptr(const iobject_ptr< T > &i_oOther)
Copy constructor for base type.
virtual ~object_ptr()=default
default destruction
object_ptr(const iobject_ptr< U > &i_oOther)
Copy constructor for iobject_ptr containing a different type.
Implementation of a weak pointer for usage with iobject_ptr and object_ptr.
std::enable_if< !std::is_base_of< enable_object_ptr_from_this< typename std::remove_cv< Implementation >::type >, typename std::remove_cv< Implementation >::type >::value, object_ptr< Implementation > >::type make_object_ptr(Args &&... args)
Create an instance of type object_ptr with Implementation as the shared resource.
object_ptr< T > ucom_object_ptr_cast(const iobject_ptr< U > &i_oOther)
Create an object_ptr with an already shared resource of implicitly convertible type.
Namespace for entire ADTF SDK.