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,11 +67,14 @@ 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();}
|
||||||
|
|
||||||
/** return the number valid factors */
|
/** return the number valid factors */
|
||||||
size_t nrFactors() const;
|
size_t nrFactors() const;
|
||||||
|
|
||||||
/** Add a factor */
|
/** Add a factor */
|
||||||
void push_back(sharedFactor factor);
|
void push_back(sharedFactor factor);
|
||||||
|
@ -95,9 +98,9 @@ namespace gtsam {
|
||||||
*/
|
*/
|
||||||
Ordering getOrdering() const;
|
Ordering getOrdering() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shared pointer versions for MATLAB
|
* shared pointer versions for MATLAB
|
||||||
*/
|
*/
|
||||||
boost::shared_ptr<Ordering> getOrdering_() const;
|
boost::shared_ptr<Ordering> getOrdering_() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue