blob: 9e541574af3e95a844001784f77200c83256de05 (
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
|
/*
* command.cpp
*
* Created on: Nov 25, 2009
* Author: dejan
*/
#include "util/command.h"
#include "smt/smt_engine.h"
#include "util/result.h"
namespace CVC4 {
EmptyCommand::EmptyCommand() {
}
Result EmptyCommand::invoke(SmtEngine* smt_engine) {
return Result::VALIDITY_UNKNOWN;
}
AssertCommand::AssertCommand(const Expr& e) :
d_expr(e) {
}
Result AssertCommand::invoke(SmtEngine* smt_engine) {
return smt_engine->assert(d_expr);
}
CheckSatCommand::CheckSatCommand() :
d_expr(Expr::null()) {
}
CheckSatCommand::CheckSatCommand(const Expr& e) :
d_expr(e) {
}
Result CheckSatCommand::invoke(SmtEngine* smt_engine) {
return smt_engine->checkSat(d_expr);
}
QueryCommand::QueryCommand(const Expr& e) :
d_expr(e) {
}
Result QueryCommand::invoke(CVC4::SmtEngine* smt_engine) {
return smt_engine->query(d_expr);
}
CommandSequence::CommandSequence() :
d_last_index(0) {
}
CommandSequence::CommandSequence(Command* cmd) :
d_last_index(0) {
addCommand(cmd);
}
CommandSequence::~CommandSequence() {
for(unsigned i = d_last_index; i < d_command_sequence.size(); ++i)
delete d_command_sequence[i];
}
Result CommandSequence::invoke(SmtEngine* smt_engine) {
Result r = Result::VALIDITY_UNKNOWN;
for(; d_last_index < d_command_sequence.size(); ++d_last_index) {
r = d_command_sequence[d_last_index]->invoke(smt_engine);
delete d_command_sequence[d_last_index];
}
return r;
}
void CommandSequence::addCommand(Command* cmd) {
d_command_sequence.push_back(cmd);
}
}/* CVC4 namespace */
|