lintel 0.2.0
Loading...
Searching...
No Matches
StartupBuilder.h
Go to the documentation of this file.
1#ifndef LINTEL_STARTUPBUILDER_H
2#define LINTEL_STARTUPBUILDER_H
3
4#include <atomic>
5#include <condition_variable>
6#include <memory>
7#include <mutex>
8#include <string>
9#include <thread>
10#include <vector>
11
13
14namespace lintel {
15class AbstractServiceInterface;
16class Component;
17class Configuration;
18class ConfigurationComponentBuilder;
19class FeatureInterface;
20class Features;
21class ProcessName;
22
23}// namespace lintel
24namespace lintel {
25namespace di {
26 class Container;
27}// namespace di
28}// namespace lintel
29
30namespace lintel {
33{
34private:
35 std::vector<std::shared_ptr<FeatureInterface>> m_featureVec;
36 std::shared_ptr<lintel::di::Container> m_container = nullptr;
37 std::shared_ptr<ProcessName> m_name;
38 std::vector<std::shared_ptr<AbstractServiceInterface>> m_abstractServices;
39 std::thread m_signalThread;
40 std::condition_variable m_conditionVariable;
41 std::atomic_bool m_stop = false;
42 std::vector<std::string> m_arguments;
43 std::shared_ptr<EnvironmentConfiguration> m_environmentConfiguration = nullptr;
44 std::shared_ptr<ConfigurationComponentBuilder> m_configurationComponentBuilder;
45 std::shared_ptr<Configuration> m_configuration = nullptr;
46 std::shared_ptr<Features> m_features = std::make_shared<Features>();
47 bool m_bootStrapServiceActive = true;
48 std::mutex mutex;
49
50public:
54 StartupBuilder(ProcessName &&processName, std::vector<std::string> &&arguments);
55
56 StartupBuilder() = delete;
57
62 static std::shared_ptr<StartupBuilder> with(int argc, char **argv);
63
66 void addConfigurationComponent(std::shared_ptr<Component> &&component);
67
70 template<typename FEATURE> void addFeature() { m_featureVec.push_back(std::make_shared<FEATURE>(m_features)); }
71
74
77 void withOutFeature(std::string_view nameOfFeature);
78
82 void overrides(EnvironmentConfiguration::Environment environment, std::string value);
83
85 void onShutdown();
86
89
91 void start();
92};
93
94}// namespace lintel
95#endif// LINTEL_STARTUPBUILDER_H
Environment
Definition EnvironmentConfiguration.h:16
Definition ProcessName.h:13
Definition StartupBuilder.h:33
void addFeature()
Definition StartupBuilder.h:70
StartupBuilder(ProcessName &&processName, std::vector< std::string > &&arguments)
static std::shared_ptr< StartupBuilder > with(int argc, char **argv)
void overrides(EnvironmentConfiguration::Environment environment, std::string value)
void addConfigurationComponent(std::shared_ptr< Component > &&component)
void withOutFeature(std::string_view nameOfFeature)
Definition Container.h:190
Definition BaseFeature.h:6