Skip to content
Snippets Groups Projects
Commit b5ed78b9 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Add method process() to capture

parent 5b1f59da
No related branches found
No related tags found
1 merge request!238Feature/capture process
Pipeline #2440 passed
...@@ -50,6 +50,8 @@ class CaptureBase : public NodeBase, public std::enable_shared_from_this<Capture ...@@ -50,6 +50,8 @@ class CaptureBase : public NodeBase, public std::enable_shared_from_this<Capture
// Type // Type
virtual bool isMotion() const { return false; } virtual bool isMotion() const { return false; }
bool process();
unsigned int id(); unsigned int id();
TimeStamp getTimeStamp() const; TimeStamp getTimeStamp() const;
void setTimeStamp(const TimeStamp& _ts); void setTimeStamp(const TimeStamp& _ts);
...@@ -220,6 +222,14 @@ inline void CaptureBase::setTimeStampToNow() ...@@ -220,6 +222,14 @@ inline void CaptureBase::setTimeStampToNow()
time_stamp_.setToNow(); 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 } // namespace wolf
#endif #endif
...@@ -103,6 +103,15 @@ TEST(CaptureBase, addFeatureList) ...@@ -103,6 +103,15 @@ TEST(CaptureBase, addFeatureList)
ASSERT_EQ(C->getFeatureList().back(), f_last); 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) int main(int argc, char **argv)
{ {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment