Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
499fa143
Commit
499fa143
authored
4 years ago
by
Christoph Kampmeyer
Browse files
Options
Downloads
Patches
Plain Diff
wip #107: Detection of underlying instances:
Correctly navigate to parent module via virtual path.
parent
ad850856
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/src/StatusAggregator.cc
+55
-48
55 additions, 48 deletions
Modules/src/StatusAggregator.cc
with
55 additions
and
48 deletions
Modules/src/StatusAggregator.cc
+
55
−
48
View file @
499fa143
...
...
@@ -3,82 +3,89 @@
#include
<list>
#include
<regex>
namespace
ChimeraTK
{
namespace
ChimeraTK
{
void
StatusAggregator
::
populateStatusInput
(){
std
::
cout
<<
"Populating aggregator "
<<
getName
()
<<
", fully qualified name is: "
<<
getQualifiedName
()
<<
std
::
endl
;
void
StatusAggregator
::
populateStatusInput
()
{
std
::
cout
<<
"Populating aggregator "
<<
getName
()
<<
", fully qualified name is: "
<<
getQualifiedName
()
<<
std
::
endl
;
// This does not work, we need to operate on the virtual hierarchy
//std::list<Module*> subModuleList{getOwner()->getSubmoduleList()};
// This approach crashes
// auto subModuleList = getOwner()->findTag(".*").getSubmoduleList();
// for(auto module : subModuleList){
// auto subModuleList = getOwner()->findTag(".*").getSubmoduleList();
// std::cout << "Testing Module " << module->getName() << std::endl;
// auto accList{module->getAccessorList()};
// }
// for(auto module : subModuleList){
// std::cout << "Testing Module " << module->getName() << std::endl;
// auto accList{module->getAccessorList()};
// }
// Another try, virtualise the entire Application
auto
virtualApplication
Hierarchy
=
Application
::
getInstance
().
findTag
(
".*"
);
auto
virtual
ised
Application
=
Application
::
getInstance
().
findTag
(
".*"
);
auto
virtualPathToThis
=
getVirtualQualifiedName
();
std
::
cout
<<
" ** Fully qualified name in vitual hierarchy: "
//<< virtualApplicationHierarchy.getQualifiedName() << std::endl;
<<
getVirtualQualifiedName
()
<<
std
::
endl
;
// Split the name into individual modules
std
::
regex
pathsepRegex
{
"/"
};
std
::
sregex_token_iterator
name
{
virtualPathToThis
.
begin
(),
virtualPathToThis
.
end
(),
pathsepRegex
,
-
1
},
end
;
// Remove application name and name of leaf node from the path
auto
pathBegin
=
virtualPathToThis
.
find_first_not_of
(
"/"
+
Application
::
getInstance
().
getName
()
+
"/"
);
auto
pathEnd
=
virtualPathToThis
.
find_last_of
(
"/"
)
-
1
;
auto
pathWithoutAppAndLeafNode
{
virtualPathToThis
.
substr
(
pathBegin
,
pathEnd
-
pathBegin
+
1
)};
++
name
;
// Leave out first, empty match. FIXME: Should be avoided by regex
while
(
name
!=
end
){
std
::
cout
<<
"Current path elem: "
<<
*
(
name
++
)
<<
std
::
endl
;
std
::
list
<
VariableNetworkNode
>
allAccessors
;
std
::
list
<
Module
*>
allSubmodules
;
if
(
pathWithoutAppAndLeafNode
==
getName
())
{
// Path to this module, the parent is the Application
allAccessors
=
virtualisedApplication
.
getAccessorListRecursive
();
allSubmodules
=
virtualisedApplication
.
getSubmoduleListRecursive
();
std
::
cout
<<
"Parent is the Application"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"SubPath to this aggregator's parent : "
<<
pathWithoutAppAndLeafNode
<<
std
::
endl
;
Module
&
virtualParent
=
virtualisedApplication
.
submodule
(
virtualPathToThis
.
substr
(
pathBegin
,
pathEnd
-
pathBegin
+
1
));
// I can just call submodule instead of the above procedure
//Module& thisModule = virtualApplicationHierarchy.submodule(virtualPathToThis);
virtualParent
.
dump
();
allAccessors
=
virtualParent
.
getAccessorListRecursive
();
allSubmodules
=
virtualParent
.
getSubmoduleListRecursive
();
}
// Works, as long as we do not use HIerarchyModifiers other than "none" in the test app
// Update: This still has problems, because getOwner gives us the "real" C++ Module
// We need to do everything on the virtual plane
// auto allAccessors{getOwner()->findTag(".*").getAccessorListRecursive()};
//auto allAccessors{virtualParent.getAccessorListRecursive()};
//auto allSubmodules{virtualParent.getSubmoduleListRecursive()};
// std::cout << " Size of allAccessors: " << allAccessors.size() << std::endl;
std
::
cout
<<
" Size of allAccessors: "
<<
allAccessors
.
size
()
<<
std
::
endl
;
std
::
cout
<<
" Size of allSubmodules: "
<<
allSubmodules
.
size
()
<<
std
::
endl
;
// for(auto acc : allAccessors){
for
(
auto
acc
:
allAccessors
)
{
if
(
acc
.
getDirection
().
dir
==
VariableDirection
::
feeding
)
{
std
::
cout
<<
" -- Accessor: "
<<
acc
.
getName
()
<<
" of module: "
<<
acc
.
getOwningModule
()
->
getName
()
<<
std
::
endl
;
}
}
// if(acc.getDirection().dir == VariableDirection::feeding){
// std::cout << " -- Accessor: " << acc.getName()
// << " of module: " << acc.getOwningModule()->getName()
// << std::endl;
// if(dynamic_cast<StatusMonitor*>(module)){
// std::cout << " Found Monitor " << module->getName() << std::endl;
// }
// else if(dynamic_cast<StatusAggregator*>(module)){
// std::string moduleName = module->getName();
// }
// if(dynamic_cast<StatusMonitor*>(module)){
// std::cout << " Found Monitor " << module->getName() << std::endl;
// }
// else if(dynamic_cast<StatusAggregator*>(module)){
// std::string moduleName = module->getName();
// std::cout << "Found Aggregator " << moduleName << std::endl;
// std::cout << "Found Aggregator " << moduleName << std::endl;
// statusInput.emplace_back(this, moduleName, "", "");
// }
// else if(dynamic_cast<ModuleGroup*>(module)){
// std::cout << "Found ModuleGroup " << module->getName() << std::endl;
// }
// else{}
// }
// statusInput.emplace_back(this, moduleName, "", "");
// }
// else if(dynamic_cast<ModuleGroup*>(module)){
// std::cout << "Found ModuleGroup " << module->getName() << std::endl;
// }
// else{}
// }
std
::
cout
<<
std
::
endl
<<
std
::
endl
;
}
// poplateStatusInput()*/
}
}
// namespace ChimeraTK
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment