Added conversion functions from Fast* classes to stl containers. Added permuteWithInverse() to BayesTree

release/4.3a0
Alex Cunningham 2012-10-08 20:30:59 +00:00
parent a004354c20
commit 82593a2432
4 changed files with 20 additions and 0 deletions

View File

@ -62,6 +62,11 @@ public:
Base::assign(x.begin(), x.end());
}
/** Conversion to a standard STL container */
operator std::list<VALUE>() const {
return std::list<VALUE>(this->begin(), this->end());
}
private:
/** Serialization function */
friend class boost::serialization::access;

View File

@ -53,6 +53,11 @@ public:
/** Copy constructor from the base map class */
FastMap(const Base& x) : Base(x) {}
/** Conversion to a standard STL container */
operator std::map<KEY,VALUE>() const {
return std::map<KEY,VALUE>(this->begin(), this->end());
}
private:
/** Serialization function */
friend class boost::serialization::access;

View File

@ -86,6 +86,11 @@ public:
Base::insert(x.begin(), x.end());
}
/** Conversion to a standard STL container */
operator std::set<VALUE>() const {
return std::set<VALUE>(this->begin(), this->end());
}
/** Print to implement Testable */
void print(const std::string& str = "") const { FastSetTestableHelper<VALUE>::print(*this, str); }

View File

@ -229,6 +229,11 @@ namespace gtsam {
root_->deleteCachedShorcuts();
}
/** Apply a permutation to all cliques */
void permuteWithInverse(const Permutation& inversePermutation) {
root_->permuteWithInverse(inversePermutation);
}
/**
* Remove path from clique to root and return that path as factors
* plus a list of orphaned subtree roots. Used in removeTop below.