Consolix
Loading...
Searching...
No Matches
application_utils.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef _CONSOLIX_APPLICATION_UTILS_HPP_INCLUDED
3#define _CONSOLIX_APPLICATION_UTILS_HPP_INCLUDED
4
23
24namespace consolix {
25
32
37 template <typename InitAction>
38 void init(InitAction init_action) {
41 }
42
49 template <typename Component, typename... Args>
50 inline std::shared_ptr<Component> add(Args&&... args) {
51 return ConsoleApplication::get_instance().add<Component>(std::forward<Args>(args)...);
52 }
53
57 inline void add(std::shared_ptr<IAppComponent> component) {
58 ConsoleApplication::get_instance().add(std::move(component));
59 }
60
63 inline void run() {
65 }
66
72 template <typename IterationAction>
73 inline void run(IterationAction iteration_action) {
74 ConsoleApplication::get_instance().run(iteration_action);
75 }
76
79 inline void stop() {
81 }
82
83}; // namespace consolix
84
85#endif // _CONSOLIX_APPLICATION_UTILS_HPP_INCLUDED
std::shared_ptr< Component > add(Args &&... args)
Adds a new component to the application.
void run()
Runs the application with the registered components.
static ConsoleApplication & get_instance()
Retrieves the singleton instance of the application.
void init()
Initializes the application and its components. This method initializes all components in the manager...
void stop()
Stops the application's main loop.
static ServiceLocator & get_instance()
Retrieves the singleton instance of the ServiceLocator.
< Utility modules and helpers.
std::shared_ptr< Component > add(Args &&... args)
Adds a new component to the application. Creates a new instance of the specified component type and a...
void run()
Runs the application. Processes all components in the application's main loop.
void init()
Initializes the application. This function prepares the application and service locator for use.
void stop()
Stops the application. Stops the application's main loop and begins the shutdown process.