From 4026c3f2d58d906df81360e213aca28bc6034428 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Thu, 8 Aug 2019 03:13:56 +0200
Subject: [PATCH] Some formatting and cleanup

---
 hello_wolf/sensor_range_bearing.h          | 12 ++--
 include/core/common/params_base.h          |  4 +-
 include/core/processor/processor_base.h    | 66 +++++++++-------------
 include/core/processor/processor_odom_3D.h | 20 +++----
 include/core/processor/processor_tracker.h | 10 ++--
 include/core/sensor/sensor_odom_2D.h       | 10 ++--
 src/problem/problem.cpp                    |  1 +
 src/processor/processor_loopclosure.cpp    |  2 +-
 8 files changed, 58 insertions(+), 67 deletions(-)

diff --git a/hello_wolf/sensor_range_bearing.h b/hello_wolf/sensor_range_bearing.h
index 9ff5f509e..fbecdc8a0 100644
--- a/hello_wolf/sensor_range_bearing.h
+++ b/hello_wolf/sensor_range_bearing.h
@@ -29,12 +29,12 @@ struct IntrinsicsRangeBearing : public IntrinsicsBase
         noise_range_metres_std = _server.getParam<Scalar>(_unique_name + "/noise_range_metres_std");
         noise_bearing_degrees_std = _server.getParam<Scalar>(_unique_name + "/noise_bearing_degrees_std");
     }
-  std::string print()
-  {
-      return "" + IntrinsicsBase::print()
-      + "noise_range_metres_std: " + std::to_string(noise_range_metres_std) + "\n"
-      + "noise_bearing_degrees_std: " + std::to_string(noise_bearing_degrees_std) + "\n";
-  }
+    std::string print()
+    {
+        return "" + IntrinsicsBase::print()
+        + "noise_range_metres_std: " + std::to_string(noise_range_metres_std) + "\n"
+        + "noise_bearing_degrees_std: " + std::to_string(noise_bearing_degrees_std) + "\n";
+    }
 };
 
 WOLF_PTR_TYPEDEFS(SensorRangeBearing)
diff --git a/include/core/common/params_base.h b/include/core/common/params_base.h
index ac9175668..767ece49d 100644
--- a/include/core/common/params_base.h
+++ b/include/core/common/params_base.h
@@ -15,8 +15,8 @@ namespace wolf {
     virtual ~ParamsBase() = default;
     std::string print()
     {
-      return "";
+        return "";
     }
   };
 }
-#endif
\ No newline at end of file
+#endif
diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h
index f18a4a5eb..e605ab904 100644
--- a/include/core/processor/processor_base.h
+++ b/include/core/processor/processor_base.h
@@ -9,8 +9,9 @@ class SensorBase;
 // Wolf includes
 #include "core/common/wolf.h"
 #include "core/common/node_base.h"
-#include "core/common/time_stamp.h"
+#include "core/sensor/sensor_base.h"
 #include "core/frame/frame_base.h"
+#include "core/common/time_stamp.h"
 #include "core/common/params_base.h"
 
 // std
