@@ -12,16 +12,18 @@ Author: Daniel Kroening, Peter Schrammel
12
12
#ifndef CPROVER_GOTO_CHECKER_SOLVER_FACTORY_H
13
13
#define CPROVER_GOTO_CHECKER_SOLVER_FACTORY_H
14
14
15
+ #include < list>
16
+ #include < map>
15
17
#include < memory>
16
18
17
- #include < solvers/smt2/smt2_dec .h>
19
+ #include < util/options .h>
18
20
19
- class message_handlert ;
20
- class namespacet ;
21
- class optionst ;
22
- class propt ;
23
- class prop_convt ;
24
- class symbol_tablet ;
21
+ # include < solvers/prop/prop.h >
22
+ # include < solvers/prop/prop_conv.h >
23
+ # include < solvers/sat/cnf.h >
24
+ # include < solvers/sat/satcheck.h >
25
+ # include < solvers/smt2/smt2_dec.h >
26
+ # include < goto-symex/symex_target_equation.h >
25
27
26
28
class solver_factoryt
27
29
{
@@ -30,35 +32,90 @@ class solver_factoryt
30
32
const optionst &_options,
31
33
const symbol_tablet &_symbol_table,
32
34
message_handlert &_message_handler,
33
- bool _output_xml_in_refinement);
35
+ bool _output_xml_in_refinement)
36
+ : options(_options),
37
+ symbol_table (_symbol_table),
38
+ ns(_symbol_table),
39
+ message_handler(_message_handler),
40
+ output_xml_in_refinement(_output_xml_in_refinement)
41
+ {
42
+ }
34
43
35
44
// The solver class,
36
45
// which owns a variety of allocated objects.
37
46
class solvert
38
47
{
39
48
public:
40
- solvert () = default ;
41
- explicit solvert (std::unique_ptr<prop_convt> p);
42
- solvert (std::unique_ptr<prop_convt> p1, std::unique_ptr<propt> p2);
43
- solvert (std::unique_ptr<prop_convt> p1, std::unique_ptr<std::ofstream> p2);
44
-
45
- prop_convt &prop_conv () const ;
46
- propt &prop () const ;
47
-
48
- void set_prop_conv (std::unique_ptr<prop_convt> p);
49
- void set_prop (std::unique_ptr<propt> p);
50
- void set_ofstream (std::unique_ptr<std::ofstream> p);
49
+ solvert ()
50
+ {
51
+ }
52
+
53
+ explicit solvert (std::unique_ptr<prop_convt> p):prop_conv_ptr(std::move(p))
54
+ {
55
+ }
56
+
57
+ solvert (std::unique_ptr<prop_convt> p1, std::unique_ptr<propt> p2):
58
+ prop_ptr (std::move(p2)),
59
+ prop_conv_ptr (std::move(p1))
60
+ {
61
+ }
62
+
63
+ solvert (std::unique_ptr<prop_convt> p1, std::unique_ptr<std::ofstream> p2):
64
+ ofstream_ptr (std::move(p2)),
65
+ prop_conv_ptr (std::move(p1))
66
+ {
67
+ }
68
+
69
+ prop_convt &prop_conv () const
70
+ {
71
+ PRECONDITION (prop_conv_ptr != nullptr );
72
+ return *prop_conv_ptr;
73
+ }
74
+
75
+ propt &prop () const
76
+ {
77
+ PRECONDITION (prop_ptr != nullptr );
78
+ return *prop_ptr;
79
+ }
80
+
81
+ void set_prop_conv (std::unique_ptr<prop_convt> p)
82
+ {
83
+ prop_conv_ptr=std::move (p);
84
+ }
85
+
86
+ void set_prop (std::unique_ptr<propt> p)
87
+ {
88
+ prop_ptr=std::move (p);
89
+ }
90
+
91
+ void set_ofstream (std::unique_ptr<std::ofstream> p)
92
+ {
93
+ ofstream_ptr=std::move (p);
94
+ }
51
95
52
96
// the objects are deleted in the opposite order they appear below
53
97
std::unique_ptr<std::ofstream> ofstream_ptr;
54
98
std::unique_ptr<propt> prop_ptr;
55
99
std::unique_ptr<prop_convt> prop_conv_ptr;
56
100
};
57
101
58
- // / Returns a solvert object
59
- virtual std::unique_ptr<solvert> get_solver ();
60
-
61
- virtual ~solver_factoryt () = default ;
102
+ // returns a solvert object
103
+ virtual std::unique_ptr<solvert> get_solver ()
104
+ {
105
+ if (options.get_bool_option (" dimacs" ))
106
+ return get_dimacs ();
107
+ if (options.get_bool_option (" refine" ))
108
+ return get_bv_refinement ();
109
+ else if (options.get_bool_option (" refine-strings" ))
110
+ return get_string_refinement ();
111
+ if (options.get_bool_option (" smt2" ))
112
+ return get_smt2 (get_smt2_solver_type ());
113
+ return get_default ();
114
+ }
115
+
116
+ virtual ~solver_factoryt ()
117
+ {
118
+ }
62
119
63
120
protected:
64
121
const optionst &options;
0 commit comments