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

revert last commit, cascading ApplicationModules should be avoided instead...

revert last commit, cascading ApplicationModules should be avoided instead (and should be prevented in future)
parent 5a45fa82
No related branches found
No related tags found
No related merge requests found
......@@ -54,8 +54,11 @@ namespace ChimeraTK {
/** Obtain the list of submodules associated with this instance */
const std::list<Module*>& getSubmoduleList() const { return moduleList; }
/** Obtain the list of accessors/variables associated with this instance and any submodules */
std::list<VariableNetworkNode> getAccessorListRecursive();
/** Obtain the list of accessors/variables associated with this instance and any variable groups. If the optional
* argument is set to true, also submodules (which have their own thread) are included. In that case, the
* accessors in the returned list may not be used (i.e. write or read data or initiate transfers) from the same
* thread and only connections may be registered between the accessors. */
std::list<VariableNetworkNode> getAccessorListRecursive(bool includeSubmodules = false);
/** Obtain the list of submodules associated with this instance and any submodules */
std::list<Module*> getSubmoduleListRecursive();
......
......@@ -12,6 +12,7 @@
#include "EntityOwner.h"
#include "Module.h"
#include "VirtualModule.h"
#include "VariableGroup.h"
namespace ChimeraTK {
......@@ -49,13 +50,17 @@ namespace ChimeraTK {
/*********************************************************************************************************************/
std::list<VariableNetworkNode> EntityOwner::getAccessorListRecursive() {
std::list<VariableNetworkNode> EntityOwner::getAccessorListRecursive(bool includeSubmodules) {
// add accessors of this instance itself
std::list<VariableNetworkNode> list = getAccessorList();
// iterate through submodules
for(auto submodule : getSubmoduleList()) {
auto sublist = submodule->getAccessorListRecursive();
// ignore anything that is not a VariableGroup if submodules should not be included
/// @todo Add test for this!
if(!includeSubmodules && dynamic_cast<VariableGroup*>(submodule) == nullptr) continue;
// obtail list of accessors from the submodule/group and insert it into the list
auto sublist = submodule->getAccessorListRecursive(includeSubmodules);
list.insert(list.end(), sublist.begin(), sublist.end());
}
return list;
......@@ -156,7 +161,7 @@ namespace ChimeraTK {
VirtualModule EntityOwner::flatten() {
VirtualModule nextmodule{_name, _description};
for(auto &node : getAccessorListRecursive()) {
for(auto &node : getAccessorListRecursive(true)) {
nextmodule.registerAccessor(node);
}
return nextmodule;
......
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