lintel 0.2.0
Loading...
Searching...
No Matches
Configuration.h
Go to the documentation of this file.
1#ifndef LINTEL_CONFIGURATION_H
2#define LINTEL_CONFIGURATION_H
3
4#include <filesystem>
5#include <map>
6#include <memory>
7#include <vector>
8
9#include "Component.h"
10#include "Entry.h"
13
14namespace lintel {
25{
26private:
28 std::map<std::string, std::shared_ptr<Component>> m_components;
30 std::vector<std::shared_ptr<Entry>> m_configurationEntries;
32 std::shared_ptr<EnvironmentConfiguration> m_environmentConfiguration;
34 std::filesystem::path m_configurationFile;
35
37 void loadConfiguration();
38
42 static std::map<std::string, std::shared_ptr<Component>> initialize(
43 const std::vector<std::shared_ptr<Component>> &tempComponents);
44
45public:
49 explicit Configuration(const std::vector<std::shared_ptr<Component>> &components,
50 std::shared_ptr<EnvironmentConfiguration> EnvironmentConfiguration);
51
54 void setEntries(std::vector<std::shared_ptr<Entry>> entries);
55
59 template<typename COMPONENT> std::vector<std::shared_ptr<Entry>> configurationOf()
60 {
61 const std::string_view nameOfComponent = type_name<COMPONENT>();
62 std::vector<std::shared_ptr<Entry>> tempEntries;
63 for (auto &entry : m_configurationEntries) {
64 if (entry->getConfigurationParserComponent() == nameOfComponent) { tempEntries.push_back(entry); }
65 }
66 return tempEntries;
67 }
68};
69
70}// namespace lintel
71#endif// LINTEL_CONFIGURATION_H
Definition Configuration.h:25
std::vector< std::shared_ptr< Entry > > configurationOf()
Definition Configuration.h:59
Configuration(const std::vector< std::shared_ptr< Component > > &components, std::shared_ptr< EnvironmentConfiguration > EnvironmentConfiguration)
void setEntries(std::vector< std::shared_ptr< Entry > > entries)
Definition EnvironmentConfiguration.h:13
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9