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
1a344e29
Commit
1a344e29
authored
5 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
implemented oneLevelUp without hiding
parent
6468ce67
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/EntityOwner.h
+1
-1
1 addition, 1 deletion
include/EntityOwner.h
include/Flags.h
+4
-1
4 additions, 1 deletion
include/Flags.h
src/EntityOwner.cc
+13
-11
13 additions, 11 deletions
src/EntityOwner.cc
tests/executables_src/testFindTag.cc
+8
-3
8 additions, 3 deletions
tests/executables_src/testFindTag.cc
with
26 additions
and
16 deletions
include/EntityOwner.h
+
1
−
1
View file @
1a344e29
...
...
@@ -211,7 +211,7 @@ namespace ChimeraTK {
* 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
,
bool
eliminateFirstHierarchy
,
bool
negate
,
VirtualModule
&
root
)
const
;
bool
eliminateFirstHierarchy
,
bool
negate
,
VirtualModule
&
root
,
VirtualModule
*
ownerOfModule
)
const
;
/** The name of this instance */
std
::
string
_name
;
...
...
This diff is collapsed.
Click to expand it.
include/Flags.h
+
4
−
1
View file @
1a344e29
...
...
@@ -41,7 +41,10 @@ namespace ChimeraTK {
moveToRoot
,
///< The module at which this flag is specified is moved to the root level, together with the entire
///< structure below the module. Note: Unless you run findTag() or so on the entire application, the
///< moved hierarchy structures might not be visible in the control system etc.
oneLevelUp
///< Move the structure in the module up to the level where the owner lives. Instead of adding a hierrarchy
oneLevelUp
,
///< Move the module up to the level where the owner lives. Instead of creating a "daughter"
///< of the owning module, it creates a "sister" (module that lives on the same level).
///< This modifyer can only be used in sub-modules, not on the first level
oneUpAndHide
///< Move the structure inside the module up to the level where the owner lives. Instead of adding a hierrarchy
///< level, one level is removed. This modifyer can only be used in sub-modules, not on the first level
///< inside an application.
};
...
...
This diff is collapsed.
Click to expand it.
src/EntityOwner.cc
+
13
−
11
View file @
1a344e29
...
...
@@ -101,12 +101,12 @@ namespace ChimeraTK {
// add everything matching the tag to the virtual module and return it
if
(
this
==
&
Application
::
getInstance
())
{
// if this module is the top-level application, we need special treatment for HierarchyModifier::moveToRoot
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
false
,
module
);
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
false
,
module
,
nullptr
);
}
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
);
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
false
,
discard
,
nullptr
);
}
return
module
;
...
...
@@ -121,12 +121,12 @@ namespace ChimeraTK {
// add everything matching the tag to the virtual module and return it
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
);
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
true
,
module
,
nullptr
);
}
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
);
findTagAndAppendToModule
(
module
,
tag
,
false
,
true
,
true
,
discard
,
nullptr
);
}
return
module
;
}
...
...
@@ -134,17 +134,20 @@ namespace ChimeraTK {
/*********************************************************************************************************************/
void
EntityOwner
::
findTagAndAppendToModule
(
VirtualModule
&
module
,
const
std
::
string
&
tag
,
bool
eliminateAllHierarchies
,
bool
eliminateFirstHierarchy
,
bool
negate
,
VirtualModule
&
root
)
const
{
bool
eliminateAllHierarchies
,
bool
eliminateFirstHierarchy
,
bool
negate
,
VirtualModule
&
root
,
VirtualModule
*
ownerOfModule
)
const
{
VirtualModule
nextmodule
{
_name
,
_description
,
getModuleType
()};
VirtualModule
*
moduleToAddTo
;
VirtualModule
*
ownerOfModuleToAddTo
;
bool
needToAddSubModule
=
false
;
if
(
!
getEliminateHierarchy
()
&&
!
eliminateAllHierarchies
&&
!
eliminateFirstHierarchy
)
{
moduleToAddTo
=
&
nextmodule
;
ownerOfModuleToAddTo
=
&
module
;
needToAddSubModule
=
true
;
}
else
{
moduleToAddTo
=
&
module
;
ownerOfModuleToAddTo
=
ownerOfModule
;
}
// add nodes to the module if matching the tag
...
...
@@ -171,11 +174,11 @@ 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
,
root
);
submodule
->
findTagAndAppendToModule
(
*
existingSubModule
,
tag
,
eliminateAllHierarchies
,
true
,
negate
,
root
,
ownerOfModuleToAddTo
);
}
else
{
// does not yet exist: add as new submodule to the current module
submodule
->
findTagAndAppendToModule
(
*
moduleToAddTo
,
tag
,
eliminateAllHierarchies
,
false
,
negate
,
root
);
submodule
->
findTagAndAppendToModule
(
*
moduleToAddTo
,
tag
,
eliminateAllHierarchies
,
false
,
negate
,
root
,
ownerOfModuleToAddTo
);
}
}
...
...
@@ -184,10 +187,9 @@ namespace ChimeraTK {
if
(
_hierarchyModifier
==
HierarchyModifier
::
moveToRoot
)
{
root
.
addSubModule
(
nextmodule
);
}
else
if
(
_hierarchyModifier
==
HierarchyModifier
::
moveToRoot
)
{
auto
owner
=
dynamic_cast
<
VirtualModule
*>
(
module
.
getOwner
());
if
(
owner
)
{
// the root does not have an owner.
owner
->
addSubModule
(
nextmodule
);
else
if
(
_hierarchyModifier
==
HierarchyModifier
::
oneLevelUp
)
{
if
(
ownerOfModule
)
{
// the root does not have an owner.
ownerOfModule
->
addSubModule
(
nextmodule
);
}
else
{
throw
logic_error
(
std
::
string
(
"Module "
)
+
module
.
getName
()
+
...
...
This diff is collapsed.
Click to expand it.
tests/executables_src/testFindTag.cc
+
8
−
3
View file @
1a344e29
...
...
@@ -36,8 +36,12 @@ struct FirstHierarchy : ctk::ModuleGroup {
ctk
::
ScalarOutput
<
int
>
varC
{
this
,
"varC"
,
"MV/m"
,
"Desc"
};
struct
:
ctk
::
VariableGroup
{
using
ctk
::
VariableGroup
::
VariableGroup
;
ctk
::
ScalarPushInput
<
double
>
sisterOfVarGroup
{
this
,
"sisterOfVarGroup"
,
"MV/m"
,
"Desc"
};
}
movedUp
{
getOwner
(),
"youLNeverSee"
,
"minus one test"
,
ctk
::
HierarchyModifier
::
hideThis
,
{
"Partial"
}};
ctk
::
ScalarPushInput
<
double
>
nieceOfVarGroup
{
this
,
"nieceOfVarGroup"
,
"MV/m"
,
"Desc"
};
}
movedUp
{
this
,
"sisterGroupOfVarGroup"
,
"minus one test 1"
,
ctk
::
HierarchyModifier
::
oneLevelUp
,
{
"Partial"
}};
struct
:
ctk
::
VariableGroup
{
using
ctk
::
VariableGroup
::
VariableGroup
;
ctk
::
ScalarPushInput
<
double
>
sisterVarOfVarGroup
{
this
,
"sisterVarOfVarGroup"
,
"MV/m"
,
"Desc"
};
}
movedUpAndHidden
{
this
,
"youLNeverSee"
,
"minus one test 2"
,
ctk
::
HierarchyModifier
::
oneUpAndHide
,
{
"Partial"
}};
}
varGroup
{
this
,
"VarGroup"
,
"A group"
,
ctk
::
HierarchyModifier
::
none
,
{
"Exclude"
,
"Partial"
}};
struct
MoveToRoot
:
ctk
::
VariableGroup
{
...
...
@@ -90,13 +94,14 @@ BOOST_AUTO_TEST_CASE(testEverythingTag) {
app
.
findTag
(
"Everything"
).
connectTo
(
app
.
cs
);
ctk
::
TestFacility
test
;
test
.
runApplication
();
app
.
cs
.
dump
();
// check if all variables are found on the ControlSystem - read/write dummy values as a consistency check. We have
// different types and input/output mixed, so mixing up variables will be noticed.
test
.
writeScalar
<
int
>
(
"/first/TestModule/VarGroup/varA"
,
42
);
test
.
writeScalar
<
double
>
(
"/first/TestModule/VarGroup/varB"
,
3.14
);
test
.
readScalar
<
int
>
(
"/first/TestModule/VarGroup/varC"
);
test
.
writeScalar
<
double
>
(
"/first/TestModule/sisterOfVarGroup"
,
9.9
);
test
.
writeScalar
<
double
>
(
"/first/TestModule/sister
GroupOfVarGroup/niece
OfVarGroup"
,
9.9
);
test
.
writeScalar
<
std
::
string
>
(
"/first/TestModule/varA"
,
"Hallo123"
);
test
.
readScalar
<
float
>
(
"/first/TestModule/varX"
);
for
(
size_t
i
=
0
;
i
<
22
;
++
i
)
{
...
...
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