Made Roots typedef in BayesTree

release/4.3a0
Richard Roberts 2014-02-22 16:28:37 -05:00
parent c5338811a0
commit a9ea1f4033
2 changed files with 7 additions and 4 deletions

View File

@ -413,12 +413,12 @@ namespace gtsam {
void BayesTree<CLIQUE>::removeClique(sharedClique clique)
{
if (clique->isRoot()) {
typename FastVector<sharedClique>::iterator root = std::find(roots_.begin(), roots_.end(), clique);
typename Roots::iterator root = std::find(roots_.begin(), roots_.end(), clique);
if(root != roots_.end())
roots_.erase(root);
} else { // detach clique from parent
sharedClique parent = clique->parent_.lock();
typename FastVector<sharedClique>::iterator child = std::find(parent->children.begin(), parent->children.end(), clique);
typename Roots::iterator child = std::find(parent->children.begin(), parent->children.end(), clique);
assert(child != parent->children.end());
parent->children.erase(child);
}

View File

@ -95,7 +95,10 @@ namespace gtsam {
Nodes nodes_;
/** Root cliques */
FastVector<sharedClique> roots_;
typedef FastVector<sharedClique> Roots;
/** Root cliques */
Roots roots_;
/// @name Standard Constructors
/// @{
@ -141,7 +144,7 @@ namespace gtsam {
const sharedNode operator[](Key j) const { return nodes_.at(j); }
/** return root cliques */
const FastVector<sharedClique>& roots() const { return roots_; }
const Roots& roots() const { return roots_; }
/** alternate syntax for matlab: find the clique that contains the variable with Key j */
const sharedClique& clique(Key j) const {