Parameters::getFlattenedKeyList can now be an implementation detail

This commit is contained in:
Arne Morten Kvarving 2024-09-02 15:59:20 +02:00
parent 410039206d
commit 77dc5ad895
2 changed files with 18 additions and 22 deletions

View File

@ -38,6 +38,24 @@
namespace {
void getFlattenedKeyList(std::list<std::string>& dest,
const Dune::ParameterTree& tree,
const std::string& prefix = "")
{
// add the keys of the current sub-structure
for (const auto& valueKey : tree.getValueKeys()) {
std::string newKey(prefix + valueKey);
dest.push_back(newKey);
}
// recursively add all substructure keys
for (const auto& subKey : tree.getSubKeys()) {
std::string newPrefix(prefix + subKey + '.');
getFlattenedKeyList(dest, tree.sub(subKey), newPrefix);
}
}
std::string parseKey(std::string& s)
{
unsigned i;
@ -454,24 +472,6 @@ void getLists(std::vector<Parameter>& usedParams,
}
}
void getFlattenedKeyList(std::list<std::string>& dest,
const Dune::ParameterTree& tree,
const std::string& prefix)
{
// add the keys of the current sub-structure
for (const auto& valueKey : tree.getValueKeys()) {
std::string newKey(prefix + valueKey);
dest.push_back(newKey);
}
// recursively add all substructure keys
for (const auto& subKey : tree.getSubKeys()) {
std::string newPrefix(prefix + subKey + '.');
getFlattenedKeyList(dest, tree.sub(subKey), newPrefix);
}
}
// print the values of a list of parameters
void printParamList(std::ostream& os,
const std::list<std::string>& keyList,
bool printDefaults)

View File

@ -178,10 +178,6 @@ std::string breakLines(const std::string& msg,
int getTtyWidth();
void getFlattenedKeyList(std::list<std::string>& dest,
const Dune::ParameterTree& tree,
const std::string& prefix = "");
// print the values of a list of parameters
void printParamList(std::ostream& os,
const std::list<std::string>& keyList,