CBMC
boolbv_width.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
10
#ifndef CPROVER_SOLVERS_FLATTENING_BOOLBV_WIDTH_H
11
#define CPROVER_SOLVERS_FLATTENING_BOOLBV_WIDTH_H
12
13
#include <
util/type.h
>
14
15
class
namespacet
;
16
class
struct_typet
;
17
18
class
boolbv_widtht
19
{
20
public
:
21
explicit
boolbv_widtht
(
const
namespacet
&_ns);
22
virtual
~boolbv_widtht
() =
default
;
23
24
virtual
std::size_t
operator()
(
const
typet
&type)
const
25
{
26
const
auto
&entry_opt =
get_entry
(type);
27
CHECK_RETURN
(entry_opt.has_value());
28
return
entry_opt->total_width;
29
}
30
31
virtual
optionalt<std::size_t>
get_width_opt
(
const
typet
&type)
const
32
{
33
const
auto
&entry_opt =
get_entry
(type);
34
if
(!entry_opt.has_value())
35
return
{};
36
return
entry_opt->total_width;
37
}
38
39
struct
membert
40
{
41
std::size_t
offset
,
width
;
42
};
43
44
const
membert
&
45
get_member
(
const
struct_typet
&type,
const
irep_idt
&member)
const
;
46
47
protected
:
48
const
namespacet
&
ns
;
49
50
struct
defined_entryt
51
{
52
explicit
defined_entryt
(std::size_t
total_width
) :
total_width
(
total_width
)
53
{
54
}
55
56
std::size_t
total_width
;
57
std::vector<membert>
members
;
58
};
59
using
entryt
=
optionalt<defined_entryt>
;
60
61
typedef
std::unordered_map<typet, entryt, irep_hash>
cachet
;
62
63
// the 'mutable' is allow const methods above
64
mutable
cachet
cache
;
65
66
const
entryt
&
get_entry
(
const
typet
&type)
const
;
67
};
68
69
#endif // CPROVER_SOLVERS_FLATTENING_BOOLBV_WIDTH_H
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition:
dstring.h:36
boolbv_widtht::membert
Definition:
boolbv_width.h:39
CHECK_RETURN
#define CHECK_RETURN(CONDITION)
Definition:
invariant.h:495
typet
The type of an expression, extends irept.
Definition:
type.h:28
boolbv_widtht::entryt
optionalt< defined_entryt > entryt
Definition:
boolbv_width.h:59
boolbv_widtht::get_entry
const entryt & get_entry(const typet &type) const
Definition:
boolbv_width.cpp:23
boolbv_widtht::membert::offset
std::size_t offset
Definition:
boolbv_width.h:41
boolbv_widtht::get_width_opt
virtual optionalt< std::size_t > get_width_opt(const typet &type) const
Definition:
boolbv_width.h:31
type.h
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition:
namespace.h:90
boolbv_widtht::operator()
virtual std::size_t operator()(const typet &type) const
Definition:
boolbv_width.h:24
boolbv_widtht::cachet
std::unordered_map< typet, entryt, irep_hash > cachet
Definition:
boolbv_width.h:61
boolbv_widtht::ns
const namespacet & ns
Definition:
boolbv_width.h:48
optionalt
nonstd::optional< T > optionalt
Definition:
optional.h:35
boolbv_widtht::boolbv_widtht
boolbv_widtht(const namespacet &_ns)
Definition:
boolbv_width.cpp:19
boolbv_widtht::cache
cachet cache
Definition:
boolbv_width.h:64
boolbv_widtht
Definition:
boolbv_width.h:18
struct_typet
Structure type, corresponds to C style structs.
Definition:
std_types.h:230
boolbv_widtht::defined_entryt::members
std::vector< membert > members
Definition:
boolbv_width.h:57
boolbv_widtht::defined_entryt
Definition:
boolbv_width.h:50
boolbv_widtht::membert::width
std::size_t width
Definition:
boolbv_width.h:41
boolbv_widtht::defined_entryt::total_width
std::size_t total_width
Definition:
boolbv_width.h:56
boolbv_widtht::~boolbv_widtht
virtual ~boolbv_widtht()=default
boolbv_widtht::get_member
const membert & get_member(const struct_typet &type, const irep_idt &member) const
Definition:
boolbv_width.cpp:230
boolbv_widtht::defined_entryt::defined_entryt
defined_entryt(std::size_t total_width)
Definition:
boolbv_width.h:52
src
solvers
flattening
boolbv_width.h
Generated by
1.8.17