#include "expr/node_manager.h"
#include "expr/expr_manager.h"
#include "context/context.h"
+#include "util/options.h"
${includes}
namespace CVC4 {
-ExprManager::ExprManager(bool earlyTypeChecking) :
+ExprManager::ExprManager() :
d_ctxt(new Context),
- d_nodeManager(new NodeManager(d_ctxt, earlyTypeChecking)) {
+ d_nodeManager(new NodeManager(d_ctxt)) {
+}
+
+ExprManager::ExprManager(const Options& options) :
+ d_ctxt(new Context),
+ d_nodeManager(new NodeManager(d_ctxt, options)) {
}
ExprManager::~ExprManager() {
class Expr;
class SmtEngine;
class NodeManager;
+class Options;
namespace context {
class Context;
public:
+ /**
+ * Creates an expression manager with default options.
+ */
+ ExprManager();
+
/**
* Creates an expression manager.
- * @param earlyTypeChecking whether to do type checking early (at Expr
- * creation time); only used in debug builds---for other builds, type
- * checking is never done early.
+ *
+ * @param options the earlyTypeChecking field is used to configure
+ * whether to do at Expr creation time.
*/
- explicit ExprManager(bool earlyTypeChecking = true);
+ explicit ExprManager(const Options&);
/**
* Destroys the expression manager. No will be deallocated at this point, so
expr::NodeValue* constructNV();
expr::NodeValue* constructNV() const;
- inline void debugCheckType(const TNode n) const {
- // force an immediate type check, if we are in debug mode
- // and the current node isn't a variable or constant
+ inline void maybeCheckType(const TNode n) const {
+ /* force an immediate type check, if early type checking is
+ enabled and the current node isn't a variable or constant */
if( d_nm->d_earlyTypeChecking ) {
kind::MetaKind mk = n.getMetaKind();
if( mk != kind::metakind::VARIABLE
template <unsigned nchild_thresh>
Node NodeBuilder<nchild_thresh>::constructNode() {
Node n = Node(constructNV());
- debugCheckType(n);
+ maybeCheckType(n);
return n;
}
template <unsigned nchild_thresh>
Node NodeBuilder<nchild_thresh>::constructNode() const {
Node n = Node(constructNV());
- debugCheckType(n);
+ maybeCheckType(n);
return n;
}
template <unsigned nchild_thresh>
Node* NodeBuilder<nchild_thresh>::constructNodePtr() {
Node *np = new Node(constructNV());
- debugCheckType(*np);
+ maybeCheckType(*np);
return np;
}
template <unsigned nchild_thresh>
Node* NodeBuilder<nchild_thresh>::constructNodePtr() const {
Node *np = new Node(constructNV());
- debugCheckType(*np);
+ maybeCheckType(*np);
return np;
}
#include "theory/bv/theory_bv_type_rules.h"
#include "util/Assert.h"
+#include "util/options.h"
#include "util/tls.h"
#include <algorithm>
}
};
+NodeManager::NodeManager(context::Context* ctxt) :
+ d_attrManager(ctxt) {
+ Options options;
+ init(options);
+}
+
+
+NodeManager::NodeManager(context::Context* ctxt,
+ const Options& options) :
+ d_attrManager(ctxt) {
+ init(options);
+}
-NodeManager::NodeManager(context::Context* ctxt, bool earlyTypeChecking) :
- d_attrManager(ctxt),
- d_nodeUnderDeletion(NULL),
- d_inReclaimZombies(false),
- d_earlyTypeChecking(earlyTypeChecking) {
+inline void NodeManager::init(const Options& options) {
+ d_nodeUnderDeletion = NULL;
+ d_inReclaimZombies = false;
+ d_earlyTypeChecking = options.earlyTypeChecking;
poolInsert( &expr::NodeValue::s_null );
for(unsigned i = 0; i < unsigned(kind::LAST_KIND); ++i) {
namespace CVC4 {
+class Options;
+
namespace expr {
// Definition of an attribute for the variable name.
* Whether to do early type checking (only effective in debug
* builds; other builds never do early type checking).
*/
- const bool d_earlyTypeChecking;
+ bool d_earlyTypeChecking;
/**
* Look up a NodeValue in the pool associated to this NodeManager.
TypeNode computeType(TNode n, bool check = false)
throw (TypeCheckingExceptionPrivate, AssertionException);
+ void init(const Options& options);
+
public:
- explicit NodeManager(context::Context* ctxt, bool earlyTypeChecking = true);
+ explicit NodeManager(context::Context* ctxt);
+ explicit NodeManager(context::Context* ctxt, const Options& options);
~NodeManager();
/** The node manager in the current context. */
}
// Create the expression manager
- ExprManager exprMgr(options.earlyTypeChecking);
+ ExprManager exprMgr(options);
// Create the SmtEngine
SmtEngine smt(&exprMgr, options);