FastArduino  v1.9 alpha
C++ library to build fast but small Arduino/AVR projects
lifecycle::LifeCycle< T > Class Template Reference

A mixin class allowing lifecycle management of any object of any type T. More...

#include <fastarduino/lifecycle.h>

Inheritance diagram for lifecycle::LifeCycle< T >:
Collaboration diagram for lifecycle::LifeCycle< T >:

Public Member Functions

 LifeCycle ()
 Create a new LifeCycle<T> mixin for an object of type T. More...
 
 LifeCycle (const T &value)
 Create a new LifeCycle<T> mixin for object value of type T. More...
 
 LifeCycle (T &&value)
 Create a new LifeCycle<T> mixin for object value of type T. More...
 
 LifeCycle (LifeCycle &&that)=default
 Crate a new LifeCycle<T> mixin object of type T, by moving an already existing LifeCycle<T> instance that. More...
 
 ~LifeCycle ()=default
 Destroy this LifeCycle<T> instance. More...
 
LifeCycleoperator= (LifeCycle &&that)=default
 Assign this LifeCycle<T> with that, by moving that already existing LifeCycle<T> instance. More...
 
- Public Member Functions inherited from lifecycle::AbstractLifeCycle
uint8_t id () const
 The unique identifier of this lifecycle-managed instance, as provided by the LifeCycleManager it was registered with. More...
 
AbstractLifeCycleManagermanager () const
 A pointer to the AbstractLifeCycleManager handling this instance. More...
 

Detailed Description

template<typename T>
class lifecycle::LifeCycle< T >

A mixin class allowing lifecycle management of any object of any type T.

Template Parameters
Tthe type of object for which we want to manage lifecycle
See also
LifeCycleManager

Definition at line 356 of file lifecycle.h.

Constructor & Destructor Documentation

◆ LifeCycle() [1/4]

template<typename T >
lifecycle::LifeCycle< T >::LifeCycle ( )
inline

Create a new LifeCycle<T> mixin for an object of type T.

This can be registered with a LifeCycleManager and then tracked wherever it gets moved.

Warning
Type T must be default-constructable if you use this LifeCycle constructor.

Definition at line 367 of file lifecycle.h.

◆ LifeCycle() [2/4]

template<typename T >
lifecycle::LifeCycle< T >::LifeCycle ( const T &  value)
inlineexplicit

Create a new LifeCycle<T> mixin for object value of type T.

This can be registered with a LifeCycleManager and then tracked wherever it gets moved.

Warning
Type T must be copy-constructable if you use this LifeCycle constructor.
Parameters
valuethe original value of this T instance

Definition at line 379 of file lifecycle.h.

◆ LifeCycle() [3/4]

template<typename T >
lifecycle::LifeCycle< T >::LifeCycle ( T &&  value)
inlineexplicit

Create a new LifeCycle<T> mixin for object value of type T.

This can be registered with a LifeCycleManager and then tracked wherever it gets moved.

Warning
Type T must be move-constructable if you use this LifeCycle constructor.
Parameters
valuethe original value of this T instance

Definition at line 391 of file lifecycle.h.

◆ LifeCycle() [4/4]

template<typename T >
lifecycle::LifeCycle< T >::LifeCycle ( LifeCycle< T > &&  that)
default

Crate a new LifeCycle<T> mixin object of type T, by moving an already existing LifeCycle<T> instance that.

Once this is constructed, that was automatically unregistered from its LifeCycleManager.

Parameters
thatthe rvalue of an existing LifeCycle<T> instance (possibly registered already or not) to be moved into this.
See also
std::move()
AbstractLifeCycleManager::move_()

◆ ~LifeCycle()

template<typename T >
lifecycle::LifeCycle< T >::~LifeCycle ( )
default

Destroy this LifeCycle<T> instance.

That destructor unregisters this instance from its LifeCycleManager (if already registered).

Member Function Documentation

◆ operator=()

template<typename T >
LifeCycle& lifecycle::LifeCycle< T >::operator= ( LifeCycle< T > &&  that)
default

Assign this LifeCycle<T> with that, by moving that already existing LifeCycle<T> instance.

Before assignment, this is automatically unregistered from its LifeCycleManager, if needed. Once assignment is completed, that was automatically unregistered from its LifeCycleManager.

Parameters
thatthe rvalue of an existing LifeCycle<T> instance (possibly registered already or not) to be moved into this.
See also
std::move()
AbstractLifeCycleManager::move_()

The documentation for this class was generated from the following file: