From ab9aec503f89aa48035c298e33c578fd8baf5bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Wed, 1 Apr 2020 01:47:04 +0200 Subject: [PATCH] Implement lists of NodeOther and API --- include/core/factor/factor_base.h | 8 ++-- src/factor/factor_base.cpp | 64 +++++++++++++++---------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/include/core/factor/factor_base.h b/include/core/factor/factor_base.h index 8ecf4fe49..16311a196 100644 --- a/include/core/factor/factor_base.h +++ b/include/core/factor/factor_base.h @@ -182,10 +182,10 @@ class FactorBase : public NodeBase, public std::enable_shared_from_this<FactorBa FeatureBaseWPtrList getFeatureOtherList() const { return feature_other_list_; } LandmarkBaseWPtrList getLandmarkOtherList() const { return landmark_other_list_; } - bool hasFrameOther(const FrameBasePtr& _frm_other); - bool hasCaptureOther(const CaptureBasePtr& _cap_other); - bool hasFeatureOther(const FeatureBasePtr& _ftr_other); - bool hasLandmarkOther(const LandmarkBasePtr& _lmk_other); + bool hasFrameOther(const FrameBasePtr& _frm_other) const; + bool hasCaptureOther(const CaptureBasePtr& _cap_other) const; + bool hasFeatureOther(const FeatureBasePtr& _ftr_other) const; + bool hasLandmarkOther(const LandmarkBasePtr& _lmk_other) const; public: /** diff --git a/src/factor/factor_base.cpp b/src/factor/factor_base.cpp index 8e39c60db..3b6b99fe8 100644 --- a/src/factor/factor_base.cpp +++ b/src/factor/factor_base.cpp @@ -169,60 +169,60 @@ void FactorBase::setStatus(FactorStatus _status) status_ = _status; } -bool FactorBase::hasFrameOther(const FrameBasePtr &_frm_other) +bool FactorBase::hasFrameOther(const FrameBasePtr &_frm_other) const { - FrameBaseWPtrList::iterator frm_it = find_if(frame_other_list_.begin(), - frame_other_list_.end(), - [_frm_other](const FrameBaseWPtr &frm_ow) - { - return frm_ow.lock() == _frm_other; - } - ); + FrameBaseWConstIter frm_it = find_if(frame_other_list_.begin(), + frame_other_list_.end(), + [_frm_other](const FrameBaseWPtr &frm_ow) + { + return frm_ow.lock() == _frm_other; + } + ); if (frm_it != frame_other_list_.end()) return true; return false; } -bool FactorBase::hasCaptureOther(const CaptureBasePtr &_cap_other) +bool FactorBase::hasCaptureOther(const CaptureBasePtr &_cap_other) const { - CaptureBaseWPtrList::iterator cap_it = find_if(capture_other_list_.begin(), - capture_other_list_.end(), - [_cap_other](const CaptureBaseWPtr &cap_ow) - { - return cap_ow.lock() == _cap_other; - } - ); + CaptureBaseWConstIter cap_it = find_if(capture_other_list_.begin(), + capture_other_list_.end(), + [_cap_other](const CaptureBaseWPtr &cap_ow) + { + return cap_ow.lock() == _cap_other; + } + ); if (cap_it != capture_other_list_.end()) return true; return false; } -bool FactorBase::hasFeatureOther(const FeatureBasePtr &_ftr_other) +bool FactorBase::hasFeatureOther(const FeatureBasePtr &_ftr_other) const { - FeatureBaseWPtrList::iterator ftr_it = find_if(feature_other_list_.begin(), - feature_other_list_.end(), - [_ftr_other](const FeatureBaseWPtr &ftr_ow) - { - return ftr_ow.lock() == _ftr_other; - } - ); + FeatureBaseWConstIter ftr_it = find_if(feature_other_list_.begin(), + feature_other_list_.end(), + [_ftr_other](const FeatureBaseWPtr &ftr_ow) + { + return ftr_ow.lock() == _ftr_other; + } + ); if (ftr_it != feature_other_list_.end()) return true; return false; } -bool FactorBase::hasLandmarkOther(const LandmarkBasePtr &_lmk_other) +bool FactorBase::hasLandmarkOther(const LandmarkBasePtr &_lmk_other) const { - LandmarkBaseWPtrList::iterator lmk_it = find_if(landmark_other_list_.begin(), - landmark_other_list_.end(), - [_lmk_other](const LandmarkBaseWPtr &lmk_ow) - { - return lmk_ow.lock() == _lmk_other; - } - ); + LandmarkBaseWConstIter lmk_it = find_if(landmark_other_list_.begin(), + landmark_other_list_.end(), + [_lmk_other](const LandmarkBaseWPtr &lmk_ow) + { + return lmk_ow.lock() == _lmk_other; + } + ); if (lmk_it != landmark_other_list_.end()) return true; -- GitLab