diff options
Diffstat (limited to 'src/amun/common/config.h')
-rw-r--r-- | src/amun/common/config.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/amun/common/config.h b/src/amun/common/config.h new file mode 100644 index 00000000..73e0b04b --- /dev/null +++ b/src/amun/common/config.h @@ -0,0 +1,40 @@ +#pragma once + +#include <yaml-cpp/yaml.h> +#include <boost/program_options.hpp> + +#include "logging.h" + +namespace amunmt { + +class Config { + private: + YAML::Node config_; + + public: + std::string inputPath; + + bool Has(const std::string& key) const; + + YAML::Node Get(const std::string& key) const; + + template <typename T> + T Get(const std::string& key) const { + return config_[key].as<T>(); + } + + const YAML::Node& Get() const; + + void AddOptions(size_t argc, char** argv); + + template <class OStream> + friend OStream& operator<<(OStream& out, const Config& config) { + out << config.config_; + return out; + } + + void LogOptions(); +}; + +} + |