blob: 58f8b41bb0d67f3d1e7de914971e7eb08829f13e (
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
|
/********************* -*- C++ -*- */
/** command.cpp
** Original author: mdeters
** Major contributors: dejan
** Minor contributors (to current version): none
** This file is part of the CVC4 prototype.
** Copyright (c) 2009, 2010 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.
**
** Implementation of command objects.
**/
#include "util/command.h"
#include "smt/smt_engine.h"
using namespace std;
namespace CVC4 {
ostream& operator<<(ostream& out, const Command* c) {
if (c == NULL) {
out << "null";
} else {
c->toStream(out);
}
return out;
}
CommandSequence::~CommandSequence() {
for(unsigned i = d_index; i < d_commandSequence.size(); ++i) {
delete d_commandSequence[i];
}
}
void CommandSequence::invoke(SmtEngine* smtEngine) {
for(; d_index < d_commandSequence.size(); ++d_index) {
d_commandSequence[d_index]->invoke(smtEngine);
delete d_commandSequence[d_index];
}
}
void CheckSatCommand::toStream(ostream& out) const {
if(d_expr.isNull()) {
out << "CheckSat()";
} else {
out << "CheckSat(" << d_expr << ")";
}
}
void CommandSequence::toStream(ostream& out) const {
out << "CommandSequence[" << endl;
for(unsigned i = d_index; i < d_commandSequence.size(); ++i) {
out << *d_commandSequence[i] << endl;
}
out << "]";
}
void DeclarationCommand::toStream(std::ostream& out) const {
out << "Declare(";
bool first = true;
for(unsigned i = 0; i < d_declaredSymbols.size(); ++i) {
if(!first) {
out << ", ";
}
out << d_declaredSymbols[i];
first = false;
}
out << ")";
}
}/* CVC4 namespace */
|