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
a5b80eb5
Commit
a5b80eb5
authored
7 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
allow adding tags in the module constructor
parent
dd2c4502
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
+5
-1
5 additions, 1 deletion
include/EntityOwner.h
include/Module.h
+6
-3
6 additions, 3 deletions
include/Module.h
src/EntityOwner.cc
+4
-2
4 additions, 2 deletions
src/EntityOwner.cc
src/Module.cc
+2
-2
2 additions, 2 deletions
src/Module.cc
with
17 additions
and
8 deletions
include/EntityOwner.h
+
5
−
1
View file @
a5b80eb5
...
...
@@ -30,7 +30,7 @@ namespace ChimeraTK {
/** Constructor: register the EntityOwner with its owner */
EntityOwner
(
EntityOwner
*
owner
,
const
std
::
string
&
name
,
const
std
::
string
&
description
,
bool
eliminateHierarchy
=
false
);
bool
eliminateHierarchy
=
false
,
const
std
::
unordered_set
<
std
::
string
>
&
tags
=
{}
);
/** Virtual destructor to make the type polymorphic */
virtual
~
EntityOwner
();
...
...
@@ -72,6 +72,7 @@ namespace ChimeraTK {
/** Called inside the constructor of Accessor: adds the accessor to the list */
void
registerAccessor
(
VariableNetworkNode
accessor
)
{
for
(
auto
&
tag
:
_tags
)
accessor
.
addTag
(
tag
);
accessorList
.
push_back
(
accessor
);
}
...
...
@@ -129,6 +130,9 @@ namespace ChimeraTK {
/** Flag whether this level of hierarchy should be eliminated or not */
bool
_eliminateHierarchy
{
false
};
/** List of tags to be added to all accessors and modules inside this module */
std
::
unordered_set
<
std
::
string
>
_tags
;
};
}
/* namespace ChimeraTK */
...
...
This diff is collapsed.
Click to expand it.
include/Module.h
+
6
−
3
View file @
a5b80eb5
...
...
@@ -19,10 +19,13 @@ namespace ChimeraTK {
public:
/** Constructor: register the module with its owner */
/** Constructor: register the module with its owner. If eliminateHierarchy is true, the hierarchy level
* introduced by this module will be eliminated from the "dynamic" data model (see
* EntityOwner::setEliminateHierarchy()). The tags given as the last argument are added to all variables
* in this module recursively (see EntityOwner::addTag()). */
Module
(
EntityOwner
*
owner
,
const
std
::
string
&
name
,
const
std
::
string
&
description
,
bool
eliminateHierarchy
=
false
);
bool
eliminateHierarchy
=
false
,
const
std
::
unordered_set
<
std
::
string
>
&
tags
=
{}
);
/** Default constructor: Allows late initialisation of modules (e.g. when creating arrays of modules).
*
* This construtor also has to be here to mitigate a bug in gcc. It is needed to allow constructor
...
...
This diff is collapsed.
Click to expand it.
src/EntityOwner.cc
+
4
−
2
View file @
a5b80eb5
...
...
@@ -16,8 +16,8 @@
namespace
ChimeraTK
{
EntityOwner
::
EntityOwner
(
EntityOwner
*
owner
,
const
std
::
string
&
name
,
const
std
::
string
&
description
,
bool
eliminateHierarchy
)
:
_name
(
name
),
_description
(
description
),
_owner
(
owner
),
_eliminateHierarchy
(
eliminateHierarchy
)
bool
eliminateHierarchy
,
const
std
::
unordered_set
<
std
::
string
>
&
tags
)
:
_name
(
name
),
_description
(
description
),
_owner
(
owner
),
_eliminateHierarchy
(
eliminateHierarchy
)
,
_tags
(
tags
)
{
if
(
owner
!=
nullptr
)
{
auto
thisMustBeAModule
=
static_cast
<
Module
*>
(
this
);
/// @todo TODO FIXME this is a bit dangerous...
...
...
@@ -37,6 +37,7 @@ namespace ChimeraTK {
/*********************************************************************************************************************/
void
EntityOwner
::
registerModule
(
Module
*
module
)
{
for
(
auto
&
tag
:
_tags
)
module
->
addTag
(
tag
);
moduleList
.
push_back
(
module
);
}
...
...
@@ -148,6 +149,7 @@ namespace ChimeraTK {
void
EntityOwner
::
addTag
(
const
std
::
string
&
tag
)
{
for
(
auto
&
node
:
getAccessorList
())
node
.
addTag
(
tag
);
for
(
auto
&
submodule
:
getSubmoduleList
())
submodule
->
addTag
(
tag
);
_tags
.
insert
(
tag
);
}
/*********************************************************************************************************************/
...
...
This diff is collapsed.
Click to expand it.
src/Module.cc
+
2
−
2
View file @
a5b80eb5
...
...
@@ -11,8 +11,8 @@
namespace
ChimeraTK
{
Module
::
Module
(
EntityOwner
*
owner
,
const
std
::
string
&
name
,
const
std
::
string
&
description
,
bool
eliminateHierarchy
)
:
EntityOwner
(
owner
,
name
,
description
,
eliminateHierarchy
)
bool
eliminateHierarchy
,
const
std
::
unordered_set
<
std
::
string
>
&
tags
)
:
EntityOwner
(
owner
,
name
,
description
,
eliminateHierarchy
,
tags
)
{}
/*********************************************************************************************************************/
...
...
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