From 0b8395f29921effadc3c25cc007e33c3abd3fdb8 Mon Sep 17 00:00:00 2001
From: jcasals <jcasals@iri.upc.edu>
Date: Mon, 22 Jul 2019 08:38:22 +0200
Subject: [PATCH] Deprecated processor_capture_holder. Closes #243

---
 CMakeLists.txt                                |  2 -
 .../core/processor/processor_capture_holder.h | 86 -------------------
 src/processor/processor_capture_holder.cpp    | 84 ------------------
 3 files changed, 172 deletions(-)
 delete mode 100644 include/core/processor/processor_capture_holder.h
 delete mode 100644 src/processor/processor_capture_holder.cpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4aa56e351..2c46be342 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -249,7 +249,6 @@ SET(HDRS_PROCESSOR
   include/core/processor/diff_drive_tools.hpp
   include/core/processor/motion_buffer.h
   include/core/processor/processor_base.h
-  include/core/processor/processor_capture_holder.h
   include/core/processor/processor_diff_drive.h
   include/core/processor/processor_factory.h
   include/core/processor/processor_logging.h
@@ -343,7 +342,6 @@ SET(SRCS_LANDMARK
 SET(SRCS_PROCESSOR
   src/processor/motion_buffer.cpp
   src/processor/processor_base.cpp
-  src/processor/processor_capture_holder.cpp
   src/processor/processor_diff_drive.cpp
   src/processor/processor_loopclosure.cpp
   src/processor/processor_motion.cpp
diff --git a/include/core/processor/processor_capture_holder.h b/include/core/processor/processor_capture_holder.h
deleted file mode 100644
index 19b33f8f2..000000000
--- a/include/core/processor/processor_capture_holder.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * \file processor_capture_holder.h
- *
- *  Created on: Jul 12, 2017
- *  \author: Jeremie Deray
- */
-
-#ifndef _WOLF_PROCESSOR_CAPTURE_HOLDER_H_
-#define _WOLF_PROCESSOR_CAPTURE_HOLDER_H_
-
-//Wolf includes
-#include "core/processor/processor_base.h"
-#include "core/capture/capture_base.h"
-
-namespace wolf {
-
-WOLF_PTR_TYPEDEFS(ProcessorCaptureHolder);
-WOLF_STRUCT_PTR_TYPEDEFS(ProcessorParamsCaptureHolder);
-
-/**
- * \brief ProcessorParamsCaptureHolder
- */
-struct ProcessorParamsCaptureHolder : public ProcessorParamsBase
-{
-    using ProcessorParamsBase::ProcessorParamsBase;
-};
-
-/**
- * \brief ProcessorCaptureHolder
- */
-class ProcessorCaptureHolder : public ProcessorBase
-{
-    public:
-
-        ProcessorCaptureHolder(ProcessorParamsCaptureHolderPtr _params_capture_holder);
-        virtual ~ProcessorCaptureHolder() = default;
-        virtual void configure(SensorBasePtr _sensor) override { };
-
-    protected:
-
-        /** \brief process an incoming capture
-         *
-         * The ProcessorCaptureHolder is only triggered in KF (see triggerInCapture()) so this function is not called.
-         */
-        virtual void processCapture(CaptureBasePtr) override {};
-
-        /** \brief process an incoming key-frame
-         *
-         * Each derived processor should implement this function. It will be called if:
-         *  - A new KF arrived and triggerInKF() returned true.
-         */
-        virtual void processKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance) override;
-
-        /** \brief trigger in capture
-         *
-         * The ProcessorCaptureHolder only processes incoming KF, then it returns false.
-         */
-        virtual bool triggerInCapture(CaptureBasePtr) override {return false;}
-
-        /** \brief trigger in key-frame
-         *
-         * Returns true if processKeyFrame() should be called after the provided KF arrived.
-         */
-        virtual bool triggerInKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tol_other) override { return true; }
-
-        /** \brief Vote for KeyFrame generation
-        *
-        * If a KeyFrame criterion is validated, this function returns true,
-        * meaning that it wants to create a KeyFrame at the \b last Capture.
-        *
-        * WARNING! This function only votes! It does not create KeyFrames!
-        */
-        virtual bool voteForKeyFrame() override { return false; }
-
-        ProcessorParamsCaptureHolderPtr params_capture_holder_;
-
-    public:
-
-        static ProcessorBasePtr create(const std::string& _unique_name,
-                                     const ProcessorParamsBasePtr _params,
-                                     const SensorBasePtr sensor_ptr = nullptr);
-};
-
-} // namespace wolf
-
-#endif // _WOLF_PROCESSOR_CAPTURE_HOLDER_H_
diff --git a/src/processor/processor_capture_holder.cpp b/src/processor/processor_capture_holder.cpp
deleted file mode 100644
index 5cad88a4e..000000000
--- a/src/processor/processor_capture_holder.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * \file processor_capture_holder.h
- *
- *  Created on: Jul 12, 2017
- *  \author: Jeremie Deray
- */
-
-//Wolf includes
-#include "core/processor/processor_capture_holder.h"
-
-namespace wolf {
-
-ProcessorCaptureHolder::ProcessorCaptureHolder(ProcessorParamsCaptureHolderPtr _params_capture_holder) :
-  ProcessorBase("CAPTURE HOLDER", _params_capture_holder),
-  params_capture_holder_(_params_capture_holder)
-{
-  //
-}
-
-void ProcessorCaptureHolder::processKeyFrame(FrameBasePtr _keyframe_ptr, const Scalar& _time_tolerance)
-{
-    assert(_keyframe_ptr->getTrajectory() != nullptr
-          && "ProcessorMotion::keyFrameCallback: key frame must be in the trajectory.");
-
-    // get keyframe's time stamp
-    const TimeStamp new_ts = _keyframe_ptr->getTimeStamp();
-
-    // find capture whose buffer is affected by the new keyframe
-    CaptureBasePtr existing_capture = buffer_capture_.selectFirstBefore(new_ts, _time_tolerance);
-    buffer_capture_.removeUpTo(existing_capture->getTimeStamp());
-
-    if (existing_capture == nullptr)
-    {
-        WOLF_WARN("Could not find a capture at ts: ", new_ts.get(), " within time tolerance: ", _time_tolerance);
-        return;
-    }
-
-    WOLF_DEBUG("ProcessorCaptureHolder::keyFrameCallback time tolerance ", _time_tolerance);
-    WOLF_DEBUG("Capture of type : ", existing_capture->getType());
-    WOLF_DEBUG("CaptureBuffer size : ", buffer_capture_.size());
-
-    // add capture to keyframe
-    auto frame_ptr = existing_capture->getFrame();
-
-    if (frame_ptr != nullptr && frame_ptr->isKey())
-    {
-        WOLF_WARN_COND(frame_ptr != _keyframe_ptr, "found a capture already in a different KF");
-        WOLF_INFO_COND(frame_ptr == _keyframe_ptr, "found a capture already in a this KF");
-    }
-    else
-    {
-        WOLF_INFO("Adding capture laser !");
-        existing_capture->link(_keyframe_ptr);
-
-        if (frame_ptr)
-            frame_ptr->remove();
-    }
-}
-
-ProcessorBasePtr ProcessorCaptureHolder::create(const std::string& _unique_name,
-                                                const ProcessorParamsBasePtr _params,
-                                                const SensorBasePtr)
-{
-      ProcessorParamsCaptureHolderPtr params;
-
-      params = std::static_pointer_cast<ProcessorParamsCaptureHolder>(_params);
-
-      // if cast failed use default value
-      if (params == nullptr)
-          params = std::make_shared<ProcessorParamsCaptureHolder>();
-
-      ProcessorCaptureHolderPtr prc_ptr = std::make_shared<ProcessorCaptureHolder>(params);
-      prc_ptr->setName(_unique_name);
-
-      return prc_ptr;
-}
-
-} // namespace wolf
-
-// Register in the ProcessorFactory
-#include "core/processor/processor_factory.h"
-namespace wolf {
-WOLF_REGISTER_PROCESSOR("CAPTURE HOLDER", ProcessorCaptureHolder)
-} // namespace wolf
-- 
GitLab