cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
smt_sorts.h
Go to the documentation of this file.
1
// Author: Diffblue Ltd.
2
6
7
#ifndef CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_SORTS_H
8
#define CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_SORTS_H
9
10
#include <
util/irep.h
>
11
12
#include <optional>
13
#include <type_traits>
14
15
class
smt_sort_const_downcast_visitort
;
16
17
class
smt_sortt
:
protected
irept
18
{
19
public
:
20
// smt_sortt does not support the notion of an empty / null state. Use
21
// std::optional<smt_sortt> instead if an empty sort is required.
22
smt_sortt
() =
delete
;
23
24
using
irept::pretty
;
25
26
bool
operator==
(
const
smt_sortt
&)
const
;
27
bool
operator!=
(
const
smt_sortt
&)
const
;
28
29
void
accept
(
smt_sort_const_downcast_visitort
&)
const
;
30
void
accept
(
smt_sort_const_downcast_visitort
&&)
const
;
31
37
template
<
typename
derivedt>
38
class
storert
39
{
40
protected
:
41
storert
();
42
static
irept
upcast
(
smt_sortt
sort);
43
static
const
smt_sortt
&
downcast
(
const
irept
&);
44
};
45
46
template
<
typename
sub_
class
t>
47
const
sub_classt *
cast
() const &;
48
49
template <typename sub_classt>
50
std
::optional<sub_classt>
cast
() &&;
51
52
protected:
53
using
irept
::
irept
;
54
};
55
56
template <typename derivedt>
57
smt_sortt
::
storert
<derivedt>::
storert
()
58
{
59
static_assert
(
60
std::is_base_of<irept, derivedt>::value &&
61
std::is_base_of<storert<derivedt>, derivedt>::value,
62
"Only irept based classes need to upcast smt_sortt to store it."
);
63
}
64
65
template
<
typename
derivedt>
66
irept
smt_sortt::storert<derivedt>::upcast
(
smt_sortt
sort)
67
{
68
return
static_cast<
irept
&&
>
(std::move(sort));
69
}
70
71
template
<
typename
derivedt>
72
const
smt_sortt
&
smt_sortt::storert<derivedt>::downcast
(
const
irept
&irep)
73
{
74
return
static_cast<
const
smt_sortt
&
>
(irep);
75
}
76
77
class
smt_bool_sortt
final :
public
smt_sortt
78
{
79
public
:
80
smt_bool_sortt
();
81
};
82
83
class
smt_bit_vector_sortt
final :
public
smt_sortt
84
{
85
public
:
86
explicit
smt_bit_vector_sortt
(std::size_t
bit_width
);
87
std::size_t
bit_width
()
const
;
88
};
89
90
class
smt_array_sortt
final :
public
smt_sortt
91
{
92
public
:
93
explicit
smt_array_sortt
(
94
const
smt_sortt
&
index_sort
,
95
const
smt_sortt
&
element_sort
);
96
const
smt_sortt
&
index_sort
()
const
;
97
const
smt_sortt
&
element_sort
()
const
;
98
};
99
100
class
smt_sort_const_downcast_visitort
101
{
102
public
:
103
#define SORT_ID(the_id) virtual void visit(const smt_##the_id##_sortt &) = 0;
104
#include "smt_sorts.def"
105
#undef SORT_ID
106
};
107
108
#endif
// CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_SORTS_H
irept::pretty
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
Definition
irep.cpp:482
smt_array_sortt::element_sort
const smt_sortt & element_sort() const
Definition
smt_sorts.cpp:81
smt_array_sortt::index_sort
const smt_sortt & index_sort() const
Definition
smt_sorts.cpp:76
smt_array_sortt::smt_array_sortt
smt_array_sortt(const smt_sortt &index_sort, const smt_sortt &element_sort)
Definition
smt_sorts.cpp:67
smt_bit_vector_sortt::bit_width
std::size_t bit_width() const
Definition
smt_sorts.cpp:62
smt_bit_vector_sortt::smt_bit_vector_sortt
smt_bit_vector_sortt(std::size_t bit_width)
Definition
smt_sorts.cpp:52
smt_bool_sortt::smt_bool_sortt
smt_bool_sortt()
Definition
smt_sorts.cpp:48
smt_sort_const_downcast_visitort
Definition
smt_sorts.h:101
smt_sortt::storert::upcast
static irept upcast(smt_sortt sort)
Definition
smt_sorts.h:66
smt_sortt::storert::storert
storert()
Definition
smt_sorts.h:57
smt_sortt::storert::downcast
static const smt_sortt & downcast(const irept &)
Definition
smt_sorts.h:72
smt_sortt::operator==
bool operator==(const smt_sortt &) const
Definition
smt_sorts.cpp:38
smt_sortt::irept
irept(const irep_idt &_id)
Definition
irep.h:377
smt_sortt::cast
const sub_classt * cast() const &
smt_sortt::operator!=
bool operator!=(const smt_sortt &) const
Definition
smt_sorts.cpp:43
smt_sortt::smt_sortt
smt_sortt()=delete
smt_sortt::accept
void accept(smt_sort_const_downcast_visitort &) const
Definition
smt_sorts.cpp:97
irep.h
std
STL namespace.
solvers
smt2_incremental
ast
smt_sorts.h
Generated by
1.17.0