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

added assertions in link() checking not removing

parent 34e0918e
No related branches found
No related tags found
1 merge request!300Resolve "Robust remove() API"
......@@ -157,6 +157,7 @@ Eigen::MatrixXs FeatureBase::computeSqrtUpper(const Eigen::MatrixXs & _info) con
void FeatureBase::link(CaptureBasePtr _cpt_ptr)
{
assert(!is_removing_ && "linking a removed feature");
assert(this->getCapture() == nullptr && "linking an already linked feature");
if(_cpt_ptr)
......
......@@ -408,6 +408,7 @@ void FrameBase::removeConstrainedBy(FactorBasePtr _fac_ptr)
void FrameBase::link(TrajectoryBasePtr _trj_ptr)
{
assert(!is_removing_ && "linking a removed frame");
assert(this->getTrajectory() == nullptr && "linking an already linked frame");
if(_trj_ptr)
......
......@@ -164,6 +164,7 @@ YAML::Node LandmarkBase::saveToYaml() const
void LandmarkBase::link(MapBasePtr _map_ptr)
{
assert(!is_removing_ && "linking a removed landmark");
assert(this->getMap() == nullptr && "linking an already linked landmark");
if(_map_ptr)
......
......@@ -81,6 +81,7 @@ void ProcessorBase::remove()
void ProcessorBase::link(SensorBasePtr _sen_ptr)
{
assert(!is_removing_ && "linking a removed processor");
assert(this->getSensor() == nullptr && "linking an already linked processor");
if(_sen_ptr)
......
......@@ -409,6 +409,7 @@ void SensorBase::setProblem(ProblemPtr _problem)
void SensorBase::link(HardwareBasePtr _hw_ptr)
{
assert(!is_removing_ && "linking a removed sensor");
assert(this->getHardware() == nullptr && "linking an already linked sensor");
if(_hw_ptr)
{
......
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