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