From 00915859df30c3ced4e74b67bdd20f689ebd146f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Fri, 18 Dec 2020 17:20:30 +0100
Subject: [PATCH] Remove or change F->isKey()

---
 src/capture/capture_base.cpp        | 6 +++---
 src/frame/frame_base.cpp            | 4 ++--
 src/processor/processor_motion.cpp  | 4 ++--
 src/processor/processor_tracker.cpp | 8 ++++----
 src/processor/track_matrix.cpp      | 2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/capture/capture_base.cpp b/src/capture/capture_base.cpp
index 489d67637..48a01e003 100644
--- a/src/capture/capture_base.cpp
+++ b/src/capture/capture_base.cpp
@@ -180,8 +180,8 @@ void CaptureBase::move(FrameBasePtr _frm_ptr)
     WOLF_WARN_COND(this->getFrame() == nullptr, "moving a capture not linked to any frame");
     WOLF_WARN_COND(_frm_ptr == nullptr, "moving a capture to a null FrameBasePtr");
 
-    assert((this->getFrame() == nullptr || this->getFrame()->isKey()) && "Forbidden: moving a capture already linked to a KF");
-    assert((_frm_ptr == nullptr || _frm_ptr->isKey()) && "Forbidden: moving a capture to a non-estimated frame");
+    assert((this->getFrame() == nullptr || this->getFrame()->getProblem()) && "Forbidden: moving a capture already linked to a KF");
+    assert((_frm_ptr == nullptr || !_frm_ptr->getProblem()) && "Forbidden: moving a capture to a non-estimated frame");
 
     // Unlink
     if (this->getFrame())
@@ -399,7 +399,7 @@ CheckLog CaptureBase::localCheck(bool _verbose, CaptureBasePtr _cap_ptr, std::os
                 match_any_prc_timetolerance = match_any_prc_timetolerance or (time_diff <= prc->getTimeTolerance());
             }
             inconsistency_explanation << "Cap " << id() << " @ " << _cap_ptr
-                                      << " ts =" << getTimeStamp() << ((frame->isKey()) ? "KFrm" : "Frm") << frame->id()
+                                      << " ts =" << getTimeStamp() << "Frm" << frame->id()
                                       << " ts = " << frame->getTimeStamp() << " their time difference (" << time_diff << ") does not match any time tolerance of"
                                       << " any processor in sensor " << getSensor()->id() << "\n";
             log.assertTrue((match_any_prc_timetolerance), inconsistency_explanation);
