cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
sentinel_dll.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Sentinel Doubly Linked Lists
4
5
Author: Daniel Kroening, dkr@amazon.com
6
7
\*******************************************************************/
8
9
#ifndef CPROVER_CPROVER_SENTINEL_DLL_H
10
#define CPROVER_CPROVER_SENTINEL_DLL_H
11
12
#include <
util/std_expr.h
>
13
14
class
state_is_sentinel_dll_exprt
:
public
multi_ary_exprt
15
{
16
public
:
17
state_is_sentinel_dll_exprt
(
exprt
state
,
exprt
head
,
exprt
tail
)
18
:
multi_ary_exprt
(
19
ID_state_is_sentinel_dll,
20
{
state
,
head
,
tail
},
21
bool_typet
())
22
{
23
PRECONDITION
(this->
state
().
type
().
id
() == ID_state);
24
PRECONDITION
(this->
head
().
type
().
id
() == ID_pointer);
25
PRECONDITION
(this->
tail
().
type
().
id
() == ID_pointer);
26
}
27
28
state_is_sentinel_dll_exprt
(
exprt
state
,
exprt
head
,
exprt
tail
,
exprt
node)
29
:
multi_ary_exprt
(
30
ID_state_is_sentinel_dll,
31
{
state
,
head
,
tail
, node},
32
bool_typet
())
33
{
34
PRECONDITION
(this->
state
().
type
().
id
() == ID_state);
35
PRECONDITION
(this->
head
().
type
().
id
() == ID_pointer);
36
PRECONDITION
(this->
tail
().
type
().
id
() == ID_pointer);
37
}
38
39
const
exprt
&
state
()
const
40
{
41
return
op0
();
42
}
43
44
exprt
&
state
()
45
{
46
return
op0
();
47
}
48
49
const
exprt
&
head
()
const
50
{
51
return
op1
();
52
}
53
54
exprt
&
head
()
55
{
56
return
op1
();
57
}
58
59
const
exprt
&
tail
()
const
60
{
61
return
op2
();
62
}
63
64
exprt
&
tail
()
65
{
66
return
op2
();
67
}
68
69
// helper
70
state_is_sentinel_dll_exprt
with_state
(
exprt
state
)
const
71
{
72
auto
result = *
this
;
// copy
73
result.
state
() = std::move(
state
);
74
return
result;
75
}
76
};
77
84
inline
const
state_is_sentinel_dll_exprt
&
85
to_state_is_sentinel_dll_expr
(
const
exprt
&expr)
86
{
87
PRECONDITION
(expr.
id
() == ID_state_is_sentinel_dll);
88
const
state_is_sentinel_dll_exprt
&ret =
89
static_cast<
const
state_is_sentinel_dll_exprt
&
>
(expr);
90
validate_expr
(ret);
91
return
ret;
92
}
93
95
inline
state_is_sentinel_dll_exprt
&
to_state_is_sentinel_dll_expr
(
exprt
&expr)
96
{
97
PRECONDITION
(expr.
id
() == ID_state_is_sentinel_dll);
98
state_is_sentinel_dll_exprt
&ret =
99
static_cast<
state_is_sentinel_dll_exprt
&
>
(expr);
100
validate_expr
(ret);
101
return
ret;
102
}
103
104
std::optional<exprt>
105
sentinel_dll_next
(
const
exprt
&state,
const
exprt
&node,
const
namespacet
&);
106
107
std::optional<exprt>
108
sentinel_dll_prev
(
const
exprt
&state,
const
exprt
&node,
const
namespacet
&);
109
110
#endif
// CPROVER_CPROVER_SENTINEL_DLL_H
validate_expr
void validate_expr(const shuffle_vector_exprt &value)
Definition
c_expr.h:82
bool_typet
The Boolean type.
Definition
std_types.h:36
exprt
Base class for all expressions.
Definition
expr.h:57
exprt::exprt
exprt()
Definition
expr.h:62
exprt::type
typet & type()
Return the type of the expression.
Definition
expr.h:85
irept::id
const irep_idt & id() const
Definition
irep.h:388
multi_ary_exprt::op1
exprt & op1()
Definition
std_expr.h:932
multi_ary_exprt::op0
exprt & op0()
Definition
std_expr.h:926
multi_ary_exprt::op2
exprt & op2()
Definition
std_expr.h:938
multi_ary_exprt::multi_ary_exprt
multi_ary_exprt(const irep_idt &_id, operandst _operands, typet _type)
Definition
std_expr.h:900
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition
namespace.h:91
state_is_sentinel_dll_exprt
Definition
sentinel_dll.h:15
state_is_sentinel_dll_exprt::state_is_sentinel_dll_exprt
state_is_sentinel_dll_exprt(exprt state, exprt head, exprt tail, exprt node)
Definition
sentinel_dll.h:28
state_is_sentinel_dll_exprt::head
const exprt & head() const
Definition
sentinel_dll.h:49
state_is_sentinel_dll_exprt::state
exprt & state()
Definition
sentinel_dll.h:44
state_is_sentinel_dll_exprt::state
const exprt & state() const
Definition
sentinel_dll.h:39
state_is_sentinel_dll_exprt::tail
exprt & tail()
Definition
sentinel_dll.h:64
state_is_sentinel_dll_exprt::with_state
state_is_sentinel_dll_exprt with_state(exprt state) const
Definition
sentinel_dll.h:70
state_is_sentinel_dll_exprt::state_is_sentinel_dll_exprt
state_is_sentinel_dll_exprt(exprt state, exprt head, exprt tail)
Definition
sentinel_dll.h:17
state_is_sentinel_dll_exprt::head
exprt & head()
Definition
sentinel_dll.h:54
state_is_sentinel_dll_exprt::tail
const exprt & tail() const
Definition
sentinel_dll.h:59
sentinel_dll_prev
std::optional< exprt > sentinel_dll_prev(const exprt &state, const exprt &node, const namespacet &)
Definition
sentinel_dll.cpp:79
to_state_is_sentinel_dll_expr
const state_is_sentinel_dll_exprt & to_state_is_sentinel_dll_expr(const exprt &expr)
Cast an exprt to a state_is_sentinel_dll_exprt.
Definition
sentinel_dll.h:85
sentinel_dll_next
std::optional< exprt > sentinel_dll_next(const exprt &state, const exprt &node, const namespacet &)
Definition
sentinel_dll.cpp:73
PRECONDITION
#define PRECONDITION(CONDITION)
Definition
invariant.h:463
std_expr.h
API to expression classes.
cprover
sentinel_dll.h
Generated by
1.17.0