@@ -204,15 +205,6 @@ class BufferCapture : public Buffer<CaptureBasePtr> {};
 struct ProcessorParamsBase : public ParamsBase
 {
     ProcessorParamsBase() = default;
-    ProcessorParamsBase(bool _voting_active,
-                        Scalar _time_tolerance,
-                        bool _voting_aux_active = false) :
-        voting_active(_voting_active),
-        voting_aux_active(_voting_aux_active),
-        time_tolerance(_time_tolerance)
-    {
-      //
-    }
     ProcessorParamsBase(std::string _unique_name, const ParamsServer& _server):
         ParamsBase(_unique_name, _server)
     {
@@ -223,19 +215,22 @@ struct ProcessorParamsBase : public ParamsBase
 
     virtual ~ProcessorParamsBase() = default;
 
-    bool voting_active = false;     ///< Whether this processor is allowed to vote for a Key Frame or not
-    bool voting_aux_active = false; ///< Whether this processor is allowed to vote for an Auxiliary Frame or not
-
-    ///< maximum time difference between a Keyframe time stamp and
-    /// a particular Capture of this processor to allow assigning
-    /// this Capture to the Keyframe.
-    Scalar time_tolerance = Scalar(0);
-  std::string print()
-  {
-    return ParamsBase::print() + "\n" + "voting_active: " + std::to_string(voting_active) + "\n"
-    + "voting_aux_active: " + std::to_string(voting_aux_active) + "\n"
-    + "time_tolerance: " + std::to_string(time_tolerance) + "\n";
-  }
+    /** maximum time difference between a Keyframe time stamp and
+     * a particular Capture of this processor to allow assigning
+     * this Capture to the Keyframe.
+     */
+    Scalar time_tolerance   = Scalar(0);
+    bool voting_active      = false;    ///< Whether this processor is allowed to vote for a Key Frame or not
+    bool voting_aux_active  = false;    ///< Whether this processor is allowed to vote for an Auxiliary Frame or not
+
+
+    std::string print()
+    {
+        return ParamsBase::print() + "\n"
+                + "voting_active: " + std::to_string(voting_active) + "\n"
+                + "voting_aux_active: " + std::to_string(voting_aux_active) + "\n"
+                + "time_tolerance: " + std::to_string(time_tolerance) + "\n";
+    }
 };
 
 //class ProcessorBase
@@ -365,21 +360,6 @@ inline void ProcessorBase::setVotingAuxActive(bool _voting_active)
     params_->voting_aux_active = _voting_active;
 }
 
-}
-
-#include "core/sensor/sensor_base.h"
-#include "core/factor/factor_base.h"
-
-namespace wolf {
-
-template<typename classType, typename... T>
-std::shared_ptr<classType> ProcessorBase::emplace(SensorBasePtr _sen_ptr, T&&... all)
-{
-    std::shared_ptr<classType> prc = std::make_shared<classType>(std::forward<T>(all)...);
-    prc->link(_sen_ptr);
-    return prc;
-}
-
 inline bool ProcessorBase::isMotion() const
 {
     return false;
@@ -405,6 +385,16 @@ inline void ProcessorBase::setTimeTolerance(Scalar _time_tolerance)
     params_->time_tolerance = _time_tolerance;
 }
 
+
+template<typename classType, typename... T>
+std::shared_ptr<classType> ProcessorBase::emplace(SensorBasePtr _sen_ptr, T&&... all)
+{
+    std::shared_ptr<classType> prc = std::make_shared<classType>(std::forward<T>(all)...);
+    prc->link(_sen_ptr);
+    return prc;
+}
+
+
 /////////////////////////////////////////////////////////////////////////////////////////
 
 template <typename T>
diff --git a/include/core/processor/processor_odom_3D.h b/include/core/processor/processor_odom_3D.h
index 62128c904..47334e580 100644
--- a/include/core/processor/processor_odom_3D.h
+++ b/include/core/processor/processor_odom_3D.h
@@ -21,16 +21,16 @@ WOLF_STRUCT_PTR_TYPEDEFS(ProcessorParamsOdom3D);
 
 struct ProcessorParamsOdom3D : public ProcessorParamsMotion
 {
-  ProcessorParamsOdom3D() = default;
-  ProcessorParamsOdom3D(std::string _unique_name, const ParamsServer& _server):
-    ProcessorParamsMotion(_unique_name, _server)
-  {
-    //
-  }
-  std::string print()
-  {
-    return "\n" + ProcessorParamsMotion::print();
-  }
+        ProcessorParamsOdom3D() = default;
+        ProcessorParamsOdom3D(std::string _unique_name, const ParamsServer& _server):
+            ProcessorParamsMotion(_unique_name, _server)
+        {
+            //
+        }
+        std::string print()
+        {
+            return "\n" + ProcessorParamsMotion::print();
+        }
 };
 
 WOLF_PTR_TYPEDEFS(ProcessorOdom3D);
diff --git a/include/core/processor/processor_tracker.h b/include/core/processor/processor_tracker.h
index 0a5d46a6b..4da4460be 100644
--- a/include/core/processor/processor_tracker.h
+++ b/include/core/processor/processor_tracker.h
@@ -27,11 +27,11 @@ struct ProcessorParamsTracker : public ProcessorParamsBase
         min_features_for_keyframe = _server.getParam<unsigned int>(_unique_name + "/min_features_for_keyframe");
         max_new_features = _server.getParam<int>(_unique_name + "/max_new_features");
     }
