Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
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
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
b5ed78b9
Commit
b5ed78b9
authored
6 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Add method process() to capture
parent
5b1f59da
No related branches found
No related tags found
1 merge request
!238
Feature/capture process
Pipeline
#2440
passed
6 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/capture_base.h
+10
-0
10 additions, 0 deletions
src/capture_base.h
src/test/gtest_capture_base.cpp
+9
-0
9 additions, 0 deletions
src/test/gtest_capture_base.cpp
with
19 additions
and
0 deletions
src/capture_base.h
+
10
−
0
View file @
b5ed78b9
...
...
@@ -50,6 +50,8 @@ class CaptureBase : public NodeBase, public std::enable_shared_from_this<Capture
// Type
virtual
bool
isMotion
()
const
{
return
false
;
}
bool
process
();
unsigned
int
id
();
TimeStamp
getTimeStamp
()
const
;
void
setTimeStamp
(
const
TimeStamp
&
_ts
);
...
...
@@ -220,6 +222,14 @@ inline void CaptureBase::setTimeStampToNow()
time_stamp_
.
setToNow
();
}
inline
bool
CaptureBase
::
process
()
{
assert
(
getSensorPtr
()
!=
nullptr
&&
"Attempting to process a capture with no associated sensor. Either set the capture's sensor or call sensor->process(capture) instead."
);
return
getSensorPtr
()
->
process
(
shared_from_this
());
}
}
// namespace wolf
#endif
This diff is collapsed.
Click to expand it.
src/test/gtest_capture_base.cpp
+
9
−
0
View file @
b5ed78b9
...
...
@@ -103,6 +103,15 @@ TEST(CaptureBase, addFeatureList)
ASSERT_EQ
(
C
->
getFeatureList
().
back
(),
f_last
);
}
TEST
(
CaptureBase
,
process
)
{
SensorBasePtr
S
(
std
::
make_shared
<
SensorBase
>
(
"DUMMY"
,
nullptr
,
nullptr
,
nullptr
,
2
));
CaptureBasePtr
C
(
std
::
make_shared
<
CaptureBase
>
(
"DUMMY"
,
1.5
,
nullptr
));
ASSERT_DEATH
({
C
->
process
();},
""
);
// No sensor in the capture should fail
C
->
setSensorPtr
(
S
);
ASSERT_TRUE
(
C
->
process
());
// This should not fail (although it does nothing)
}
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
...
...
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