#pragma once #include "ddkit/base/ConfigRw.hpp" #include "ddkit/base/ConfigLoader.hpp" #include "ddkit/access/System.hpp" #include #include #include #include namespace ddkit { namespace access { /// @brief ConfigLoaderDds holds the ConfigLoader (Config) and the DdsSystem (process-wide dds-initialization) /// if created before everything else (on the stack), this will do for clean termination. class ConfigLoaderDds; typedef std::shared_ptr ConfigLoaderDdsPtr; class ConfigLoaderDds { public: ConfigLoaderDds(); ConfigLoaderDds(const std::string& configFile); ~ConfigLoaderDds(); base::IConfig& config() { return m_configRw; } base::IConfigWrite& configWrite() { return m_configRw; } // checks all keys, which start '
.' to be '
.' with a from given list // - checks whole config(-file) right now. // - enables checking from now on in all calls to above config-functions has(), get(), set(). // the checking-function will throw, if a violation is detected. void registerKnownConfigKey(const std::string& section, const std::string& key); void reloadConfig(const std::string& configFile); static ConfigLoaderDdsPtr instance(); private: // no copying ConfigLoaderDds(ConfigLoaderDds const&) = delete; ConfigLoaderDds(ConfigLoaderDds&&) = delete; void operator=(ConfigLoaderDds const&) = delete; void operator=(ConfigLoaderDds&&) = delete; void loadDefaultTerminateHandlers(); std::unique_ptr m_configLoader; base::ConfigRw m_configRw; }; } // namespace access } // namespace ddkit