Minor updates: cachedShortcut is now protected. DeleteCachedShortcuts() are now called on the resulting orphans in the removeTop() instead of the whole tree.

release/4.3a0
Abhijit Kundu 2012-06-22 19:51:08 +00:00
parent 6f1ea87a00
commit e42dc5cdc9
2 changed files with 10 additions and 8 deletions

View File

@ -575,9 +575,6 @@ namespace gtsam {
void BayesTree<CONDITIONAL,CLIQUE>::removeTop(const CONTAINER& keys,
BayesNet<CONDITIONAL>& bn, typename BayesTree<CONDITIONAL,CLIQUE>::Cliques& orphans) {
//TODO: Improve this
deleteCachedShorcuts(this->root_);
// process each key of the new factor
BOOST_FOREACH(const Index& key, keys) {
@ -590,6 +587,11 @@ namespace gtsam {
}
}
}
// Delete cachedShorcuts for each orphan subtree
//TODO: Consider Improving
BOOST_FOREACH(sharedClique& orphan, orphans)
deleteCachedShorcuts(orphan);
}
/* ************************************************************************* */

View File

@ -75,14 +75,14 @@ namespace gtsam {
/// @}
/// This stores the Cached Shortcut value
mutable boost::optional<BayesNet<ConditionalType> > cachedShortcut_;
public:
sharedConditional conditional_;
derived_weak_ptr parent_;
std::list<derived_ptr> children_;
/// This stores the Cached Shortcut value
mutable boost::optional<BayesNet<ConditionalType> > cachedShortcut_;
/// @name Testable
/// @{
@ -114,7 +114,7 @@ namespace gtsam {
/** The arrow operator accesses the conditional */
const ConditionalType* operator->() const { return conditional_.get(); }
///TODO: comment
/** return the const reference of children */
const std::list<derived_ptr>& children() const { return children_; }
/// @}
@ -124,7 +124,7 @@ namespace gtsam {
/** The arrow operator accesses the conditional */
ConditionalType* operator->() { return conditional_.get(); }
/** return the const reference of children */
/** return the reference of children non-const version*/
std::list<derived_ptr>& children() { return children_; }
/** Construct shared_ptr from a conditional, leaving parent and child pointers uninitialized */