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
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Hofmann
RobotAPI
Commits
76ea15da
Commit
76ea15da
authored
3 years ago
by
Fabian Reister
Browse files
Options
Downloads
Patches
Plain Diff
query: maxEntries fix
parent
95eb3ffe
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
source/RobotAPI/libraries/armem/server/query_proc/base/EntityQueryProcessorBase.h
+17
-10
17 additions, 10 deletions
...s/armem/server/query_proc/base/EntityQueryProcessorBase.h
with
17 additions
and
10 deletions
source/RobotAPI/libraries/armem/server/query_proc/base/EntityQueryProcessorBase.h
+
17
−
10
View file @
76ea15da
#pragma once
#include
<RobotAPI/interface/armem/query.h>
#include
<cstdint>
#include
<iterator>
#include
"ArmarXCore/core/exceptions/LocalException.h"
#include
"BaseQueryProcessorBase.h"
#include
<RobotAPI/interface/armem/query.h>
#include
<ArmarXCore/core/exceptions/LocalException.h>
#include
<ArmarXCore/core/logging/Logging.h>
#include
<ArmarXCore/core/exceptions/local/ExpressionException.h>
#include
<RobotAPI/libraries/armem/core/error.h>
#include
<RobotAPI/libraries/armem/core/ice_conversions.h>
#include
"BaseQueryProcessorBase.h"
namespace
armarx
::
armem
::
base
::
query_proc
{
...
...
@@ -187,7 +190,7 @@ namespace armarx::armem::base::query_proc
const
auto
referenceTimestamp
=
fromIce
<
Time
>
(
query
.
timestamp
);
ARMARX_CHECK
(
referenceTimestamp
.
toMicroSeconds
()
>=
0
)
<<
"Reference timestamp is negative!"
;
const
auto
maxEntries
=
fromIce
<
int64
>
(
query
.
maxEntries
);
const
auto
maxEntries
=
fromIce
<
std
::
int64
_t
>
(
query
.
maxEntries
);
const
auto
refIt
=
entity
.
history
().
lower_bound
(
referenceTimestamp
);
...
...
@@ -199,16 +202,20 @@ namespace armarx::armem::base::query_proc
const
auto
nEntriesBefore
=
std
::
distance
(
entity
.
history
().
begin
(),
refIt
);
if
(
nEntriesBefore
<
maxEntries
)
const
int
nEntries
=
[
&
](
)
{
// TODO maybe warn that not enough elements exist, but the user will notice anyways
;
}
// see query.ice
if
(
maxEntries
>
0
)
{
return
std
::
min
(
nEntriesBefore
,
maxEntries
);
}
const
int
nEntries
=
std
::
min
(
nEntriesBefore
,
maxEntries
);
return
nEntriesBefore
;
// all elements before timestamp
}
();
auto
it
=
refIt
;
for
(
int64
i
=
0
;
i
<
nEntries
;
i
++
,
--
it
)
for
(
std
::
int64
_t
i
=
0
;
i
<
nEntries
;
i
++
,
--
it
)
{
addResultSnapshot
(
result
,
it
);
}
...
...
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