Skip to content
Snippets Groups Projects
Commit af303333 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

fixed not returning the same submodule on a second call of the...

fixed not returning the same submodule on a second call of the ControlSystemModule::operator[] with the same module name
parent e912479d
No related branches found
No related tags found
No related merge requests found
......@@ -33,10 +33,7 @@ namespace ChimeraTK {
return operator()(variableName, typeid(AnyType));
}
Module& operator[](const std::string& moduleName) const override {
subModules.emplace_back(variableNamePrefix/moduleName);
return subModules.back();
}
Module& operator[](const std::string& moduleName) const override;
protected:
......@@ -44,7 +41,7 @@ namespace ChimeraTK {
// List of sub modules accessed through the operator[]. This is mutable since it is little more than a cache and
// thus does not change the logical state of this module
mutable std::list<ControlSystemModule> subModules;
mutable std::map<std::string, ControlSystemModule> subModules;
// List of variables accessed through the operator(). This is mutable since it is little more than a cache and
// thus does not change the logical state of this module
......
......@@ -25,4 +25,13 @@ namespace ChimeraTK {
return variables[variableName];
}
/*********************************************************************************************************************/
Module& ControlSystemModule::operator[](const std::string& moduleName) const {
if(subModules.count(moduleName) == 0) {
subModules[moduleName] = {variableNamePrefix/moduleName};
}
return subModules[moduleName];
}
}
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