diff options
Diffstat (limited to 'src/expr/node_builder.h')
-rw-r--r-- | src/expr/node_builder.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/expr/node_builder.h b/src/expr/node_builder.h index 2cb2527b2..1914bb736 100644 --- a/src/expr/node_builder.h +++ b/src/expr/node_builder.h @@ -157,6 +157,7 @@ #ifndef __CVC4__NODE_BUILDER_H #define __CVC4__NODE_BUILDER_H +#include <iostream> #include <vector> #include <cstdlib> #include <stdint.h> @@ -184,6 +185,11 @@ class OrNodeBuilder; class PlusNodeBuilder; class MultNodeBuilder; +// Sometimes it's useful for debugging to output a NodeBuilder that +// isn't yet a Node.. +template <unsigned nchild_thresh> +std::ostream& operator<<(std::ostream& out, const NodeBuilder<nchild_thresh>& nb); + /** * The main template NodeBuilder. */ @@ -720,6 +726,10 @@ public: // private fields template <unsigned N> friend class NodeBuilder; + + template <unsigned N> + friend std::ostream& operator<<(std::ostream& out, const NodeBuilder<N>& nb); + };/* class NodeBuilder<> */ }/* CVC4 namespace */ @@ -1151,7 +1161,7 @@ expr::NodeValue* NodeBuilder<nchild_thresh>::constructNV() const { ** allocated "inline" in this NodeBuilder. **/ // Lookup the expression value in the pool we already have - expr::NodeValue* poolNv = d_nm->poolLookup(&d_inlineNv); + expr::NodeValue* poolNv = d_nm->poolLookup(const_cast<expr::NodeValue*>(&d_inlineNv)); // If something else is there, we reuse it if(poolNv != NULL) { /* Subcase (a): The Node under construction already exists in @@ -1301,6 +1311,11 @@ inline void NodeBuilder<nchild_thresh>::maybeCheckType(const TNode n) const } #endif /* CVC4_DEBUG */ +template <unsigned nchild_thresh> +std::ostream& operator<<(std::ostream& out, const NodeBuilder<nchild_thresh>& nb) { + return out << *nb.d_nv; +} + }/* CVC4 namespace */ #endif /* __CVC4__NODE_BUILDER_H */ |