From bbbf6ce49bef531907c8edb12d0b3dab6e4067a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Sat, 11 Dec 2021 19:59:38 +0100
Subject: [PATCH] Reduce API of PM::splitBuffer

---
 include/core/processor/processor_motion.h | 3 +--
 src/processor/processor_motion.cpp        | 7 +++----
 test/gtest_processor_motion.cpp           | 6 ------
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/include/core/processor/processor_motion.h b/include/core/processor/processor_motion.h
index 5d9716490..06d1d08f7 100644
--- a/include/core/processor/processor_motion.h
+++ b/include/core/processor/processor_motion.h
@@ -272,8 +272,7 @@ class ProcessorMotion : public ProcessorBase, public MotionProvider
         void integrateOneStep();
         void reintegrateBuffer(CaptureMotionPtr _capture_ptr) const;
         void splitBuffer(const wolf::CaptureMotionPtr& capture_source,
-                         TimeStamp ts_split,
-                         const FrameBasePtr& keyframe_target,
+                         const TimeStamp ts_split,
                          const wolf::CaptureMotionPtr& capture_target) const;
 
         /** Pre-process incoming Capture
diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp
index 92c6776dc..bd7d8ebc2 100644
--- a/src/processor/processor_motion.cpp
+++ b/src/processor/processor_motion.cpp
@@ -116,8 +116,7 @@ void ProcessorMotion::mergeCaptures(CaptureMotionConstPtr cap_prev,
 }
 
 void ProcessorMotion::splitBuffer(const CaptureMotionPtr& _capture_source,
-                                  TimeStamp _ts_split,
-                                  const FrameBasePtr& _keyframe_target,
+                                  const TimeStamp _ts_split,
                                   const CaptureMotionPtr& _capture_target) const
 {
     /** we are doing this:
@@ -300,7 +299,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
 
             // split the buffer
             // and give the part of the buffer before the new keyframe to the capture for the KF callback
-            splitBuffer(capture_existing, timestamp_from_callback, keyframe_from_callback, capture_for_keyframe_callback);
+            splitBuffer(capture_existing, timestamp_from_callback, capture_for_keyframe_callback);
 
             // create motion feature and add it to the capture
             auto feature_new = emplaceFeature(capture_for_keyframe_callback);
@@ -393,7 +392,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
 
             // split the buffer
             // and give the part of the buffer before the new keyframe to the capture for the KF callback
-            splitBuffer(capture_existing, timestamp_from_callback, keyframe_from_callback, capture_for_keyframe_callback);
+            splitBuffer(capture_existing, timestamp_from_callback, capture_for_keyframe_callback);
 
             // create motion feature and add it to the capture
             auto feature_for_keyframe_callback = emplaceFeature(capture_for_keyframe_callback);
diff --git a/test/gtest_processor_motion.cpp b/test/gtest_processor_motion.cpp
index c6bef13ef..8eb1c8bc1 100644
--- a/test/gtest_processor_motion.cpp
+++ b/test/gtest_processor_motion.cpp
@@ -49,12 +49,10 @@ class ProcessorOdom2dPublic : public ProcessorOdom2d
 
         void splitBuffer(const wolf::CaptureMotionPtr& capture_source,
                          TimeStamp ts_split,
-                         const FrameBasePtr& keyframe_target,
                          const wolf::CaptureMotionPtr& capture_target)
         {
             ProcessorOdom2d::splitBuffer(capture_source,
                                          ts_split,
-                                         keyframe_target,
                                          capture_target);
         }
 };
@@ -347,7 +345,6 @@ TEST_F(ProcessorMotion_test, mergeCaptures)
 
     processor->splitBuffer(C_source,
                            t_target,
-                           F_target,
                            C_target);
 
     C_target->getBuffer().print(1,1,1,0);
@@ -421,7 +418,6 @@ TEST_F(ProcessorMotion_test, splitBufferAutoPrior)
 
     processor->splitBuffer(C_source,
                            t_target,
-                           F_target,
                            C_target);
 
     C_target->getBuffer().print(1,1,1,0);
@@ -466,7 +462,6 @@ TEST_F(ProcessorMotion_test, splitBufferFactorPrior)
 
     processor->splitBuffer(C_source,
                            t_target,
-                           F_target,
                            C_target);
 
     C_target->getBuffer().print(1,1,1,0);
@@ -511,7 +506,6 @@ TEST_F(ProcessorMotion_test, splitBufferFixPrior)
 
     processor->splitBuffer(C_source,
                            t_target,
-                           F_target,
                            C_target);
 
     C_target->getBuffer().print(1,1,1,0);
-- 
GitLab