/* * This file is part of the Owl Positioning System (OwlPS) project. * It is subject to the copyright notice and license terms in the * COPYRIGHT.t2t file found in the top-level directory of this * distribution and at * https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t * No part of the OwlPS Project, including this file, may be copied, * modified, propagated, or distributed except according to the terms * contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be * distributed along with this file, either separately or by replacing * this notice by the COPYRIGHT.t2t file's contents. */ #include "configuration.hh" using namespace std ; namespace po = boost::program_options ; /* *** Attribute definitions *** */ po::variables_map Configuration::configuration ; /* *** Read accessors *** */ po::variables_map& Configuration::getw_configuration() { return configuration ; } bool Configuration::is_configured(const string &key) { if (configuration.count(key)) return true ; return false ; } const std::string& Configuration::string_value(const string &key) { return configuration[key].as() ; } int Configuration::int_value(const string &key) { return configuration[key].as() ; } unsigned int Configuration::uint_value(const string &key) { return configuration[key].as() ; } float Configuration::float_value(const string &key) { return configuration[key].as() ; } bool Configuration::bool_value(const string &key) { return configuration[key].as() ; } /** * @returns `true` if the string `value` exists in the vector `key.` * @returns `false` if `value` is not found in `key.` */ bool Configuration:: value_exists_in_string_vector(const string &key, const string &value) { if (! is_configured(key)) return false ; vector key_values = configuration[key].as< vector >() ; for (auto i = key_values.begin() ; i != key_values.end() ; ++i) if (*i == value) return true ; return false ; } const vector& Configuration:: string_vector_value(const string &key) { return configuration[key].as< vector >() ; } bool Configuration::autocalibration_enabled() { return string_value("positioning.generate-reference-points") != "false" ; }