diff --git a/src/factor/factor_base.cpp b/src/factor/factor_base.cpp index 429379fe922e7d1cd663f30b8fa9634f374ce3cd..3a8b7abcc2e7262cf78779b02e873fcc1ec2e9ef 100644 --- a/src/factor/factor_base.cpp +++ b/src/factor/factor_base.cpp @@ -316,27 +316,27 @@ void FactorBase::printHeader(int _depth, bool _constr_by, bool _metric, bool _st for (const auto& Fow : getFrameOtherList()) { - auto Fow_sh = Fow.lock(); - if (Fow_sh) - _stream << " Frm" << Fow_sh->id(); + auto Fo = Fow.lock(); + if (Fo) + _stream << " Frm" << Fo->id(); } for (const auto& Cow : getCaptureOtherList()) { - auto Cow_sh = Cow.lock(); - if (Cow_sh) - _stream << " Cap" << Cow_sh->id(); + auto Co = Cow.lock(); + if (Co) + _stream << " Cap" << Co->id(); } for (const auto& fow : getFeatureOtherList()) { - auto fow_sh = fow.lock(); - if (fow_sh) - _stream << " Ftr" << fow_sh->id(); + auto fo = fow.lock(); + if (fo) + _stream << " Ftr" << fo->id(); } for (const auto& Low : getLandmarkOtherList()) { - auto Low_sh = Low.lock(); - if (Low_sh) - _stream << " Lmk" << Low_sh->id(); + auto Lo = Low.lock(); + if (Lo) + _stream << " Lmk" << Lo->id(); } _stream << std::endl; } @@ -366,9 +366,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr // find constrained_by pointer in constrained frame for (const auto& Fow : getFrameOtherList()) { - if (!Fow.expired()) + const auto& Fo = Fow.lock(); + if (Fo) { - const auto& Fo = Fow.lock(); if (_verbose) { _stream << " ( --> Frm" << Fo->id() << " <- "; @@ -389,10 +389,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr // find constrained_by pointer in constrained capture for (const auto& Cow : getCaptureOtherList()) { - if (!Cow.expired()) + const auto& Co = Cow.lock(); + if (Co) { - const auto& Co = Cow.lock(); - if (_verbose) { _stream << " ( --> Cap" << Co->id() << " <- "; @@ -413,9 +412,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr // find constrained_by pointer in constrained feature for (const auto& fow : getFeatureOtherList()) { - if (!fow.expired()) + const auto& fo = fow.lock(); + if (fo) { - const auto& fo = fow.lock(); if (_verbose) { _stream << " ( --> Ftr" << fo->id() << " <- "; @@ -436,10 +435,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr // find constrained_by pointer in constrained landmark for (const auto& Low : getLandmarkOtherList()) { - if (Low.expired()) + const auto& Lo = Low.lock(); + if (Lo) { - const auto& Lo = Low.lock(); - if (_verbose) { _stream << " ( --> Lmk" << Lo->id() << " <- "; @@ -530,9 +528,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr // find in constrained Frame for (const auto& Fow : getFrameOtherList()) { - if (!Fow.expired()) + const auto& Fo = Fow.lock(); + if (Fo) { - const auto& Fo = Fow.lock(); found_here = Fo->hasStateBlock(sb); if (found_here && _verbose) _stream << " FrmO" << Fo->id(); found = found || found_here; @@ -551,9 +549,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr // find in constrained Capture for (const auto& Cow : getCaptureOtherList()) { - if (!Cow.expired()) + const auto& Co = Cow.lock(); + if (Co) { - const auto& Co = Cow.lock(); found_here = Co->hasStateBlock(sb); if (found_here && _verbose) _stream << " CapO" << Co->id(); found = found || found_here; @@ -563,9 +561,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr // find in constrained Feature for (const auto& fow : getFeatureOtherList()) { - if (!fow.expired()) + const auto& fo = fow.lock(); + if (fo) { - const auto& fo = fow.lock(); // find in constrained feature's Frame auto foF = fo->getFrame(); found_here = foF->hasStateBlock(sb); @@ -589,9 +587,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr // find in constrained landmark for (const auto& Low : getLandmarkOtherList()) { - if (!Low.expired()) + const auto& Lo = Low.lock(); + if (Lo) { - const auto& Lo = Low.lock(); found_here = Lo->hasStateBlock(sb); if (found_here && _verbose) _stream << " LmkO" << Lo->id(); found = found || found_here;