diff --git a/include/core/factor/factor_base.h b/include/core/factor/factor_base.h index 8ecf4fe494f6f2714cc7492718a521dcf2ef1629..16311a1968a9fea0a8f2f80cdc593d4b6c8f353f 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 8e39c60db29d77fb7349d33f0ee02aa2d0d2a3c6..3b6b99fe8edb0aad8f2cbe26b582b42cffd4b359 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;