6 #ifndef KAGOME_APPLICATION_DISPATCHER 7 #define KAGOME_APPLICATION_DISPATCHER 68 template <
typename Controlled>
71 [&entity]() ->
bool {
return entity.start(); },
72 [&entity]() ->
void {
return entity.stop(); });
76 virtual void run() = 0;
92 :
std::runtime_error(
"Wrong workflow at " +
std::move(message)) {}
96 #endif // KAGOME_APPLICATION_DISPATCHER virtual void atShutdown(OnShutdown &&cb)=0
Execute.
virtual void run()=0
Start application life cycle.
std::function< bool()> OnLaunch
AppStateException(std::string message)
virtual void doPrepare()=0
virtual void atPrepare(OnPrepare &&cb)=0
Execute.
virtual void doLaunch()=0
virtual void atLaunch(OnLaunch &&cb)=0
Execute.
std::function< bool()> OnPrepare
void registerHandlers(OnPrepare &&prepare_cb, OnLaunch &&launch_cb, OnShutdown &&shutdown_cb)
Registration of all stages' handlers at the same time.
virtual void shutdown()=0
Initiate shutting down (at any time)
virtual ~AppStateManager()=default
std::function< void()> OnShutdown
virtual void doShutdown()=0
void takeControl(Controlled &entity)
Registration special methods of object as handlers for stages of application life-cycle.
virtual State state() const =0
Get current stage.