Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
53509eee
Commit
53509eee
authored
4 years ago
by
Christian Dreher
Browse files
Options
Downloads
Patches
Plain Diff
feature: More informative signature for callback, allow subscribing to non-entities.
parent
d5798a60
No related branches found
No related tags found
3 merge requests
!102
ArMem Memory Updates
,
!100
Memory QueryBuilder
,
!99
Memory subscriptions
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/libraries/armem/client/Reader.cpp
+15
-8
15 additions, 8 deletions
source/RobotAPI/libraries/armem/client/Reader.cpp
source/RobotAPI/libraries/armem/client/Reader.h
+1
-1
1 addition, 1 deletion
source/RobotAPI/libraries/armem/client/Reader.h
with
16 additions
and
9 deletions
source/RobotAPI/libraries/armem/client/Reader.cpp
+
15
−
8
View file @
53509eee
...
...
@@ -71,15 +71,23 @@ namespace armarx::armem
void
Reader
::
updated
(
const
std
::
vector
<
MemoryID
>&
updatedIDs
)
Reader
::
updated
(
const
std
::
vector
<
MemoryID
>&
updated
Snapshot
IDs
)
{
MemoryID
id
;
for
(
const
MemoryID
&
updatedID
:
updatedIDs
)
for
(
const
auto
&
[
subscription
,
callback
]
:
callbacks
)
{
id
=
updatedID
.
getEntityID
();
if
(
callbacks
.
find
(
id
)
!=
callbacks
.
end
())
std
::
vector
<
MemoryID
>
matchingSnapshotIDs
;
for
(
const
MemoryID
&
updatedSnapshotID
:
updatedSnapshotIDs
)
{
if
(
contains
(
subscription
,
updatedSnapshotID
))
{
matchingSnapshotIDs
.
push_back
(
updatedSnapshotID
);
}
}
if
(
not
matchingSnapshotIDs
.
empty
())
{
callback
s
[
id
](
);
callback
(
subscription
,
matchingSnapshotIDs
);
}
}
}
...
...
@@ -88,8 +96,7 @@ namespace armarx::armem
void
Reader
::
subscribe
(
const
MemoryID
&
id
,
callback
callback
)
{
ARMARX_CHECK
(
id
.
hasEntityName
())
<<
"MemoryID must be an entity ID."
;
callbacks
[
id
.
getEntityID
()]
=
callback
;
callbacks
[
id
]
=
callback
;
}
}
This diff is collapsed.
Click to expand it.
source/RobotAPI/libraries/armem/client/Reader.h
+
1
−
1
View file @
53509eee
...
...
@@ -22,7 +22,7 @@ namespace armarx::armem
class
Reader
{
using
callback
=
std
::
function
<
void
()
>
;
using
callback
=
std
::
function
<
void
(
const
MemoryID
&
subscriptionID
,
const
std
::
vector
<
MemoryID
>&
updatedSnapshotIDs
)
>
;
public:
...
...
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