Implement printing rather than calling factor graph version

release/4.3a0
Frank Dellaert 2022-12-25 18:19:02 -05:00
parent f3c85aec2b
commit 76e838b8d0
1 changed files with 8 additions and 1 deletions

View File

@ -31,7 +31,14 @@ namespace gtsam {
template <class CONDITIONAL>
void BayesNet<CONDITIONAL>::print(const std::string& s,
const KeyFormatter& formatter) const {
Base::print(s, formatter);
std::cout << (s.empty() ? "" : s + " ") << std::endl;
std::cout << "size: " << this->size() << std::endl;
for (size_t i = 0; i < this->size(); i++) {
const auto& conditional = this->at(i);
std::stringstream ss;
ss << "conditional " << i << ": ";
if (conditional) conditional->print(ss.str(), formatter);
}
}
/* ************************************************************************* */