From 402729e0b3a8a803cc683ba1c25e0245f006a92d Mon Sep 17 00:00:00 2001
From: PierreGtch <pierre.guetschel@gmail.com>
Date: Thu, 6 Jun 2019 12:10:02 +0200
Subject: [PATCH] Buffer::add() change parameters order for consistency

---
 include/core/processor/processor_base.h | 4 ++--
 src/processor/processor_base.cpp        | 7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h
index 0f7f38f5f..76e5decda 100644
--- a/include/core/processor/processor_base.h
+++ b/include/core/processor/processor_base.h
@@ -68,7 +68,7 @@ public:
     /**\brief Add a pack to the buffer
     *
     */
-    void add(const T& _element, const TimeStamp& _time_stamp); //const Scalar& _time_tolerance);
+    void add(const TimeStamp& _time_stamp, const T& _element); //const Scalar& _time_tolerance);
 
     /** \brief returns the container with elements of the buffer
     *
@@ -400,7 +400,7 @@ T Buffer<T>::selectFirstBefore(const TimeStamp& _time_stamp, const Scalar& _time
 }
 
 template <typename T>
-void Buffer<T>::add(const T& _element, const TimeStamp& _time_stamp)
+void Buffer<T>::add(const TimeStamp& _time_stamp, const T& _element)
 {
     container_.emplace(_time_stamp, _element);
 }
diff --git a/src/processor/processor_base.cpp b/src/processor/processor_base.cpp
index 04f5f04cb..a70930c6b 100644
--- a/src/processor/processor_base.cpp
+++ b/src/processor/processor_base.cpp
@@ -54,14 +54,14 @@ void ProcessorBase::keyFrameCallback(FrameBasePtr _keyframe_ptr, const Scalar& _
 {
     WOLF_DEBUG("P", isMotion() ? "M " : "T ", getName(), ": KF", _keyframe_ptr->id(), " callback received with ts = ", _keyframe_ptr->getTimeStamp());
     if (_keyframe_ptr != nullptr)
-        buffer_pack_kf_.add(_keyframe_ptr,_time_tol_other);
+        buffer_pack_kf_.add(_keyframe_ptr, _time_tol_other);
 }
 
 void ProcessorBase::captureCallback(CaptureBasePtr _capture_ptr)
 {
     WOLF_DEBUG("P", isMotion() ? "M " : "T ", getName(), ": Capture", _capture_ptr->id(), " callback received with ts = ", _capture_ptr->getTimeStamp());
     if (_capture_ptr != nullptr)
-        buffer_capture_.add(_capture_ptr, _capture_ptr->getTimeStamp());
+        buffer_capture_.add(_capture_ptr->getTimeStamp(), _capture_ptr);
 }
 
 void ProcessorBase::remove()
@@ -104,8 +104,7 @@ void BufferPackKeyFrame::add(const FrameBasePtr& _key_frame, const Scalar& _time
 {
     TimeStamp time_stamp = _key_frame->getTimeStamp();
     PackKeyFramePtr kfpack = std::make_shared<PackKeyFrame>(_key_frame, _time_tolerance);
-    //Buffer<PackKeyFramePtr>::add(kfpack, time_stamp);
-    Buffer::add(kfpack, time_stamp);
+    Buffer::add(time_stamp, kfpack);
 }
 
 PackKeyFramePtr BufferPackKeyFrame::selectPack(const TimeStamp& _time_stamp, const Scalar& _time_tolerance)
-- 
GitLab