diff --git a/src/configuration.cc b/src/configuration.cc index 74654b7e204f5ab3d2774aa7ec80952e555b4c2b..592e644cd1401fff59d5b68977044ffb71cbda74 100644 --- a/src/configuration.cc +++ b/src/configuration.cc @@ -230,6 +230,24 @@ namespace MUSIC { return true; // Doesn't happen! Just for compiler! } + bool + Configuration::lookup (std::string name, bool* result) + { + std::map<std::string, std::string>::iterator pos = dict_.find (name); + if (pos == dict_.end ()) + return defaultConfig_ && defaultConfig_->lookup (name, result); + + std::istringstream iss(pos->second); + if (! (iss >> std::boolalpha >> *result).fail ()) + return true; + + std::ostringstream oss; + oss << "var " << name << " given wrong type (" << pos->second + << "; expected bool) in config file"; + error(oss.str ()); + return true; // Doesn't happen! Just for compiler! + } + std::string Configuration::Name () { diff --git a/src/music/configuration.hh b/src/music/configuration.hh index 4d3ff000719391c64cb37679e4630c05552e5e34..841f279a38696281f3bde1c02c3464bce9cb81b4 100644 --- a/src/music/configuration.hh +++ b/src/music/configuration.hh @@ -64,6 +64,8 @@ namespace MUSIC { bool lookup(std::string name, std::string* result); + bool lookup (std::string name, bool* result); + void insert (std::string name, std::string value); const ConfigDict &getDict(); diff --git a/src/music/setup.hh b/src/music/setup.hh index 8fb1717e29c642171b81e3f0962753ad798f1294..6b58b3e3dee79b58877c9b01f230c9404a331c5f 100644 --- a/src/music/setup.hh +++ b/src/music/setup.hh @@ -67,6 +67,8 @@ namespace MUSIC { bool config (string var, double* result); + bool config (string var, bool* result); + ContInputPort* publishContInput (string identifier); ContOutputPort* publishContOutput (string identifier); diff --git a/src/setup.cc b/src/setup.cc index b0c964fac6f1cf4c2b2b6004bc61c16b31871a13..5f2895a7510336015f03133b9cad9d4c8090cc63 100644 --- a/src/setup.cc +++ b/src/setup.cc @@ -398,6 +398,13 @@ namespace MUSIC { return config_->lookup (var, result); } + + bool + Setup::config (string var, bool* result) + { + return config_->lookup (var, result); + } + ContInputPort* Setup::publishContInput (std::string identifier)