-  std::string print()
-  {
-    return ProcessorParamsBase::print() + "\n" + "min_features_for_keyframe: " + std::to_string(min_features_for_keyframe) + "\n"
-      + "max_new_features: " + std::to_string(max_new_features) + "\n";
-  }
+    std::string print()
+    {
+        return ProcessorParamsBase::print() + "\n" + "min_features_for_keyframe: " + std::to_string(min_features_for_keyframe) + "\n"
+                + "max_new_features: " + std::to_string(max_new_features) + "\n";
+    }
 
 };
 
diff --git a/include/core/sensor/sensor_odom_2D.h b/include/core/sensor/sensor_odom_2D.h
index 1c7211a6f..614e715e5 100644
--- a/include/core/sensor/sensor_odom_2D.h
+++ b/include/core/sensor/sensor_odom_2D.h
@@ -25,11 +25,11 @@ struct IntrinsicsOdom2D : public IntrinsicsBase
         k_disp_to_disp = _server.getParam<Scalar>(_unique_name + "/k_disp_to_disp");
         k_rot_to_rot   = _server.getParam<Scalar>(_unique_name + "/k_rot_to_rot");
     }
-  std::string print()
-  {
-    return "\n" + IntrinsicsBase::print() + "k_disp_to_disp: " + std::to_string(k_disp_to_disp) + "\n"
-      + "k_rot_to_rot: " + std::to_string(k_rot_to_rot) + "\n";
-  }
+    std::string print()
+    {
+        return "\n" + IntrinsicsBase::print() + "k_disp_to_disp: " + std::to_string(k_disp_to_disp) + "\n"
+                + "k_rot_to_rot: " + std::to_string(k_rot_to_rot) + "\n";
+    }
 };
 
 WOLF_PTR_TYPEDEFS(SensorOdom2D);
diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp
index f330c6794..6a3f8d147 100644
--- a/src/problem/problem.cpp
+++ b/src/problem/problem.cpp
@@ -218,6 +218,7 @@ ProcessorBasePtr Problem::installProcessor(const std::string& _prc_type, //
     SensorBasePtr sen_ptr = getSensor(_corresponding_sensor_name);
     if (sen_ptr == nullptr)
         throw std::runtime_error("Cannot bind processor. Reason: Sensor \"" + _corresponding_sensor_name + "\" not found. Check sensor name, in must match in sensor and processor!");
+
     ProcessorBasePtr prc_ptr = AutoConfProcessorFactory::get().create(uppercase(_prc_type), _unique_processor_name, _server);
     prc_ptr->configure(sen_ptr);
     prc_ptr->link(sen_ptr);
diff --git a/src/processor/processor_loopclosure.cpp b/src/processor/processor_loopclosure.cpp
index c604f080a..c447def54 100644
--- a/src/processor/processor_loopclosure.cpp
+++ b/src/processor/processor_loopclosure.cpp
@@ -82,7 +82,7 @@ bool ProcessorLoopClosure::triggerInKeyFrame(FrameBasePtr _keyframe_ptr, const S
  */
 std::pair<FrameBasePtr,CaptureBasePtr> ProcessorLoopClosure::selectPairKC()
 {
-    std::map<TimeStamp,PackKeyFramePtr> kf_container = buffer_pack_kf_.getContainer();
+    auto kf_container = buffer_pack_kf_.getContainer();
 
     if (kf_container.empty())
         return std::make_pair(nullptr, nullptr);
-- 
GitLab