diff --git a/src/frame/frame_base.cpp b/src/frame/frame_base.cpp
index 16a40a916..a2a3deb19 100644
--- a/src/frame/frame_base.cpp
+++ b/src/frame/frame_base.cpp
@@ -307,7 +307,7 @@ void FrameBase::setProblem(ProblemPtr _problem)
 
 void FrameBase::printHeader(int _depth, bool _constr_by, bool _metric, bool _state_blocks, std::ostream& _stream, std::string _tabs) const
 {
-    _stream << _tabs << (isKey() ? "KFrm" : "Frm") << id()
+    _stream << _tabs << "Frm" << id()
             << " " << getStructure()
             << " ts = " << std::setprecision(3) << getTimeStamp()
             << ((_depth < 2) ? " -- " + std::to_string(getCaptureList().size()) + "C  " : "");
@@ -367,7 +367,7 @@ CheckLog FrameBase::localCheck(bool _verbose, FrameBasePtr _frm_ptr, std::ostrea
     std::stringstream inconsistency_explanation;
 
     if (_verbose) {
-        _stream << _tabs << (isKey() ? "KFrm" : "Frm")
+        _stream << _tabs << "Frm"
                 << id() << " @ " << _frm_ptr.get() << std::endl;
         _stream << _tabs << "  " << "-> Prb @ " << getProblem().get() << std::endl;
         _stream << _tabs << "  " << "-> Trj @ " << getTrajectory().get() << std::endl;
diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp
index a4ef91f15..c559334e2 100644
--- a/src/processor/processor_motion.cpp
+++ b/src/processor/processor_motion.cpp
@@ -972,10 +972,10 @@ void ProcessorMotion::printHeader(int _depth, bool _constr_by, bool _metric, boo
 {
     _stream << _tabs << "PrcM" << id() << " " << getType() << " \"" << getName() << "\"" << std::endl;
     if (getOrigin())
-        _stream << _tabs << "  " << "o: Cap" << getOrigin()->id() << " - " << (getOrigin()->getFrame()->isKey() ? "  KFrm" : "  Frm" )
+        _stream << _tabs << "  " << "o: Cap" << getOrigin()->id() << " - " << "  Frm"
                 << getOrigin()->getFrame()->id() << std::endl;
     if (getLast())
-        _stream << _tabs << "  " << "l: Cap" << getLast()->id() << " - " << (getLast()->getFrame()->isKey() ? "  KFrm" : " Frm")
+        _stream << _tabs << "  " << "l: Cap" << getLast()->id() << " - " << " Frm"
                 << getLast()->getFrame()->id() << std::endl;
     if (getIncoming())
         _stream << _tabs << "  " << "i: Cap" << getIncoming()->id() << std::endl;
diff --git a/src/processor/processor_tracker.cpp b/src/processor/processor_tracker.cpp
index 1a6e53d7e..9f9034eac 100644
--- a/src/processor/processor_tracker.cpp
+++ b/src/processor/processor_tracker.cpp
@@ -276,11 +276,11 @@ void ProcessorTracker::computeProcessingStep()
 
             if (buffer_pack_kf_.selectPack(last_ptr_, params_tracker_->time_tolerance))
             {
-                if (last_ptr_->getFrame()->isKey())
+                if (last_ptr_->getFrame()->getProblem())
                 {
                     WOLF_WARN("||*||");
                     WOLF_INFO(" ... It seems you missed something!");
-                    WOLF_INFO("Pack's KF and last's KF have matching time stamps (i.e. below time tolerances)");
+                    WOLF_INFO("Pack's KF and last's Frame have matching time stamps (i.e. below time tolerances)");
                     WOLF_INFO("Check the following for correctness:");
                     WOLF_INFO("  - You have all processors installed before starting receiving any data");
                     WOLF_INFO("  - You have configured all your processors with compatible time tolerances");
@@ -311,10 +311,10 @@ void ProcessorTracker::printHeader(int _depth, bool _constr_by, bool _metric, bo
 {
     _stream << _tabs << "PrcT" << id() << " " << getType() << " \"" << getName() << "\"" << std::endl;
     if (getOrigin())
-        _stream << _tabs << "  " << "o: Cap" << getOrigin()->id() << " - " << (getOrigin()->getFrame()->isKey() ? "  KFrm" : " Frm")
+        _stream << _tabs << "  " << "o: Cap" << getOrigin()->id() << " - " << " Frm"
                 << getOrigin()->getFrame()->id() << std::endl;
     if (getLast())
-        _stream << _tabs << "  " << "l: Cap" << getLast()->id() << " - " << (getLast()->getFrame()->isKey() ? "  KFrm" : " Frm")
+        _stream << _tabs << "  " << "l: Cap" << getLast()->id() << " - " << " Frm"
                 << getLast()->getFrame()->id() << std::endl;
     if (getIncoming())
         _stream << _tabs << "  " << "i: Cap" << getIncoming()->id() << std::endl;
diff --git a/src/processor/track_matrix.cpp b/src/processor/track_matrix.cpp
index 6d7dd0f50..da6a88b75 100644
--- a/src/processor/track_matrix.cpp
+++ b/src/processor/track_matrix.cpp
@@ -214,7 +214,7 @@ Track TrackMatrix::trackAtKeyframes(size_t _track_id) const
         {
             auto& ts  = pair_ts_ftr.first;
             auto& ftr = pair_ts_ftr.second;
-            if (ftr && ftr->getCapture() && ftr->getCapture()->getFrame() && ftr->getCapture()->getFrame()->isKey())
+            if (ftr && ftr->getCapture() && ftr->getCapture()->getFrame() && ftr->getCapture()->getFrame()->getProblem())
                 track_kf[ts] = ftr;
         }
         return track_kf;
-- 
GitLab