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

destruct instead of delete

parent 835ae78a
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ CaptureBase::~CaptureBase() ...@@ -26,7 +26,7 @@ CaptureBase::~CaptureBase()
is_deleting_ = true; is_deleting_ = true;
while (!feature_list_.empty()) while (!feature_list_.empty())
{ {
delete feature_list_.front(); feature_list_.front()->destruct();
feature_list_.pop_front(); feature_list_.pop_front();
} }
} }
......
...@@ -106,15 +106,16 @@ int main (int argc, char** argv) ...@@ -106,15 +106,16 @@ int main (int argc, char** argv)
Scalar dt = 0.1; Scalar dt = 0.1;
CaptureMotion* cap_odo = new CaptureMotion(TimeStamp(0), sen, data);
cout << "t: " << 0 << " \t\t\t x = ( " << problem->getCurrentState().transpose() << ")" << endl; cout << "t: " << 0 << " \t\t\t x = ( " << problem->getCurrentState().transpose() << ")" << endl;
print(problem); print(problem);
cout << "--------------------------------------------------------------" << endl; cout << "--------------------------------------------------------------" << endl;
for (TimeStamp t = dt; t < tf - Constants::EPS; t += dt) for (TimeStamp t = dt; t < tf - Constants::EPS; t += dt)
{ {
cap_odo->setTimeStamp(t);
CaptureMotion* cap_odo = new CaptureMotion(t, sen, data); cap_odo->setData(data);
cap_odo->process(); cap_odo->process();
cout << "t: " << t.get() << " \t\t x = ( " << problem->getCurrentState().transpose() << ")" << endl; cout << "t: " << t.get() << " \t\t x = ( " << problem->getCurrentState().transpose() << ")" << endl;
......
...@@ -51,7 +51,7 @@ FeatureBase::~FeatureBase() ...@@ -51,7 +51,7 @@ FeatureBase::~FeatureBase()
while (!constraint_list_.empty()) while (!constraint_list_.empty())
{ {
delete constraint_list_.front(); constraint_list_.front()->destruct();
constraint_list_.pop_front(); constraint_list_.pop_front();
} }
......
...@@ -76,7 +76,7 @@ FrameBase::~FrameBase() ...@@ -76,7 +76,7 @@ FrameBase::~FrameBase()
while (!capture_list_.empty()) while (!capture_list_.empty())
{ {
delete capture_list_.front(); capture_list_.front()->destruct();
capture_list_.pop_front(); capture_list_.pop_front();
} }
......
...@@ -234,14 +234,14 @@ inline void FrameBase::removeCapture(const CaptureBaseIter& _capt_iter) ...@@ -234,14 +234,14 @@ inline void FrameBase::removeCapture(const CaptureBaseIter& _capt_iter)
{ {
//std::cout << "removing capture " << (*_capt_iter)->nodeId() << " from Frame " << nodeId() << std::endl; //std::cout << "removing capture " << (*_capt_iter)->nodeId() << " from Frame " << nodeId() << std::endl;
capture_list_.erase(_capt_iter); capture_list_.erase(_capt_iter);
delete *_capt_iter; //delete *_capt_iter;
} }
inline void FrameBase::removeCapture(const CaptureBasePtr _capt_ptr) inline void FrameBase::removeCapture(const CaptureBasePtr _capt_ptr)
{ {
//std::cout << "removing capture " << (*_capt_iter)->nodeId() << " from Frame " << nodeId() << std::endl; //std::cout << "removing capture " << (*_capt_iter)->nodeId() << " from Frame " << nodeId() << std::endl;
capture_list_.remove(_capt_ptr); capture_list_.remove(_capt_ptr);
delete _capt_ptr; //delete _capt_ptr;
} }
inline StateStatus FrameBase::getStatus() const inline StateStatus FrameBase::getStatus() const
......
...@@ -38,7 +38,7 @@ SensorBasePtr HardwareBase::addSensor(SensorBasePtr _sensor_ptr) ...@@ -38,7 +38,7 @@ SensorBasePtr HardwareBase::addSensor(SensorBasePtr _sensor_ptr)
void HardwareBase::removeSensor(SensorBasePtr _sensor_ptr) void HardwareBase::removeSensor(SensorBasePtr _sensor_ptr)
{ {
sensor_list_.remove(_sensor_ptr); sensor_list_.remove(_sensor_ptr);
delete _sensor_ptr; // delete _sensor_ptr;
} }
} // namespace wolf } // namespace wolf
...@@ -55,7 +55,7 @@ namespace wolf { ...@@ -55,7 +55,7 @@ namespace wolf {
inline void HardwareBase::removeSensor(const SensorBaseIter& _sensor_iter) inline void HardwareBase::removeSensor(const SensorBaseIter& _sensor_iter)
{ {
sensor_list_.erase(_sensor_iter); sensor_list_.erase(_sensor_iter);
delete * _sensor_iter; // delete * _sensor_iter;
// removeDownNode(_sensor_iter); // removeDownNode(_sensor_iter);
} }
......
...@@ -46,6 +46,7 @@ LandmarkBase::~LandmarkBase() ...@@ -46,6 +46,7 @@ LandmarkBase::~LandmarkBase()
{ {
//std::cout << "destruct() constraint " << (*constrained_by_list_.begin())->nodeId() << std::endl; //std::cout << "destruct() constraint " << (*constrained_by_list_.begin())->nodeId() << std::endl;
constrained_by_list_.front()->destruct(); constrained_by_list_.front()->destruct();
constrained_by_list_.pop_front();
//std::cout << "deleted " << std::endl; //std::cout << "deleted " << std::endl;
} }
//std::cout << "constraints deleted" << std::endl; //std::cout << "constraints deleted" << std::endl;
......
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