/* * Copyright 2016 Tobias Frust * * ConfigReader.h * * Created on: 18.04.2016 * Author: Tobias Frust (t.frust@hzdr.de) */ #ifndef CONFIGREADER_H #define CONFIGREADER_H #pragma once #include #include class ConfigReader { public: ConfigReader(const char* configFile); ConfigReader(const ConfigReader& configReader) { } template bool lookupValue(const std::string& identifier, T& value) { bool ret = cfg.lookupValue(identifier.c_str(), value); return ret; } template bool lookupValue(const std::string& identifier, int index, T& value) { libconfig::Setting& s = cfg.lookup(identifier.c_str()); if(s.getLength() > index){ value = s[index]; return true; } return false; } private: libconfig::Config cfg; }; #endif