From 506b83512587965779c61c633dd069c2961d83e6 Mon Sep 17 00:00:00 2001 From: Emanuele Danovaro Date: Tue, 30 Jul 2024 08:10:12 +0200 Subject: [PATCH] cleanup --- src/metkit/mars/TypeParam.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/metkit/mars/TypeParam.cc b/src/metkit/mars/TypeParam.cc index 651f7d18..f417f221 100644 --- a/src/metkit/mars/TypeParam.cc +++ b/src/metkit/mars/TypeParam.cc @@ -328,7 +328,6 @@ std::string Rule::lookup(const MarsExpandContext& ctx, const std::string & s, bo } oss << table * 1000 + param; - // return metkit::mars::MarsLanguage::bestMatch(oss.str(), values_, fail, false, mapping_, this); std::string p = oss.str(); for (std::vector::const_iterator j = values_.begin(); j != values_.end(); ++j) { @@ -379,6 +378,7 @@ static void init() { static bool metkitLegacyParamCheck = eckit::Resource("metkitLegacyParamCheck;$METKIT_LEGACY_PARAM_CHECK", false); static bool metkitRawParam = eckit::Resource("metkitRawParam;$METKIT_RAW_PARAM", false); + if (metkitLegacyParamCheck || (!metkitRawParam)) { eckit::Value r = eckit::YAMLParser::decodeFile(LibMetkit::paramYamlFile()); ASSERT(r.isList()); @@ -425,7 +425,8 @@ static void init() { return; } - Rule::setDefault(ids.keys(), ids); + auto keys = ids.keys(); + Rule::setDefault(keys, ids); if (metkitRawParam) { // empty rule, to enable default @@ -435,7 +436,6 @@ static void init() { std::set shortnames; std::set associatedIDs; - // eckit::ValueList unambiguousIDs; const eckit::Value pc = eckit::YAMLParser::decodeFile(LibMetkit::shortnameContextYamlFile()); ASSERT(pc.isList()); @@ -444,8 +444,6 @@ static void init() { shortnames.emplace(pc[i]); } - auto keys = ids.keys(); - for (size_t i=0; i < keys.size(); i++) { auto el = ids.element(keys[i]); ASSERT(el.size() > 0); @@ -488,11 +486,9 @@ TypeParam::TypeParam(const std::string &name, const eckit::Value& settings) : if (settings.contains("first_rule")) { firstRule_ = settings["first_rule"]; } - } -TypeParam::~TypeParam() { -} +TypeParam::~TypeParam() {} void TypeParam::print(std::ostream &out) const { out << "TypeParam[name=" << name_ << "]"; @@ -513,7 +509,6 @@ bool TypeParam::expand(const MarsExpandContext& ctx, const MarsRequest& request, } } - if (!rule) { Log::warning() << "TypeParam: cannot find a context to expand 'param' in " << request << std::endl;;