CBMC
smt_logics.h
Go to the documentation of this file.
1
// Author: Diffblue Ltd.
2
3
#ifndef CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_LOGICS_H
4
#define CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_LOGICS_H
5
6
class
smt_logic_const_downcast_visitort
;
7
8
#include <
util/irep.h
>
9
10
class
smt_logict
:
protected
irept
11
{
12
public
:
13
// smt_logict does not support the notion of an empty / null state. Use
14
// optionalt<smt_logict> instead if an empty logic is required.
15
smt_logict
() =
delete
;
16
17
using
irept::pretty
;
18
19
bool
operator==
(
const
smt_logict
&)
const
;
20
bool
operator!=
(
const
smt_logict
&)
const
;
21
22
void
accept
(
smt_logic_const_downcast_visitort
&)
const
;
23
void
accept
(
smt_logic_const_downcast_visitort
&&)
const
;
24
30
template
<
typename
derivedt>
31
class
storert
32
{
33
protected
:
34
storert
();
35
static
irept
upcast
(
smt_logict
logic);
36
static
const
smt_logict
&
downcast
(
const
irept
&);
37
};
38
39
protected
:
40
using
irept::irept
;
41
};
42
43
template
<
typename
derivedt>
44
smt_logict::storert<derivedt>::storert
()
45
{
46
static_assert(
47
std::is_base_of<irept, derivedt>::value &&
48
std::is_base_of<
storert<derivedt>
, derivedt>::value,
49
"Only irept based classes need to upcast smt_termt to store it."
);
50
}
51
52
template
<
typename
derivedt>
53
irept
smt_logict::storert<derivedt>::upcast
(
smt_logict
logic)
54
{
55
return
static_cast<
irept
&&
>
(std::move(logic));
56
}
57
58
template
<
typename
derivedt>
59
const
smt_logict
&
smt_logict::storert<derivedt>::downcast
(
const
irept
&irep)
60
{
61
return
static_cast<
const
smt_logict
&
>
(irep);
62
}
63
64
#define LOGIC_ID(the_id, the_name) \
65
/* NOLINTNEXTLINE(readability/identifiers) cpplint does not match the ## */
\
66
class smt_logic_##the_id##t : public smt_logict \
67
{ \
68
public: \
69
smt_logic_##the_id##t(); \
70
};
71
#include "smt_logics.def"
72
#undef LOGIC_ID
73
74
class
smt_logic_const_downcast_visitort
75
{
76
public
:
77
#define LOGIC_ID(the_id, the_name) \
78
virtual void visit(const smt_logic_##the_id##t &) = 0;
79
#include "smt_logics.def"
80
#undef LOGIC_ID
81
};
82
83
#endif // CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_LOGICS_H
smt_logict::storert::storert
storert()
Definition:
smt_logics.h:44
irept::pretty
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
Definition:
irep.cpp:495
smt_logic_const_downcast_visitort
Definition:
smt_logics.h:74
smt_logict::smt_logict
smt_logict()=delete
irept::irept
irept()=default
smt_logict::accept
void accept(smt_logic_const_downcast_visitort &) const
Definition:
smt_logics.cpp:34
smt_logict::operator==
bool operator==(const smt_logict &) const
Definition:
smt_logics.cpp:11
smt_logict::storert::upcast
static irept upcast(smt_logict logic)
Definition:
smt_logics.h:53
smt_logict::storert
Class for adding the ability to up and down cast smt_logict to and from irept.
Definition:
smt_logics.h:31
smt_logict::storert::downcast
static const smt_logict & downcast(const irept &)
Definition:
smt_logics.h:59
smt_logict
Definition:
smt_logics.h:10
irept
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition:
irep.h:359
smt_logict::operator!=
bool operator!=(const smt_logict &) const
Definition:
smt_logics.cpp:16
irep.h
src
solvers
smt2_incremental
smt_logics.h
Generated by
1.8.17