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
Merge requests
!178
Draft: Make RobotStateMemory ready
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Draft: Make RobotStateMemory ready
armem/robot-state-memory
into
master
Overview
1
Commits
48
Pipelines
0
Changes
2
Merged
Rainer Kartmann
requested to merge
armem/robot-state-memory
into
master
3 years ago
Overview
1
Commits
48
Pipelines
0
Changes
2
Expand
Goal:
Make stable (especially race conditions)
Improve runtime
Add profiling/monitoring
Refactor code
Add missing interfaces
0
0
Merge request reports
Viewing commit
69b81532
Prev
Next
Show latest version
2 files
+
130
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
69b81532
Add locking and non-locking getters
· 69b81532
Rainer Kartmann
authored
3 years ago
source/RobotAPI/libraries/armem/core/workingmemory/CoreSegment.cpp
+
68
−
0
Options
@@ -65,4 +65,72 @@ namespace armarx::armem::wm
return
_mutex
;
}
std
::
optional
<
wm
::
EntitySnapshot
>
CoreSegment
::
getLatestEntitySnapshot
(
const
MemoryID
&
entityID
)
const
{
const
wm
::
Entity
&
entity
=
this
->
getEntity
(
entityID
);
if
(
entity
.
empty
())
{
return
std
::
nullopt
;
}
else
{
return
entity
.
getLatestSnapshot
();
}
}
std
::
optional
<
wm
::
EntityInstance
>
CoreSegment
::
getLatestEntityInstance
(
const
MemoryID
&
entityID
,
int
instanceIndex
)
const
{
auto
snapshot
=
getLatestEntitySnapshot
(
entityID
);
if
(
snapshot
.
has_value
()
and
instanceIndex
>=
0
and
static_cast
<
size_t
>
(
instanceIndex
)
<
snapshot
->
size
())
{
return
snapshot
->
getInstance
(
instanceIndex
);
}
else
{
return
std
::
nullopt
;
}
}
armarx
::
aron
::
datanavigator
::
DictNavigatorPtr
CoreSegment
::
getLatestEntityInstanceData
(
const
MemoryID
&
entityID
,
int
instanceIndex
)
const
{
auto
instance
=
getLatestEntityInstance
(
entityID
,
instanceIndex
);
if
(
instance
.
has_value
())
{
return
instance
->
data
();
}
else
{
return
nullptr
;
}
}
std
::
optional
<
wm
::
EntitySnapshot
>
CoreSegment
::
getLatestEntitySnapshotLocking
(
const
MemoryID
&
entityID
)
const
{
std
::
scoped_lock
lock
(
_mutex
);
return
getLatestEntitySnapshot
(
entityID
);
}
std
::
optional
<
wm
::
EntityInstance
>
CoreSegment
::
getLatestEntityInstanceLocking
(
const
MemoryID
&
entityID
,
int
instanceIndex
)
const
{
std
::
scoped_lock
lock
(
_mutex
);
return
getLatestEntityInstance
(
entityID
,
instanceIndex
);
}
armarx
::
aron
::
datanavigator
::
DictNavigatorPtr
CoreSegment
::
getLatestEntityInstanceDataLocking
(
const
MemoryID
&
entityID
,
int
instanceIndex
)
const
{
std
::
scoped_lock
lock
(
_mutex
);
return
getLatestEntityInstanceData
(
entityID
,
instanceIndex
);
}
}
Loading