Skip to content
Snippets Groups Projects
Commit 7b0bf7c6 authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH: add the parents and the children of each parameter

parent 4b3a0fe7
No related branches found
No related tags found
No related merge requests found
......@@ -93,7 +93,7 @@ ParameterGroup::AddChoice(std::string paramKey, std::string paramName)
// Split the parameter name
std::vector<std::string> splittedKey = pKey.Split();
if( splittedKey.size() >1 )
if( splittedKey.size() > 1 )
{
// Get the last subkey
std::string lastkey = pKey.GetLastElement();
......@@ -321,6 +321,16 @@ ParameterGroup::AddParameter(ParameterType type, std::string paramKey, std::stri
newParam->SetKey(lastkey);
newParam->SetName(paramName);
// If splittedKey is greater than 1, that means that the parameter
// is not a root, and have a parent(s):
// - Add the parent as root of this param
// - Add the param as a child of its parents
if (splittedKey.size() > 1)
{
newParam->SetRoot(parentParam);
parentParam->AddChild(newParam);
}
parentAsGroup->AddParameter(newParam);
}
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment