AppStateManager¶
#include <app_state_manager.hpp>
Inherits from std::enable_shared_from_this< AppStateManager >, IComponent
Inherited by sgns::application::AppStateManagerImpl
Public Types¶
| Name | |
|---|---|
| enum class | State |
| using std::function< bool()> | OnPrepare |
| using std::function< bool()> | OnLaunch |
| using std::function< void()> | OnShutdown |
Public Functions¶
| Name | |
|---|---|
| ~AppStateManager() override =default | |
| virtual void | atPrepare(OnPrepare && cb) =0 Execute a callback at the prepare stage. |
| virtual void | atLaunch(OnLaunch && cb) =0 Execute a callback immediately before application start. |
| virtual void | atShutdown(OnShutdown && cb) =0 Execute a callback during shutdown. |
| void | registerHandlers(OnPrepare && prepare_cb, OnLaunch && launch_cb, OnShutdown && shutdown_cb) Registration of all stages' handlers at the same time. |
| template <typename Controlled > void |
takeControl(Controlled & entity) Registration special methods of object as handlers for stages of application life-cycle. |
| virtual void | run() =0 Start application life cycle. |
| virtual void | shutdown() =0 Initiate shutting down (at any time). |
| virtual State | state() const =0 Get current stage. |
Protected Functions¶
| Name | |
|---|---|
| virtual void | doPrepare() =0 |
| virtual void | doLaunch() =0 |
| virtual void | doShutdown() =0 |
Additional inherited members¶
Public Functions inherited from IComponent
| Name | |
|---|---|
| virtual | ~IComponent() =default |
| virtual std::string | GetName() =0 |
Public Types Documentation¶
enum State¶
| Enumerator | Value | Description |
|---|---|---|
| Init | ||
| Prepare | ||
| ReadyToStart | ||
| Starting | ||
| Works | ||
| ShuttingDown | ||
| ReadyToStop |
using OnPrepare¶
using OnLaunch¶
using OnShutdown¶
Public Functions Documentation¶
function ~AppStateManager¶
function atPrepare¶
Execute a callback at the prepare stage.
Parameters:
- cb Callback to execute.
function atLaunch¶
Execute a callback immediately before application start.
Parameters:
- cb Callback to execute.
function atShutdown¶
Execute a callback during shutdown.
Parameters:
- cb Callback to execute.
function registerHandlers¶
inline void registerHandlers(
OnPrepare && prepare_cb,
OnLaunch && launch_cb,
OnShutdown && shutdown_cb
)
Registration of all stages' handlers at the same time.
Parameters:
- prepare_cb - handler for stage of prepare
- launch_cb - handler for doing immediately before start application
- shutdown_cb - handler for stage of shutting down application
function takeControl¶
Registration special methods of object as handlers for stages of application life-cycle.
Parameters:
- entity is registered entity
function run¶
Start application life cycle.
function shutdown¶
Initiate shutting down (at any time).
function state¶
Get current stage.
Protected Functions Documentation¶
function doPrepare¶
function doLaunch¶
function doShutdown¶
Updated on 2026-03-04 at 13:10:44 -0800