sgns::application::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.
Reimplemented by: sgns::application::AppStateManagerImpl::atPrepare
function atLaunch¶
Execute a callback immediately before application start.
Parameters:
- cb Callback to execute.
Reimplemented by: sgns::application::AppStateManagerImpl::atLaunch
function atShutdown¶
Execute a callback during shutdown.
Parameters:
- cb Callback to execute.
Reimplemented by: sgns::application::AppStateManagerImpl::atShutdown
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.
Reimplemented by: sgns::application::AppStateManagerImpl::run
function shutdown¶
Initiate shutting down (at any time).
Reimplemented by: sgns::application::AppStateManagerImpl::shutdown
function state¶
Get current stage.
Reimplemented by: sgns::application::AppStateManagerImpl::state
Protected Functions Documentation¶
function doPrepare¶
Reimplemented by: sgns::application::AppStateManagerImpl::doPrepare
function doLaunch¶
Reimplemented by: sgns::application::AppStateManagerImpl::doLaunch
function doShutdown¶
Reimplemented by: sgns::application::AppStateManagerImpl::doShutdown
Updated on 2026-03-04 at 13:10:43 -0800