Skip to content

Commit c7c9f54

Browse files
committed
Fix in the parsing of ccdb-run-dependent options
1 parent 756634d commit c7c9f54

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

Framework/Core/src/DataDescriptorQueryBuilder.cxx

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,9 @@ std::vector<InputSpec> DataDescriptorQueryBuilder::parse(char const* config)
319319
if (*currentKey == "lifetime" && currentValue == "condition") {
320320
currentLifetime = Lifetime::Condition;
321321
}
322-
if (*currentKey == "ccdb-run-dependent" && (currentValue != "false" && currentValue != "0")) {
323-
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Bool, true, {}});
324-
} else if (*currentKey == "ccdb-run-dependent" && (currentValue == "false" || currentValue == "0")) {
325-
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Bool, false, {}});
326-
} else if (*currentKey == "ccdb-run-dependent") {
327-
error("ccdb-run-dependent can only be true or false");
322+
if (*currentKey == "ccdb-run-dependent") {
323+
int val = currentValue == "false" ? 0 : (currentValue == "true" ? 1 : std::stoi(*currentValue));
324+
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Int, val, {}});
328325
} else {
329326
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::String, *currentValue, {}});
330327
}
@@ -333,12 +330,9 @@ std::vector<InputSpec> DataDescriptorQueryBuilder::parse(char const* config)
333330
if (*currentKey == "lifetime" && currentValue == "condition") {
334331
currentLifetime = Lifetime::Condition;
335332
}
336-
if (*currentKey == "ccdb-run-dependent" && (currentValue != "false" && currentValue != "0")) {
337-
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Bool, true, {}});
338-
} else if (*currentKey == "ccdb-run-dependent" && (currentValue == "false" || currentValue == "0")) {
339-
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Bool, false, {}});
340-
} else if (*currentKey == "ccdb-run-dependent") {
341-
error("ccdb-run-dependent can only be true or false");
333+
if (*currentKey == "ccdb-run-dependent") {
334+
int val = currentValue == "false" ? 0 : (currentValue == "true" ? 1 : std::stoi(*currentValue));
335+
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Int, val, {}});
342336
} else {
343337
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::String, *currentValue, {}});
344338
}
@@ -347,12 +341,9 @@ std::vector<InputSpec> DataDescriptorQueryBuilder::parse(char const* config)
347341
if (*currentKey == "lifetime" && currentValue == "condition") {
348342
currentLifetime = Lifetime::Condition;
349343
}
350-
if (*currentKey == "ccdb-run-dependent" && (currentValue != "false" && currentValue != "0")) {
351-
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Bool, true, {}});
352-
} else if (*currentKey == "ccdb-run-dependent" && (currentValue == "false" || currentValue == "0")) {
353-
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Bool, false, {}});
354-
} else if (*currentKey == "ccdb-run-dependent") {
355-
error("ccdb-run-dependent can only be true or false");
344+
if (*currentKey == "ccdb-run-dependent") {
345+
int val = currentValue == "false" ? 0 : (currentValue == "true" ? 1 : std::stoi(*currentValue));
346+
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Int, val, {}});
356347
} else {
357348
attributes.push_back(ConfigParamSpec{*currentKey, VariantType::String, *currentValue, {}});
358349
}

0 commit comments

Comments
 (0)