CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
literal_vector_expr.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#ifndef CPROVER_SOLVERS_FLATTENING_LITERAL_VECTOR_EXPR_H
10#define CPROVER_SOLVERS_FLATTENING_LITERAL_VECTOR_EXPR_H
11
12#include <util/std_expr.h>
13#include <util/string2int.h>
14
16
18{
19public:
25
26 bvt bv() const
27 {
28 auto &sub = find(ID_literals).get_sub();
29 bvt result;
30 result.reserve(sub.size());
31 for(auto &literal_irep : sub)
32 {
33 literalt l;
36 result.push_back(l);
37 }
38 return result;
39 }
40
41 void bv(const bvt &bv)
42 {
43 auto &sub = add(ID_literals).get_sub();
44 sub.clear();
45 sub.reserve(bv.size());
46 for(auto &literal : bv)
47 sub.emplace_back(irept{std::to_string(literal.get())});
48 }
49};
50
51template <>
53{
54 return base.id() == ID_literal_vector;
55}
56
63{
66 return static_cast<const literal_vector_exprt &>(expr);
67}
68
72{
75 return static_cast<literal_vector_exprt &>(expr);
76}
77
78#endif // CPROVER_SOLVERS_FLATTENING_LITERAL_VECTOR_EXPR_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Base class for all expressions.
Definition expr.h:56
static void check(const exprt &, const validation_modet)
Check that the expression is well-formed (shallow checks only, i.e., subexpressions and its type are ...
Definition expr.h:254
There are a large number of kinds of tree structured or tree-like data in CPROVER.
Definition irep.h:364
const irept & find(const irep_idt &name) const
Definition irep.cpp:93
subt & get_sub()
Definition irep.h:448
const irep_idt & id() const
Definition irep.h:388
irept & add(const irep_idt &name)
Definition irep.cpp:103
literal_vector_exprt(const bvt &__bv, typet __type)
void bv(const bvt &bv)
void set(var_not _l)
Definition literal.h:93
An expression without operands.
Definition std_expr.h:22
The type of an expression, extends irept.
Definition type.h:29
std::vector< literalt > bvt
Definition literal.h:201
const literal_vector_exprt & to_literal_vector_expr(const exprt &expr)
Cast a generic exprt to a literal_vector_exprt.
bool can_cast_expr< literal_vector_exprt >(const exprt &base)
STL namespace.
#define PRECONDITION(CONDITION)
Definition invariant.h:463
API to expression classes.
signed long long int unsafe_string2signedlonglong(const std::string &str, int base)