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
063a82e3
Commit
063a82e3
authored
7 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
added constructor for ReadBitMask which allows specifying all meta data for inputs and outputs
parent
c264277b
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/include/BitMask.h
+25
-9
25 additions, 9 deletions
Modules/include/BitMask.h
with
25 additions
and
9 deletions
Modules/include/BitMask.h
+
25
−
9
View file @
063a82e3
...
...
@@ -24,16 +24,16 @@ namespace ChimeraTK {
bit
[
i
].
replace
(
ScalarPushInput
<
int
>
(
this
,
"bit"
+
std
::
to_string
(
i
),
""
,
"The bit "
+
std
::
to_string
(
i
)
+
" of the bit mask"
));
}
}
ScalarPushInput
<
int
>
bit
[
NBITS
];
};
Input
input
{
this
,
"input"
,
"The input bits"
};
ScalarOutput
<
int32_t
>
bitmask
{
this
,
"bitmask"
,
""
,
"Output bit mask."
};
void
mainLoop
()
{
while
(
true
)
{
// create bit mask
bitmask
=
0
;
for
(
size_t
i
=
0
;
i
<
NBITS
;
++
i
)
{
...
...
@@ -42,7 +42,7 @@ namespace ChimeraTK {
}
}
bitmask
.
write
();
// wait for new input values (at the end, since we want to process the initial values first)
input
.
readAny
();
}
...
...
@@ -54,7 +54,23 @@ namespace ChimeraTK {
template
<
size_t
NBITS
>
struct
ReadBitMask
:
public
ApplicationModule
{
using
ApplicationModule
::
ApplicationModule
;
ReadBitMask
(
EntityOwner
*
owner
,
const
std
::
string
&
name
,
const
std
::
string
&
description
,
bool
eliminateHierarchy
=
false
,
const
std
::
unordered_set
<
std
::
string
>
&
tags
=
{})
:
ApplicationModule
(
owner
,
name
,
description
,
eliminateHierarchy
,
tags
)
{}
ReadBitMask
()
{}
ReadBitMask
(
EntityOwner
*
owner
,
const
std
::
string
&
inputName
,
const
std
::
string
&
inputDescription
,
const
std
::
unordered_set
<
std
::
string
>
&
inputTags
,
const
std
::
array
<
std
::
string
,
NBITS
>
&
outputNames
,
const
std
::
array
<
std
::
string
,
NBITS
>
&
outputDescriptions
,
const
std
::
unordered_set
<
std
::
string
>
&
outputTags
)
:
ApplicationModule
(
owner
,
inputName
,
inputDescription
,
true
)
{
bitmask
.
setMetaData
(
inputName
,
""
,
inputDescription
,
inputTags
);
output
.
setEliminateHierarchy
();
for
(
size_t
i
=
0
;
i
<
NBITS
;
++
i
)
{
output
.
bit
[
i
].
setMetaData
(
outputNames
[
i
],
""
,
outputDescriptions
[
i
],
outputTags
);
}
}
/// individual outputs for each bit
struct
Output
:
public
VariableGroup
{
...
...
@@ -67,22 +83,22 @@ namespace ChimeraTK {
bit
[
i
].
replace
(
ScalarOutput
<
int
>
(
this
,
"bit"
+
std
::
to_string
(
i
),
""
,
"The bit "
+
std
::
to_string
(
i
)
+
" of the bit mask"
));
}
}
ScalarOutput
<
int
>
bit
[
NBITS
];
};
Output
output
{
this
,
"output"
,
"The extracted output bits"
};
ScalarPushInput
<
int32_t
>
bitmask
{
this
,
"bitmask"
,
""
,
"Input bit mask."
};
void
mainLoop
()
{
while
(
true
)
{
// decode bit mask
for
(
size_t
i
=
0
;
i
<
NBITS
;
++
i
)
{
output
.
bit
[
i
]
=
(
bitmask
&
(
1
<<
i
))
!=
0
;
output
.
bit
[
i
].
write
();
/// @todo TODO better make a writeAll() for VariableGroups
}
// wait for new input values (at the end, since we want to process the initial values first)
bitmask
.
read
();
}
...
...
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