Skip to content

Commit 4bf211f

Browse files
Move solver_factoryt definitions into .cpp file
1 parent 8065b10 commit 4bf211f

File tree

2 files changed

+88
-70
lines changed

2 files changed

+88
-70
lines changed

src/goto-checker/solver_factory.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,78 @@ Author: Daniel Kroening, Peter Schrammel
2828
#include <solvers/sat/satcheck.h>
2929
#include <solvers/smt2/smt2_dec.h>
3030

31+
solver_factoryt::solver_factoryt(
32+
const optionst &_options,
33+
const symbol_tablet &_symbol_table,
34+
message_handlert &_message_handler,
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+
}
43+
44+
solver_factoryt::solvert::solvert(std::unique_ptr<prop_convt> p)
45+
: prop_conv_ptr(std::move(p))
46+
{
47+
}
48+
49+
solver_factoryt::solvert::solvert(
50+
std::unique_ptr<prop_convt> p1,
51+
std::unique_ptr<propt> p2)
52+
: prop_ptr(std::move(p2)), prop_conv_ptr(std::move(p1))
53+
{
54+
}
55+
56+
solver_factoryt::solvert::solvert(
57+
std::unique_ptr<prop_convt> p1,
58+
std::unique_ptr<std::ofstream> p2)
59+
: ofstream_ptr(std::move(p2)), prop_conv_ptr(std::move(p1))
60+
{
61+
}
62+
63+
prop_convt &solver_factoryt::solvert::prop_conv() const
64+
{
65+
PRECONDITION(prop_conv_ptr != nullptr);
66+
return *prop_conv_ptr;
67+
}
68+
69+
propt &solver_factoryt::solvert::prop() const
70+
{
71+
PRECONDITION(prop_ptr != nullptr);
72+
return *prop_ptr;
73+
}
74+
75+
void solver_factoryt::solvert::set_prop_conv(std::unique_ptr<prop_convt> p)
76+
{
77+
prop_conv_ptr = std::move(p);
78+
}
79+
80+
void solver_factoryt::solvert::set_prop(std::unique_ptr<propt> p)
81+
{
82+
prop_ptr = std::move(p);
83+
}
84+
85+
void solver_factoryt::solvert::set_ofstream(std::unique_ptr<std::ofstream> p)
86+
{
87+
ofstream_ptr = std::move(p);
88+
}
89+
90+
std::unique_ptr<solver_factoryt::solvert> solver_factoryt::get_solver()
91+
{
92+
if(options.get_bool_option("dimacs"))
93+
return get_dimacs();
94+
if(options.get_bool_option("refine"))
95+
return get_bv_refinement();
96+
else if(options.get_bool_option("refine-strings"))
97+
return get_string_refinement();
98+
if(options.get_bool_option("smt2"))
99+
return get_smt2(get_smt2_solver_type());
100+
return get_default();
101+
}
102+
31103
/// Uses the options to pick an SMT 2.0 solver
32104
/// \return An smt2_dect::solvert giving the solver to use.
33105
smt2_dect::solvert solver_factoryt::get_smt2_solver_type() const

src/goto-checker/solver_factory.h

Lines changed: 16 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -32,89 +32,35 @@ class solver_factoryt
3232
const optionst &_options,
3333
const symbol_tablet &_symbol_table,
3434
message_handlert &_message_handler,
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-
}
35+
bool _output_xml_in_refinement);
4336

4437
// The solver class,
4538
// which owns a variety of allocated objects.
4639
class solvert
4740
{
4841
public:
49-
solvert()
50-
{
51-
}
52-
53-
explicit solvert(std::unique_ptr<prop_convt> p)
54-
: prop_conv_ptr(std::move(p))
55-
{
56-
}
57-
58-
solvert(std::unique_ptr<prop_convt> p1, std::unique_ptr<propt> p2)
59-
: prop_ptr(std::move(p2)), 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)), prop_conv_ptr(std::move(p1))
65-
{
66-
}
67-
68-
prop_convt &prop_conv() const
69-
{
70-
PRECONDITION(prop_conv_ptr != nullptr);
71-
return *prop_conv_ptr;
72-
}
73-
74-
propt &prop() const
75-
{
76-
PRECONDITION(prop_ptr != nullptr);
77-
return *prop_ptr;
78-
}
79-
80-
void set_prop_conv(std::unique_ptr<prop_convt> p)
81-
{
82-
prop_conv_ptr = std::move(p);
83-
}
84-
85-
void set_prop(std::unique_ptr<propt> p)
86-
{
87-
prop_ptr = std::move(p);
88-
}
89-
90-
void set_ofstream(std::unique_ptr<std::ofstream> p)
91-
{
92-
ofstream_ptr = std::move(p);
93-
}
42+
solvert() = default;
43+
explicit solvert(std::unique_ptr<prop_convt> p);
44+
solvert(std::unique_ptr<prop_convt> p1, std::unique_ptr<propt> p2);
45+
solvert(std::unique_ptr<prop_convt> p1, std::unique_ptr<std::ofstream> p2);
46+
47+
prop_convt &prop_conv() const;
48+
propt &prop() const;
49+
50+
void set_prop_conv(std::unique_ptr<prop_convt> p);
51+
void set_prop(std::unique_ptr<propt> p);
52+
void set_ofstream(std::unique_ptr<std::ofstream> p);
9453

9554
// the objects are deleted in the opposite order they appear below
9655
std::unique_ptr<std::ofstream> ofstream_ptr;
9756
std::unique_ptr<propt> prop_ptr;
9857
std::unique_ptr<prop_convt> prop_conv_ptr;
9958
};
10059

101-
// returns a solvert object
102-
virtual std::unique_ptr<solvert> get_solver()
103-
{
104-
if(options.get_bool_option("dimacs"))
105-
return get_dimacs();
106-
if(options.get_bool_option("refine"))
107-
return get_bv_refinement();
108-
else if(options.get_bool_option("refine-strings"))
109-
return get_string_refinement();
110-
if(options.get_bool_option("smt2"))
111-
return get_smt2(get_smt2_solver_type());
112-
return get_default();
113-
}
114-
115-
virtual ~solver_factoryt()
116-
{
117-
}
60+
/// Returns a solvert object
61+
virtual std::unique_ptr<solvert> get_solver();
62+
63+
virtual ~solver_factoryt() = default;
11864

11965
protected:
12066
const optionst &options;

0 commit comments

Comments
 (0)