Kagome
Polkadot Runtime Engine in C++17
kagome::application::AppStateManager Class Referenceabstract

#include <app_state_manager.hpp>

Inheritance diagram for kagome::application::AppStateManager:
Collaboration diagram for kagome::application::AppStateManager:

Public Types

enum  State {
  State::Init, State::Prepare, State::ReadyToStart, State::Starting,
  State::Works, State::ShuttingDown, State::ReadyToStop
}
 
using OnPrepare = std::function< bool()>
 
using OnLaunch = std::function< bool()>
 
using OnShutdown = std::function< void()>
 

Public Member Functions

virtual ~AppStateManager ()=default
 
virtual void atPrepare (OnPrepare &&cb)=0
 Execute. More...
 
virtual void atLaunch (OnLaunch &&cb)=0
 Execute. More...
 
virtual void atShutdown (OnShutdown &&cb)=0
 Execute. More...
 
void registerHandlers (OnPrepare &&prepare_cb, OnLaunch &&launch_cb, OnShutdown &&shutdown_cb)
 Registration of all stages' handlers at the same time. More...
 
template<typename Controlled >
void takeControl (Controlled &entity)
 Registration special methods of object as handlers for stages of application life-cycle. More...
 
virtual void run ()=0
 Start application life cycle. More...
 
virtual void shutdown ()=0
 Initiate shutting down (at any time) More...
 
virtual State state () const =0
 Get current stage. More...
 

Protected Member Functions

virtual void doPrepare ()=0
 
virtual void doLaunch ()=0
 
virtual void doShutdown ()=0
 

Detailed Description

Definition at line 13 of file app_state_manager.hpp.

Member Typedef Documentation

using kagome::application::AppStateManager::OnLaunch = std::function<bool()>

Definition at line 16 of file app_state_manager.hpp.

using kagome::application::AppStateManager::OnPrepare = std::function<bool()>

Definition at line 15 of file app_state_manager.hpp.

using kagome::application::AppStateManager::OnShutdown = std::function<void()>

Definition at line 17 of file app_state_manager.hpp.

Member Enumeration Documentation

Enumerator
Init 
Prepare 
ReadyToStart 
Starting 
Works 
ShuttingDown 
ReadyToStop 

Definition at line 19 of file app_state_manager.hpp.

Constructor & Destructor Documentation

virtual kagome::application::AppStateManager::~AppStateManager ( )
virtualdefault

Member Function Documentation

virtual void kagome::application::AppStateManager::atLaunch ( OnLaunch &&  cb)
pure virtual

Execute.

Parameters
cbimmediately before start application
cb

Implemented in kagome::application::AppStateManagerImpl.

virtual void kagome::application::AppStateManager::atPrepare ( OnPrepare &&  cb)
pure virtual

Execute.

Parameters
cbat stage of prepare application
cb

Implemented in kagome::application::AppStateManagerImpl.

virtual void kagome::application::AppStateManager::atShutdown ( OnShutdown &&  cb)
pure virtual

Execute.

Parameters
cbat stage of shutting down application
cb

Implemented in kagome::application::AppStateManagerImpl.

virtual void kagome::application::AppStateManager::doLaunch ( )
protectedpure virtual
virtual void kagome::application::AppStateManager::doPrepare ( )
protectedpure virtual
virtual void kagome::application::AppStateManager::doShutdown ( )
protectedpure virtual
void kagome::application::AppStateManager::registerHandlers ( OnPrepare &&  prepare_cb,
OnLaunch &&  launch_cb,
OnShutdown &&  shutdown_cb 
)
inline

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

Definition at line 55 of file app_state_manager.hpp.

virtual void kagome::application::AppStateManager::run ( )
pure virtual

Start application life cycle.

Implemented in kagome::application::AppStateManagerImpl.

virtual void kagome::application::AppStateManager::shutdown ( )
pure virtual

Initiate shutting down (at any time)

Implemented in kagome::application::AppStateManagerImpl.

virtual State kagome::application::AppStateManager::state ( ) const
pure virtual

Get current stage.

Implemented in kagome::application::AppStateManagerImpl.

template<typename Controlled >
void kagome::application::AppStateManager::takeControl ( Controlled &  entity)
inline

Registration special methods of object as handlers for stages of application life-cycle.

Parameters
entityis registered entity

Definition at line 69 of file app_state_manager.hpp.


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