remove method to set factor to NULL
parent
3158a5c7c1
commit
d0b757da48
|
@ -245,7 +245,7 @@ FactorGraph<Factor>::findAndRemoveFactors(const string& key) {
|
||||||
BOOST_FOREACH(int i, *indices_ptr) {
|
BOOST_FOREACH(int i, *indices_ptr) {
|
||||||
if(factors_[i] == NULL) continue; // skip NULL factors
|
if(factors_[i] == NULL) continue; // skip NULL factors
|
||||||
found.push_back(factors_[i]); // add to found
|
found.push_back(factors_[i]); // add to found
|
||||||
factors_[i].reset(); // set factor to NULL.
|
remove(i); // set factor to NULL.
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,9 @@ namespace gtsam {
|
||||||
/** Get a specific factor by index */
|
/** Get a specific factor by index */
|
||||||
inline sharedFactor operator[](size_t i) const {return factors_[i];}
|
inline sharedFactor operator[](size_t i) const {return factors_[i];}
|
||||||
|
|
||||||
|
/** delete factor without re-arranging indexes by inserting a NULL pointer */
|
||||||
|
inline void remove(size_t i) { factors_[i].reset();}
|
||||||
|
|
||||||
/** return the number of factors and NULLS */
|
/** return the number of factors and NULLS */
|
||||||
inline size_t size() const { return factors_.size();}
|
inline size_t size() const { return factors_.size();}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue