Class CLifetimeCookie#
Defined in File component_impl.h
Class Documentation#
-
class CLifetimeCookie#
Lifetime cookie to automatically manage the module lifetime.
The lifetime cookie uses an increment and decrement function to increment for every assigned instantiation of the cookie and to decrement every previously instantiated cookie. This allows the classfactory to keep track of its lifetime even with dynamically created objects.
Public Functions
-
CLifetimeCookie() = default#
Default constructor.
-
inline CLifetimeCookie(std::function<void()> fnLifetimeIncr, std::function<void()> fnLifetimeDecr)#
Assignment constructor, assigning the increment and decrement functions.
Assign the increment and decrement functions and increase the incrementation.
- Parameters:
fnLifetimeIncr – [in] Increment function object.
fnLifetimeDecr – [in] Decrement function object.
-
inline CLifetimeCookie(const CLifetimeCookie &rCookie)#
Copy constructor.
Construct a lifetime cookie object and copy the increment and decrement functions and call the increment function if valid.
- Parameters:
rCookie – [in] Reference to the cookie to copy from.
-
inline CLifetimeCookie(CLifetimeCookie &&rCookie) noexcept#
Move constructor.
Construct a lifetime cookie object and move the functions from the provided cookie. Then reset the functions of the provided cookie.
- Parameters:
rCookie – [in] Reference to the cookie to copy from.
-
inline ~CLifetimeCookie()#
Destroy the lifetime cookie.
Decrement the lifetime by calling the decrement function if valid and destroy the cookie object.
-
inline CLifetimeCookie &operator=(const CLifetimeCookie &rCookie)#
Assignment operator.
Release the current lifetime by calling the decrement function and assign the increment and decrement functions of the provided cookie and call the increment function if valid.
- Parameters:
rCookie – [in] Reference to the cookie to copy from.
- Returns:
Reference to this class.
-
inline CLifetimeCookie &operator=(CLifetimeCookie &&rCookie) noexcept#
Move operator.
Release the current lifetime by calling the decrement function and move the functions from the provided cookie. Then reset the functions of the provided cookie.
- Parameters:
rCookie – [in] Reference to the cookie to copy from.
- Returns:
Reference to this class.
-
CLifetimeCookie() = default#