CBMC
Loading...
Searching...
No Matches
smt_index.h
Go to the documentation of this file.
1// Author: Diffblue Ltd.
2
3#ifndef CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_INDEX_H
4#define CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_INDEX_H
5
6#include <util/irep.h>
7
9
13class smt_indext : protected irept
14{
15public:
16 // smt_indext does not support the notion of an empty / null state. Use
17 // std::optional<smt_indext> instead if an empty index is required.
18 smt_indext() = delete;
19
20 using irept::pretty;
21
22 bool operator==(const smt_indext &) const;
23 bool operator!=(const smt_indext &) const;
24
25 template <typename sub_classt>
26 const sub_classt *cast() const &;
27
29
37 {
38 protected:
40 static irept upcast(smt_indext index);
41 static const smt_indext &downcast(const irept &);
42 };
43
44protected:
45 using irept::irept;
46};
47
48template <typename derivedt>
50{
51 static_assert(
52 std::is_base_of<irept, derivedt>::value &&
53 std::is_base_of<storert<derivedt>, derivedt>::value,
54 "Only irept based classes need to upcast smt_sortt to store it.");
55}
56
57template <typename derivedt>
59{
60 return static_cast<irept &&>(std::move(index));
61}
62
63template <typename derivedt>
65{
66 return static_cast<const smt_indext &>(irep);
67}
68
70{
71public:
72 explicit smt_numeral_indext(std::size_t value);
73 std::size_t value() const;
74};
75
77{
78public:
80 irep_idt identifier() const;
81};
82
84{
85public:
86 virtual void visit(const smt_numeral_indext &) = 0;
87 virtual void visit(const smt_symbol_indext &) = 0;
88};
89
90#endif // CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_INDEX_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition irep.h:364
irept()=default
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
Definition irep.cpp:482
virtual void visit(const smt_symbol_indext &)=0
virtual void visit(const smt_numeral_indext &)=0
Class for adding the ability to up and down cast smt_indext to and from irept.
Definition smt_index.h:37
static irept upcast(smt_indext index)
Definition smt_index.h:58
static const smt_indext & downcast(const irept &)
Definition smt_index.h:64
For implementation of indexed identifiers.
Definition smt_index.h:14
bool operator!=(const smt_indext &) const
Definition smt_index.cpp:14
const sub_classt * cast() const &
bool operator==(const smt_indext &) const
Definition smt_index.cpp:9
void accept(smt_index_const_downcast_visitort &) const
Definition smt_index.cpp:35
smt_indext()=delete
std::size_t value() const
Definition smt_index.cpp:50
irep_idt identifier() const
Definition smt_index.cpp:62