Provided (some) printing functionality

release/4.3a0
dellaert 2014-12-12 12:39:32 +01:00
parent 012827dc98
commit c1f464625b
2 changed files with 13 additions and 0 deletions

View File

@ -34,6 +34,7 @@
#include <boost/mpl/fold.hpp>
namespace MPL = boost::mpl::placeholders;
#include <typeinfo> // operator typeid
#include <map>
class ExpressionFactorBinaryTest;
@ -247,6 +248,13 @@ public:
virtual ~ExpressionNode() {
}
/// Streaming
GTSAM_EXPORT friend std::ostream &operator<<(std::ostream &os,
const ExpressionNode& node) {
os << "Expression of type " << typeid(int).name() << std::endl;
if (node.traceSize_>0) os << node.traceSize_ << std::endl;
}
/// Return keys that play in this expression as a set
virtual std::set<Key> keys() const {
std::set<Key> keys;

View File

@ -52,6 +52,11 @@ private:
public:
/// Print
void print(const std::string& s) const {
std::cout << s << root_ << std::endl;
}
// Construct a constant expression
Expression(const T& value) :
root_(new ConstantExpression<T>(value)) {