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
075359c4
Commit
075359c4
authored
8 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
proper readAny implementation for the VariableGroup based on the new DeviceAccess features
parent
5f6a9c30
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/Accessor.h
+7
-0
7 additions, 0 deletions
include/Accessor.h
src/VariableGroup.cc
+11
-9
11 additions, 9 deletions
src/VariableGroup.cc
with
18 additions
and
9 deletions
include/Accessor.h
+
7
−
0
View file @
075359c4
...
@@ -83,6 +83,9 @@ namespace ChimeraTK {
...
@@ -83,6 +83,9 @@ namespace ChimeraTK {
return
node
;
return
node
;
}
}
/** Return the implementation as a TransferElement */
virtual
boost
::
shared_ptr
<
TransferElement
>
getTransferElement
()
=
0
;
/** Explicitly return the node */
/** Explicitly return the node */
VariableNetworkNode
&
getNode
()
{
VariableNetworkNode
&
getNode
()
{
return
node
;
return
node
;
...
@@ -158,6 +161,10 @@ namespace ChimeraTK {
...
@@ -158,6 +161,10 @@ namespace ChimeraTK {
node
=
VariableNetworkNode
(
*
this
);
node
=
VariableNetworkNode
(
*
this
);
}
}
boost
::
shared_ptr
<
TransferElement
>
getTransferElement
()
override
{
return
boost
::
static_pointer_cast
<
TransferElement
>
(
impl
);
}
protected
:
protected
:
Module
*
_owner
;
Module
*
_owner
;
...
...
This diff is collapsed.
Click to expand it.
src/VariableGroup.cc
+
11
−
9
View file @
075359c4
...
@@ -16,18 +16,20 @@ namespace ChimeraTK {
...
@@ -16,18 +16,20 @@ namespace ChimeraTK {
/*********************************************************************************************************************/
/*********************************************************************************************************************/
void
VariableGroup
::
readAny
()
{
void
VariableGroup
::
readAny
()
{
bool
gotUpdate
=
false
;
auto
accessorList
=
getAccessorListRecursive
();
auto
accessorList
=
getAccessorListRecursive
();
while
(
!
gotUpdate
)
{
/// @todo TODO FIXME make proper blocking implementation
boost
::
this_thread
::
yield
();
// put push-type transfer elements into a list suitable for TransferElement::readAny()
boost
::
this_thread
::
interruption_point
();
std
::
list
<
std
::
reference_wrapper
<
TransferElement
>>
transferElementList
;
for
(
auto
&
accessor
:
accessorList
)
{
for
(
auto
accessor
:
accessorList
)
{
// @todo FIXME make sure no submodule is accessing the variables itself... (e.g. by forcing all submodules to be a VariablGroup and not e.g. an ApplicationModule)
if
(
accessor
->
getUpdateMode
()
==
UpdateMode
::
push
)
{
if
(
accessor
->
getUpdateMode
()
==
UpdateMode
::
push
)
{
transferElementList
.
emplace_back
(
*
(
accessor
->
getTransferElement
()));
if
(
accessor
->
readNonBlocking
())
gotUpdate
=
true
;
}
}
}
}
}
// wait until one of the push-type accessors receives an update
mtca4u
::
TransferElement
::
readAny
(
transferElementList
);
// trigger read on the poll-type accessors
for
(
auto
accessor
:
accessorList
)
{
for
(
auto
accessor
:
accessorList
)
{
if
(
accessor
->
getUpdateMode
()
==
UpdateMode
::
poll
)
{
if
(
accessor
->
getUpdateMode
()
==
UpdateMode
::
poll
)
{
accessor
->
read
();
accessor
->
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