diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-10-28 20:30:24 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-10-28 20:30:24 +0000 |
commit | 890bacd7cb11c6e991722e8a7b7cd0ef9147ea3b (patch) | |
tree | 0c2f05f224fe79310130dc054c7606144e248de0 /src/expr/node_builder.h | |
parent | b084a7efa9d65ec2f7475caa8486f8fd4cbafbd5 (diff) |
* ability to output NodeBuilders without first converting them to Nodes---useful for debugging.
* language-dependent Node::toString()
* some minor proof-related cleanup
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 */ |