Skip to content
Snippets Groups Projects
Commit f51d0557 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

Revert "lock() != nullptr instead of expired()"

This reverts commit bccd0283
parent bccd0283
No related branches found
No related tags found
1 merge request!394Resolve "Safe and more complete print()"
Pipeline #5914 passed
...@@ -316,27 +316,27 @@ void FactorBase::printHeader(int _depth, bool _constr_by, bool _metric, bool _st ...@@ -316,27 +316,27 @@ void FactorBase::printHeader(int _depth, bool _constr_by, bool _metric, bool _st
for (const auto& Fow : getFrameOtherList()) for (const auto& Fow : getFrameOtherList())
{ {
auto Fo = Fow.lock(); auto Fow_sh = Fow.lock();
if (Fo) if (Fow_sh)
_stream << " Frm" << Fo->id(); _stream << " Frm" << Fow_sh->id();
} }
for (const auto& Cow : getCaptureOtherList()) for (const auto& Cow : getCaptureOtherList())
{ {
auto Co = Cow.lock(); auto Cow_sh = Cow.lock();
if (Co) if (Cow_sh)
_stream << " Cap" << Co->id(); _stream << " Cap" << Cow_sh->id();
} }
for (const auto& fow : getFeatureOtherList()) for (const auto& fow : getFeatureOtherList())
{ {
auto fo = fow.lock(); auto fow_sh = fow.lock();
if (fo) if (fow_sh)
_stream << " Ftr" << fo->id(); _stream << " Ftr" << fow_sh->id();
} }
for (const auto& Low : getLandmarkOtherList()) for (const auto& Low : getLandmarkOtherList())
{ {
auto Lo = Low.lock(); auto Low_sh = Low.lock();
if (Lo) if (Low_sh)
_stream << " Lmk" << Lo->id(); _stream << " Lmk" << Low_sh->id();
} }
_stream << std::endl; _stream << std::endl;
} }
...@@ -366,9 +366,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr ...@@ -366,9 +366,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr
// find constrained_by pointer in constrained frame // find constrained_by pointer in constrained frame
for (const auto& Fow : getFrameOtherList()) for (const auto& Fow : getFrameOtherList())
{ {
const auto& Fo = Fow.lock(); if (!Fow.expired())
if (Fo)
{ {
const auto& Fo = Fow.lock();
if (_verbose) if (_verbose)
{ {
_stream << " ( --> Frm" << Fo->id() << " <- "; _stream << " ( --> Frm" << Fo->id() << " <- ";
...@@ -389,9 +389,10 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr ...@@ -389,9 +389,10 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr
// find constrained_by pointer in constrained capture // find constrained_by pointer in constrained capture
for (const auto& Cow : getCaptureOtherList()) for (const auto& Cow : getCaptureOtherList())
{ {
const auto& Co = Cow.lock(); if (!Cow.expired())
if (Co)
{ {
const auto& Co = Cow.lock();
if (_verbose) if (_verbose)
{ {
_stream << " ( --> Cap" << Co->id() << " <- "; _stream << " ( --> Cap" << Co->id() << " <- ";
...@@ -412,9 +413,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr ...@@ -412,9 +413,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr
// find constrained_by pointer in constrained feature // find constrained_by pointer in constrained feature
for (const auto& fow : getFeatureOtherList()) for (const auto& fow : getFeatureOtherList())
{ {
const auto& fo = fow.lock(); if (!fow.expired())
if (fo)
{ {
const auto& fo = fow.lock();
if (_verbose) if (_verbose)
{ {
_stream << " ( --> Ftr" << fo->id() << " <- "; _stream << " ( --> Ftr" << fo->id() << " <- ";
...@@ -435,9 +436,10 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr ...@@ -435,9 +436,10 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr
// find constrained_by pointer in constrained landmark // find constrained_by pointer in constrained landmark
for (const auto& Low : getLandmarkOtherList()) for (const auto& Low : getLandmarkOtherList())
{ {
const auto& Lo = Low.lock(); if (Low.expired())
if (Lo)
{ {
const auto& Lo = Low.lock();
if (_verbose) if (_verbose)
{ {
_stream << " ( --> Lmk" << Lo->id() << " <- "; _stream << " ( --> Lmk" << Lo->id() << " <- ";
...@@ -528,9 +530,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr ...@@ -528,9 +530,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr
// find in constrained Frame // find in constrained Frame
for (const auto& Fow : getFrameOtherList()) for (const auto& Fow : getFrameOtherList())
{ {
const auto& Fo = Fow.lock(); if (!Fow.expired())
if (Fo)
{ {
const auto& Fo = Fow.lock();
found_here = Fo->hasStateBlock(sb); found_here = Fo->hasStateBlock(sb);
if (found_here && _verbose) _stream << " FrmO" << Fo->id(); if (found_here && _verbose) _stream << " FrmO" << Fo->id();
found = found || found_here; found = found || found_here;
...@@ -549,9 +551,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr ...@@ -549,9 +551,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr
// find in constrained Capture // find in constrained Capture
for (const auto& Cow : getCaptureOtherList()) for (const auto& Cow : getCaptureOtherList())
{ {
const auto& Co = Cow.lock(); if (!Cow.expired())
if (Co)
{ {
const auto& Co = Cow.lock();
found_here = Co->hasStateBlock(sb); found_here = Co->hasStateBlock(sb);
if (found_here && _verbose) _stream << " CapO" << Co->id(); if (found_here && _verbose) _stream << " CapO" << Co->id();
found = found || found_here; found = found || found_here;
...@@ -561,9 +563,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr ...@@ -561,9 +563,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr
// find in constrained Feature // find in constrained Feature
for (const auto& fow : getFeatureOtherList()) for (const auto& fow : getFeatureOtherList())
{ {
const auto& fo = fow.lock(); if (!fow.expired())
if (fo)
{ {
const auto& fo = fow.lock();
// find in constrained feature's Frame // find in constrained feature's Frame
auto foF = fo->getFrame(); auto foF = fo->getFrame();
found_here = foF->hasStateBlock(sb); found_here = foF->hasStateBlock(sb);
...@@ -587,9 +589,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr ...@@ -587,9 +589,9 @@ CheckLog FactorBase::localCheck(bool _verbose, FactorBasePtr _fac_ptr, std::ostr
// find in constrained landmark // find in constrained landmark
for (const auto& Low : getLandmarkOtherList()) for (const auto& Low : getLandmarkOtherList())
{ {
const auto& Lo = Low.lock(); if (!Low.expired())
if (Lo)
{ {
const auto& Lo = Low.lock();
found_here = Lo->hasStateBlock(sb); found_here = Lo->hasStateBlock(sb);
if (found_here && _verbose) _stream << " LmkO" << Lo->id(); if (found_here && _verbose) _stream << " LmkO" << Lo->id();
found = found || found_here; found = found || found_here;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment