8 #ifndef _ADTF_UCOM_ANT_LOCKED_OBJECT_INTERFACE_INCLUDES_HEADER_
9 #define _ADTF_UCOM_ANT_LOCKED_OBJECT_INTERFACE_INCLUDES_HEADER_
102 virtual T*
Get()
const = 0;
115 template <
typename T>
121 virtual T*
Get()
const = 0;
132 template <
typename T>
141 m_pObjectPtr.
Swap(o_oOther.m_pObjectPtr);
148 return m_pObjectPtr.
Get();
153 return *m_pObjectPtr.
Get();
156 explicit operator bool()
const
158 return static_cast<bool>(m_pObjectPtr);
162 virtual void UnlockObject() = 0;
167 return m_pObjectPtr.
Reset(i_oOther);
175 m_pObjectPtr =
nullptr;
179 void Swap(object_ptr_locked_common& i_oOther)
181 m_pObjectPtr.
Swap(i_oOther.m_pObjectPtr);
186 return m_pObjectPtr.
Get();
190 object_ptr_locked_common(
const object_ptr_locked_common&) =
delete;
191 object_ptr_locked_common& operator=(
const object_ptr_locked_common&) =
delete;
203 template <
typename T>
222 base_type::Release();
229 base_type::Swap(o_oOther);
236 base_type::Release();
242 return base_type::GetPtr();;
247 return base_type::Reset(i_oOther);
254 const ILockedObject* pLockedObject = ucom_cast<const ILockedObject*>(base_type::GetPtr());
269 template <
typename T>
288 base_type::Release();
295 base_type::Swap(o_oOther);
302 base_type::Release();
308 return base_type::GetPtr();;
313 return base_type::Reset(i_oOther);
320 const ISharedLockedObject* pLockedObject = ucom_cast<const ISharedLockedObject*>(base_type::GetPtr());
332 using ant::ILockedObject;
333 using ant::ISharedLockedObject;
335 using ant::iobject_ptr_locked;
336 using ant::object_ptr_locked;
337 using ant::iobject_ptr_shared_locked;
338 using ant::object_ptr_shared_locked;
A common result class usable as return value throughout.
The ILockedObject interface defines exclusive locking of an object.
ADTF_IID(ILockedObject, "lockedobject.ant.ucom.adtf.iid")
Marks the ILockedObject to be castable with the ucom_cast<>
virtual tResult Lock() const =0
Locks the object for exclusive use.
virtual tResult Unlock() const =0
Unlocks the object for exclusive use.
~ILockedObject()=default
Protected destructor --> Use implemented Destroy() instead of delete!
Base class for every interface type within the uCOM.
The ISharedLockedObject interface defines shared locking of an object.
ADTF_IID(ISharedLockedObject, "sharedlockedobject.ant.ucom.adtf.iid")
Marks the ISharedLockedObject to be castable with the ucom_cast<>
virtual tResult UnlockShared() const =0
Unlocks the object for shared use.
~ISharedLockedObject()=default
Protected destructor --> Use implemented Destroy() instead of delete!
virtual tResult LockShared() const =0
Locks the object for shared use.
basic template for locked object tparam T value type
T * operator->() const
arrow access
Interfaces for a guarded exclusive lock.
virtual tResult Reset(const iobject_ptr< T > &i_oOther)=0
Sets the value as pointer.
virtual T * Get() const =0
returns the value as pointer
Interfaces for a guarded shared lock.
virtual tResult Reset(const iobject_ptr< T > &i_oOther)=0
Sets the value as pointer.
virtual T * Get() const =0
returns the value as pointer
Base object pointer to realize binary compatible reference counting in interface methods.
Implementation for a exclusive lock guard.
virtual tResult Reset(const iobject_ptr< T > &i_oOther)
Sets the value as pointer.
object_ptr_locked & operator=(std::nullptr_t)
null assignment-operator to Reset the value
void UnlockObject() override
unlock the object
object_ptr_locked & operator=(object_ptr_locked &&o_oOther)
move-assignment-operator
object_ptr_locked()=default
CTOR.
virtual T * Get() const
returns the value as pointer
~object_ptr_locked()
DTOR.
object_ptr_locked(object_ptr_locked &&o_oOther)=default
move-CTOR
Implementation for a shared lock guard.
virtual tResult Reset(const iobject_ptr< T > &i_oOther)
Sets the value as pointer.
object_ptr_shared_locked(object_ptr_shared_locked &&o_oOther)=default
move-CTOR
void UnlockObject() override
unlocks the object
virtual T * Get() const
returns the value as pointer
object_ptr_shared_locked & operator=(std::nullptr_t)
null assignment-operator to Reset the value
object_ptr_shared_locked()=default
CTOR.
~object_ptr_shared_locked()
DTOR.
object_ptr_shared_locked & operator=(object_ptr_shared_locked &&o_oOther)
move-assignment-operator
Object pointer implementation used for reference counting on objects of type IObject.
void Reset()
Reset this object_ptr.
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!)
Namespace for entire ADTF SDK.