Class CObjectLifetimeControl#
Defined in File object_lifetime_control.h
Inheritance Relationships#
Base Types#
public sdv::IInterfaceAccess
(Struct IInterfaceAccess)public sdv::IObjectDestroy
(Struct IObjectDestroy)public sdv::IObjectLifetime
(Struct IObjectLifetime)
Class Documentation#
-
class CObjectLifetimeControl : public sdv::IInterfaceAccess, public sdv::IObjectDestroy, public sdv::IObjectLifetime#
Wrapper class around the object to allow objects to be destroyed through sdv::IObjectDestroy.
Public Functions
-
CObjectLifetimeControl(sdv::IInterfaceAccess *pObject, IObjectDestroyHandler &rHandler, bool bAutoDestroy = true)#
Constructor assigning the object instance.
- Parameters:
pObject – [in] Interface pointer to the object instance. Must not be nullptr.
rHandler – [in] Reference to the handler being informed about the object destruction.
bAutoDestroy – [in] When set, the wrapper class will be destroyed automatically when the object is destroyed.
-
virtual ~CObjectLifetimeControl() = default#
Virtual destructor.
-
virtual void DestroyObject() override#
Destroy the object. Overload of sdv::IObjectDestroy::DestroyObject.
- Attention
After a call of this function, all exposed interfaces render invalid and should not be used any more.
-
virtual void Increment() override#
Increment the lifetime. Needs to be balanced by a call to Decrement. Overload of sdv::IObjectLifetime::Increment.
-
virtual bool Decrement() override#
Decrement the lifetime. If the lifetime reaches zero, the object will be destroyed (through the exposed IObjectDestroy interface). Overload of sdv::IObjectLifetime::Decrement.
- Returns:
Returns ‘true’ if the object was destroyed, false if not.
-
virtual uint32_t GetCount() const override#
Get the current lifetime count. Overload of sdv::IObjectLifetime::GetCount.
Remark
The GetCount function returns a momentary value, which can be changed at any moment.
- Returns:
Returns the current counter value.
-
CObjectLifetimeControl(sdv::IInterfaceAccess *pObject, IObjectDestroyHandler &rHandler, bool bAutoDestroy = true)#