@@ -395,7 +395,9 @@ void ConfigurableParam::printAllRegisteredParamNames()
395395// It can be in JSON or INI format.
396396// If nonempty comma-separated paramsList is provided, only those params will
397397// be updated, absence of data for any of requested params will lead to fatal
398- void ConfigurableParam::updateFromFile (std::string const & configFile, std::string const & paramsList)
398+ // If unchangedOnly is true, then only those parameters whose provenance is kCODE will be updated
399+ // (to allow prefernce of run-time settings)
400+ void ConfigurableParam::updateFromFile (std::string const & configFile, std::string const & paramsList, bool unchangedOnly)
399401{
400402 if (!sIsFullyInitialized ) {
401403 initialize ();
@@ -413,7 +415,9 @@ void ConfigurableParam::updateFromFile(std::string const& configFile, std::strin
413415 auto request = splitString (paramsList, ' ,' , true );
414416 std::unordered_map<std::string, int > requestMap;
415417 for (const auto & par : request) {
416- requestMap[par] = 0 ;
418+ if (!par.empty ()) {
419+ requestMap[par] = 0 ;
420+ }
417421 }
418422
419423 try {
@@ -430,8 +434,10 @@ void ConfigurableParam::updateFromFile(std::string const& configFile, std::strin
430434 auto name = subKey.first ;
431435 auto value = subKey.second .get_value <std::string>();
432436 std::string key = mainKey + " ." + name;
433- std::pair<std::string, std::string> pair = std::make_pair (key, trimSpace (value));
434- keyValPairs.push_back (pair);
437+ if (!unchangedOnly || getProvenance (key) == kCODE ) {
438+ std::pair<std::string, std::string> pair = std::make_pair (key, trimSpace (value));
439+ keyValPairs.push_back (pair);
440+ }
435441 }
436442 }
437443 } catch (std::exception const & error) {
0 commit comments