Made keys_ protected to allow initialization in a constructor body, added constructor for NonlinearFactor allowing more than two keys

release/4.3a0
Alex Cunningham 2011-03-30 14:09:34 +00:00
parent f244310250
commit ce70480ae0
2 changed files with 10 additions and 1 deletions

View File

@ -70,7 +70,8 @@ public:
/** Const iterator over keys */
typedef typename std::vector<Key>::const_iterator const_iterator;
private:
//private: // FIXME: factors that manually initialize keys_ break in this case
protected:
// The keys involved in this factor
std::vector<Key> keys_;

View File

@ -99,6 +99,14 @@ namespace gtsam {
Factor<Symbol>(j1,j2), noiseModel_(noiseModel) {
}
/**
* Constructor - arbitrary number of keys
* @param keys is the set of Symbols in the factor
*/
NonlinearFactor(const SharedGaussian& noiseModel, const std::set<Symbol>& keys) :
Factor<Symbol>(keys), noiseModel_(noiseModel) {
}
/** print */
virtual void print(const std::string& s = "") const {
std::cout << s << ": NonlinearFactor\n";