blob: e25cf8595b408c22b42cdd266e4eb3c9de409613 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/********************* -*- C++ -*- */
/** expr.cpp
** This file is part of the CVC4 prototype.
** Copyright (c) 2009 The Analysis of Computer Systems Group (ACSys)
** Courant Institute of Mathematical Sciences
** New York University
** See the file COPYING in the top-level source directory for licensing
** information.
**
** Reference-counted encapsulation of a pointer to an expression.
**/
#include "expr/expr.h"
#include "expr_value.h"
#include "expr_builder.h"
using namespace CVC4::expr;
namespace CVC4 {
Expr Expr::s_null(0);
Expr::Expr(ExprValue* ev)
: d_ev(ev) {
d_ev->inc();
}
Expr::Expr(const Expr& e) {
if((d_ev = e.d_ev))
d_ev->inc();
}
Expr::~Expr() {
d_ev->dec();
}
Expr& Expr::operator=(const Expr& e) {
if(d_ev)
d_ev->dec();
if((d_ev = e.d_ev))
d_ev->inc();
return *this;
}
ExprValue* Expr::operator->() const {
return d_ev;
}
uint64_t Expr::hash() const {
return d_ev->hash();
}
Expr Expr::eqExpr(const Expr& right) const {
return ExprBuilder(*this).eqExpr(right);
}
Expr Expr::notExpr() const {
return ExprBuilder(*this).notExpr();
}
Expr Expr::negate() const { // avoid double-negatives
return ExprBuilder(*this).negate();
}
Expr Expr::andExpr(const Expr& right) const {
return ExprBuilder(*this).andExpr(right);
}
Expr Expr::orExpr(const Expr& right) const {
return ExprBuilder(*this).orExpr(right);
}
Expr Expr::iteExpr(const Expr& thenpart, const Expr& elsepart) const {
return ExprBuilder(*this).iteExpr(thenpart, elsepart);
}
Expr Expr::iffExpr(const Expr& right) const {
return ExprBuilder(*this).iffExpr(right);
}
Expr Expr::impExpr(const Expr& right) const {
return ExprBuilder(*this).impExpr(right);
}
Expr Expr::xorExpr(const Expr& right) const {
return ExprBuilder(*this).xorExpr(right);
}
Expr Expr::skolemExpr(int i) const {
return ExprBuilder(*this).skolemExpr(i);
}
Expr Expr::substExpr(const std::vector<Expr>& oldTerms,
const std::vector<Expr>& newTerms) const {
return ExprBuilder(*this).substExpr(oldTerms, newTerms);
}
}/* CVC4 namespace */
|