From 6f11c0803be67c1a5fb80a75bb32696c424fc71d Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 22 Nov 2009 16:46:29 +0000 Subject: [PATCH] Cliques class --- cpp/BayesTree-inl.h | 4 ++-- cpp/BayesTree.h | 11 +++++++++-- cpp/testBayesTree.cpp | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cpp/BayesTree-inl.h b/cpp/BayesTree-inl.h index 3b8c41322..a895be67d 100644 --- a/cpp/BayesTree-inl.h +++ b/cpp/BayesTree-inl.h @@ -348,11 +348,11 @@ namespace gtsam { /* ************************************************************************* */ template template - pair, list::sharedClique> > + pair, typename BayesTree::Cliques> BayesTree::removePath(sharedClique clique) { FactorGraph factors; - list orphans; + Cliques orphans; // base case is NULL, if so we do nothing and return empties above if (clique!=NULL) { diff --git a/cpp/BayesTree.h b/cpp/BayesTree.h index 9b22829e6..cd6db13cd 100644 --- a/cpp/BayesTree.h +++ b/cpp/BayesTree.h @@ -79,10 +79,17 @@ namespace gtsam { /** return the joint P(C1,C2), where C1==this. TODO: not a method? */ template FactorGraph joint(shared_ptr C2, shared_ptr root); -}; + }; + // typedef for shared pointers to cliques typedef boost::shared_ptr sharedClique; + // A convenience class for a list of shared cliques + struct Cliques : public std::list, public Testable { + void print(const std::string& s = "") const {} + bool equals(const Cliques& other, double tol = 1e-9) const { return false; } + }; + private: /** Map from keys to Clique */ @@ -157,7 +164,7 @@ namespace gtsam { /** Remove path from clique to root and return that path as factors plus a list of orphaned subtree roots */ template - std::pair, std::list > removePath(sharedClique clique); + std::pair, Cliques> removePath(sharedClique clique); }; // BayesTree diff --git a/cpp/testBayesTree.cpp b/cpp/testBayesTree.cpp index 2d4e7adaf..9b580eda0 100644 --- a/cpp/testBayesTree.cpp +++ b/cpp/testBayesTree.cpp @@ -333,7 +333,7 @@ TEST( BayesTree, removePath ) expected.push_factor("A","C"); FactorGraph factors; - list orphans; + SymbolicBayesTree::Cliques orphans; boost::tie(factors,orphans) = bayesTree.removePath(bayesTree["C"]); CHECK(assert_equal((FactorGraph)expected, factors));