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
269be6c1
Commit
269be6c1
authored
6 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
implement HierarchyModifier::moveToRoot
parent
9b0ec308
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/EntityOwner.h
+2
-2
2 additions, 2 deletions
include/EntityOwner.h
src/EntityOwner.cc
+29
-6
29 additions, 6 deletions
src/EntityOwner.cc
with
31 additions
and
8 deletions
include/EntityOwner.h
+
2
−
2
View file @
269be6c1
...
...
@@ -195,8 +195,8 @@ namespace ChimeraTK {
/** Add the part of the tree structure matching the given tag to a
* VirtualModule. Users normally will use findTag() instead. "tag" is
* interpreted as a regular expression (see std::regex_match). */
void
findTagAndAppendToModule
(
VirtualModule
&
module
,
const
std
::
string
&
tag
,
bool
eliminateAllHierarchies
=
false
,
bool
eliminateFirstHierarchy
=
false
,
bool
negate
=
false
)
const
;
void
findTagAndAppendToModule
(
VirtualModule
&
module
,
const
std
::
string
&
tag
,
bool
eliminateAllHierarchies
,
bool
eliminateFirstHierarchy
,
bool
negate
,
VirtualModule
&
root
)
const
;
/** The name of this instance */
std
::
string
_name
;
...
...
This diff is collapsed.
Click to expand it.
src/EntityOwner.cc
+
29
−
6
View file @
269be6c1
...
...
@@ -14,6 +14,7 @@
#include
"Module.h"
#include
"ModuleGraphVisitor.h"
#include
"VirtualModule.h"
#include
"Application.h"
namespace
ChimeraTK
{
...
...
@@ -98,7 +99,16 @@ namespace ChimeraTK {
VirtualModule
module
{
_name
,
_description
,
getModuleType
()};
// add everything matching the tag to the virtual module and return it
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
);
if
(
this
==
&
Application
::
getInstance
())
{
// if this module is the top-level application, we need special treatment for HierarchyModifier::moveThisToRoot
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
false
,
module
);
}
else
{
// Not the top-level module: Things that are moved to the top-level are simply discarded
VirtualModule
discard
(
"discarded"
,
""
,
ModuleType
::
Invalid
);
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
false
,
discard
);
}
return
module
;
}
...
...
@@ -109,14 +119,22 @@ namespace ChimeraTK {
VirtualModule
module
{
_name
,
_description
,
getModuleType
()};
// add everything matching the tag to the virtual module and return it
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
true
);
if
(
this
==
&
Application
::
getInstance
())
{
// if this module is the top-level application, we need special treatment for HierarchyModifier::moveToRoot
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
true
,
module
);
}
else
{
// Not the top-level module: Things that are moved to the top-level are simply discarded
VirtualModule
discard
(
"discarded"
,
""
,
ModuleType
::
Invalid
);
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
true
,
discard
);
}
return
module
;
}
/*********************************************************************************************************************/
void
EntityOwner
::
findTagAndAppendToModule
(
VirtualModule
&
module
,
const
std
::
string
&
tag
,
bool
eliminateAllHierarchies
,
bool
eliminateFirstHierarchy
,
bool
negate
)
const
{
bool
eliminateAllHierarchies
,
bool
eliminateFirstHierarchy
,
bool
negate
,
VirtualModule
&
root
)
const
{
VirtualModule
nextmodule
{
_name
,
_description
,
getModuleType
()};
VirtualModule
*
moduleToAddTo
;
...
...
@@ -153,17 +171,22 @@ namespace ChimeraTK {
// exists: add to the existing module
auto
*
existingSubModule
=
dynamic_cast
<
VirtualModule
*>
(
moduleToAddTo
->
getSubmodule
(
submodule
->
getName
()));
assert
(
existingSubModule
!=
nullptr
);
submodule
->
findTagAndAppendToModule
(
*
existingSubModule
,
tag
,
eliminateAllHierarchies
,
true
,
negate
);
submodule
->
findTagAndAppendToModule
(
*
existingSubModule
,
tag
,
eliminateAllHierarchies
,
true
,
negate
,
root
);
}
else
{
// does not yet exist: add as new submodule to the current module
submodule
->
findTagAndAppendToModule
(
*
moduleToAddTo
,
tag
,
eliminateAllHierarchies
,
false
,
negate
);
submodule
->
findTagAndAppendToModule
(
*
moduleToAddTo
,
tag
,
eliminateAllHierarchies
,
false
,
negate
,
root
);
}
}
if
(
needToAddSubModule
)
{
if
(
nextmodule
.
getAccessorList
().
size
()
>
0
||
nextmodule
.
getSubmoduleList
().
size
()
>
0
)
{
module
.
addSubModule
(
nextmodule
);
if
(
_hierarchyModifier
!=
HierarchyModifier
::
moveToRoot
)
{
module
.
addSubModule
(
nextmodule
);
}
else
{
root
.
addSubModule
(
nextmodule
);
}
}
}
}
...
...
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