Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Jul 30, 2024
1 parent f6a5ecd commit 506b835
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/metkit/mars/TypeParam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>::const_iterator j = values_.begin(); j != values_.end(); ++j) {
Expand Down Expand Up @@ -379,6 +378,7 @@ static void init() {

static bool metkitLegacyParamCheck = eckit::Resource<bool>("metkitLegacyParamCheck;$METKIT_LEGACY_PARAM_CHECK", false);
static bool metkitRawParam = eckit::Resource<bool>("metkitRawParam;$METKIT_RAW_PARAM", false);

if (metkitLegacyParamCheck || (!metkitRawParam)) {
eckit::Value r = eckit::YAMLParser::decodeFile(LibMetkit::paramYamlFile());
ASSERT(r.isList());
Expand Down Expand Up @@ -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
Expand All @@ -435,7 +436,6 @@ static void init() {

std::set<std::string> shortnames;
std::set<std::string> associatedIDs;
// eckit::ValueList unambiguousIDs;

const eckit::Value pc = eckit::YAMLParser::decodeFile(LibMetkit::shortnameContextYamlFile());
ASSERT(pc.isList());
Expand All @@ -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);
Expand Down Expand Up @@ -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_ << "]";
Expand All @@ -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;;
Expand Down

0 comments on commit 506b835

Please sign in to comment.