Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
34e0918e
Commit
34e0918e
authored
6 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
small changes
parent
4b75206e
No related branches found
No related tags found
1 merge request
!300
Resolve "Robust remove() API"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/capture/capture_base.cpp
+1
-0
1 addition, 0 deletions
src/capture/capture_base.cpp
src/factor/factor_base.cpp
+7
-6
7 additions, 6 deletions
src/factor/factor_base.cpp
with
8 additions
and
6 deletions
src/capture/capture_base.cpp
+
1
−
0
View file @
34e0918e
...
@@ -315,6 +315,7 @@ void CaptureBase::move(FrameBasePtr _frm_ptr)
...
@@ -315,6 +315,7 @@ void CaptureBase::move(FrameBasePtr _frm_ptr)
void
CaptureBase
::
link
(
FrameBasePtr
_frm_ptr
)
void
CaptureBase
::
link
(
FrameBasePtr
_frm_ptr
)
{
{
assert
(
!
is_removing_
&&
"linking a removed capture"
);
assert
(
this
->
getFrame
()
==
nullptr
&&
"linking a capture already linked"
);
assert
(
this
->
getFrame
()
==
nullptr
&&
"linking a capture already linked"
);
if
(
_frm_ptr
)
if
(
_frm_ptr
)
...
...
This diff is collapsed.
Click to expand it.
src/factor/factor_base.cpp
+
7
−
6
View file @
34e0918e
...
@@ -49,7 +49,7 @@ void FactorBase::remove()
...
@@ -49,7 +49,7 @@ void FactorBase::remove()
if
(
!
is_removing_
)
if
(
!
is_removing_
)
{
{
is_removing_
=
true
;
is_removing_
=
true
;
FactorBasePtr
this_c
=
shared_from_this
();
// keep this alive while removing it
FactorBasePtr
this_
fa
c
=
shared_from_this
();
// keep this alive while removing it
FeatureBasePtr
f
=
feature_ptr_
.
lock
();
FeatureBasePtr
f
=
feature_ptr_
.
lock
();
if
(
f
)
if
(
f
)
{
{
...
@@ -59,13 +59,13 @@ void FactorBase::remove()
...
@@ -59,13 +59,13 @@ void FactorBase::remove()
}
}
// add factor to be removed from solver
// add factor to be removed from solver
if
(
getProblem
()
!=
nullptr
)
if
(
getProblem
()
!=
nullptr
)
getProblem
()
->
notifyFactor
(
shared_from_this
()
,
REMOVE
);
getProblem
()
->
notifyFactor
(
this_fac
,
REMOVE
);
// remove other: {Frame, Capture, Feature, Landmark}
// remove other: {Frame, Capture, Feature, Landmark}
FrameBasePtr
frm_o
=
frame_other_ptr_
.
lock
();
FrameBasePtr
frm_o
=
frame_other_ptr_
.
lock
();
if
(
frm_o
)
if
(
frm_o
)
{
{
frm_o
->
removeConstrainedBy
(
shared_from_this
()
);
frm_o
->
removeConstrainedBy
(
this_fac
);
if
(
frm_o
->
getConstrainedByList
().
empty
()
&&
frm_o
->
getCaptureList
().
empty
())
if
(
frm_o
->
getConstrainedByList
().
empty
()
&&
frm_o
->
getCaptureList
().
empty
())
frm_o
->
remove
();
frm_o
->
remove
();
}
}
...
@@ -73,7 +73,7 @@ void FactorBase::remove()
...
@@ -73,7 +73,7 @@ void FactorBase::remove()
CaptureBasePtr
cap_o
=
capture_other_ptr_
.
lock
();
CaptureBasePtr
cap_o
=
capture_other_ptr_
.
lock
();
if
(
cap_o
)
if
(
cap_o
)
{
{
cap_o
->
removeConstrainedBy
(
shared_from_this
()
);
cap_o
->
removeConstrainedBy
(
this_fac
);
if
(
cap_o
->
getConstrainedByList
().
empty
()
&&
cap_o
->
getFeatureList
().
empty
())
if
(
cap_o
->
getConstrainedByList
().
empty
()
&&
cap_o
->
getFeatureList
().
empty
())
cap_o
->
remove
();
cap_o
->
remove
();
}
}
...
@@ -81,7 +81,7 @@ void FactorBase::remove()
...
@@ -81,7 +81,7 @@ void FactorBase::remove()
FeatureBasePtr
ftr_o
=
feature_other_ptr_
.
lock
();
FeatureBasePtr
ftr_o
=
feature_other_ptr_
.
lock
();
if
(
ftr_o
)
if
(
ftr_o
)
{
{
ftr_o
->
removeConstrainedBy
(
shared_from_this
()
);
ftr_o
->
removeConstrainedBy
(
this_fac
);
if
(
ftr_o
->
getConstrainedByList
().
empty
()
&&
ftr_o
->
getFactorList
().
empty
())
if
(
ftr_o
->
getConstrainedByList
().
empty
()
&&
ftr_o
->
getFactorList
().
empty
())
ftr_o
->
remove
();
ftr_o
->
remove
();
}
}
...
@@ -89,7 +89,7 @@ void FactorBase::remove()
...
@@ -89,7 +89,7 @@ void FactorBase::remove()
LandmarkBasePtr
lmk_o
=
landmark_other_ptr_
.
lock
();
LandmarkBasePtr
lmk_o
=
landmark_other_ptr_
.
lock
();
if
(
lmk_o
)
if
(
lmk_o
)
{
{
lmk_o
->
removeConstrainedBy
(
shared_from_this
()
);
lmk_o
->
removeConstrainedBy
(
this_fac
);
if
(
lmk_o
->
getConstrainedByList
().
empty
())
if
(
lmk_o
->
getConstrainedByList
().
empty
())
lmk_o
->
remove
();
lmk_o
->
remove
();
}
}
...
@@ -143,6 +143,7 @@ void FactorBase::setStatus(FactorStatus _status)
...
@@ -143,6 +143,7 @@ void FactorBase::setStatus(FactorStatus _status)
void
FactorBase
::
link
(
FeatureBasePtr
_ftr_ptr
)
void
FactorBase
::
link
(
FeatureBasePtr
_ftr_ptr
)
{
{
assert
(
!
is_removing_
&&
"linking a removed factor"
);
assert
(
this
->
getFeature
()
==
nullptr
&&
"linking an already linked factor"
);
assert
(
this
->
getFeature
()
==
nullptr
&&
"linking an already linked factor"
);
// not link if nullptr
// not link if nullptr
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment