Skip to content
Snippets Groups Projects
Commit f614af87 authored by Martin Killenberg's avatar Martin Killenberg
Browse files

introduced clear() to VariableMapper to avoid code duplication and simplify testing

parent 8397faac
No related branches found
No related tags found
No related merge requests found
......@@ -65,6 +65,9 @@ namespace ChimeraTK{
void directImport(std::set< std::string > inputVariables);
// empty the created mapping
void clear();
protected:
VariableMapper()=default;
......
......@@ -111,13 +111,14 @@ namespace ChimeraTK{
propertyName = std::regex_replace(nameSource, std::regex("/"), ".");
locationName = importLocationName;
}
_inputSortedDescriptions[processVariable] = PropertyDescription(locationName, propertyName);
}
}
}
void VariableMapper::prepareOutput(std::string xmlFile, std::set< std::string > inputVariables){
clear();
_inputVariables=inputVariables;
xmlpp::DomParser parser;
......@@ -126,10 +127,6 @@ namespace ChimeraTK{
parser.parse_file(xmlFile);
if(parser){
_locationDefaults.clear();
_globalDefaults = PropertyAttributes();
_inputSortedDescriptions.clear();
//Walk the tree:
const xmlpp::Node* rootNode = parser.get_document()->get_root_node(); //deleted by DomParser.
......@@ -168,12 +165,16 @@ namespace ChimeraTK{
}
void VariableMapper::directImport(std::set< std::string > inputVariables){
clear();
_inputVariables=inputVariables;
import("/",""); // import from /, create location names from first level of the tree
}
void VariableMapper::clear(){
_inputVariables.clear();
_locationDefaults.clear();
_globalDefaults = PropertyAttributes();
_inputSortedDescriptions.clear();
import("/",""); // import from /, create location names from first level of the tree
}
} // namespace ChimeraTK
......
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