From d0ad70f5d242f259c6102bca0ecda8e32ac66c51 Mon Sep 17 00:00:00 2001 From: Jeremie Deray <jeremie.deray@pal-robotics.com> Date: Fri, 22 Sep 2017 18:44:47 +0200 Subject: [PATCH] add FrameBase::getCaptureOf given capture type --- src/frame_base.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/frame_base.h b/src/frame_base.h index 91be417bc..d96a8fead 100644 --- a/src/frame_base.h +++ b/src/frame_base.h @@ -133,6 +133,7 @@ class FrameBase : public NodeBase, public std::enable_shared_from_this<FrameBase CaptureBaseList& getCaptureList(); CaptureBasePtr addCapture(CaptureBasePtr _capt_ptr); CaptureBasePtr getCaptureOf(const SensorBasePtr _sensor_ptr); + CaptureBasePtr getCaptureOf(const SensorBasePtr _sensor_ptr, const std::string& type); CaptureBaseList getCapturesOf(const SensorBasePtr _sensor_ptr); void unlinkCapture(CaptureBasePtr _cap_ptr); @@ -318,6 +319,16 @@ inline CaptureBasePtr FrameBase::getCaptureOf(const SensorBasePtr _sensor_ptr) return nullptr; } +inline CaptureBasePtr +FrameBase::getCaptureOf(const SensorBasePtr _sensor_ptr, const std::string& type) +{ + for (CaptureBasePtr capture_ptr : getCaptureList()) + if (capture_ptr->getSensorPtr() == _sensor_ptr && + capture_ptr->getType() == type) + return capture_ptr; + return nullptr; +} + inline CaptureBaseList FrameBase::getCapturesOf(const SensorBasePtr _sensor_ptr) { CaptureBaseList captures; -- GitLab