mCRL2
Loading...
Searching...
No Matches
add_binding.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11
12#ifndef MCRL2_MODAL_FORMULA_ADD_BINDING_H
13#define MCRL2_MODAL_FORMULA_ADD_BINDING_H
14
17
18namespace mcrl2
19{
20
21namespace action_formulas
22{
23
25template <template <class> class Builder, class Derived>
27{
29 using super::enter;
30 using super::leave;
31 using super::apply;
35
36 void enter(exists const& x)
37 {
39 }
40
41 void leave(exists const& x)
42 {
44 }
45
46 void enter(forall const& x)
47 {
49 }
50
51 void leave(forall const& x)
52 {
54 }
55};
56
57// TODO: get rid of this code duplication
58// special handling for where clauses
59template <template <class> class Builder, class Derived>
61{
63 using super::enter;
64 using super::leave;
65 using super::apply;
69
71 {
72 static_cast<Derived&>(*this).apply(x.declarations());
73 static_cast<Derived&>(*this).enter(x);
74 static_cast<Derived&>(*this).apply(x.body());
75 static_cast<Derived&>(*this).leave(x);
76 }
77};
78
79// special handling for where clauses
80template <template <class> class Builder, class Derived>
82{
84 using super::enter;
85 using super::leave;
86 using super::apply;
90
91 template <class T>
92 void apply(T& result, const data::where_clause& x)
93 {
94 data::assignment_expression_list declarations = static_cast<Derived&>(*this).apply(x.declarations());
95 static_cast<Derived&>(*this).enter(x);
96 result = data::where_clause(static_cast<Derived&>(*this).apply(x.body()), declarations);
97 static_cast<Derived&>(*this).leave(x);
98 }
99};
100
101} // namespace action_formulas
102
103namespace regular_formulas
104{
105
107template <template <class> class Builder, class Derived>
109{
113 using super::apply;
117};
118
119// TODO: get rid of this code duplication
120// special handling for where clauses
121template <template <class> class Builder, class Derived>
123{
125 using super::enter;
126 using super::leave;
127 using super::apply;
131
133 {
134 static_cast<Derived&>(*this).apply(x.declarations());
135 static_cast<Derived&>(*this).enter(x);
136 static_cast<Derived&>(*this).apply(x.body());
137 static_cast<Derived&>(*this).leave(x);
138 }
139};
140
141// special handling for where clauses
142template <template <class> class Builder, class Derived>
144{
146 using super::enter;
147 using super::leave;
148 using super::apply;
152
153 template <class T>
154 void apply(T& result, const data::where_clause& x)
155 {
156 data::assignment_expression_list declarations = static_cast<Derived&>(*this).apply(x.declarations());
157 static_cast<Derived&>(*this).enter(x);
158 result = data::where_clause(static_cast<Derived&>(*this).apply(x.body()), declarations);
159 static_cast<Derived&>(*this).leave(x);
160 }
161};
162
163} // namespace regular_formulas
164
165namespace state_formulas
166{
167
169template <template <class> class Builder, class Derived>
171{
175 using super::apply;
179
180 void enter(exists const& x)
181 {
183 }
184
185 void leave(exists const& x)
186 {
188 }
189
190 void enter(forall const& x)
191 {
193 }
194
195 void leave(forall const& x)
196 {
198 }
199};
200
201// TODO: get rid of this code duplication
202// special handling for where clauses
203template <template <class> class Builder, class Derived>
205{
207 using super::enter;
208 using super::leave;
209 using super::apply;
213
215 {
216 static_cast<Derived&>(*this).apply(x.declarations());
217 static_cast<Derived&>(*this).enter(x);
218 static_cast<Derived&>(*this).apply(x.body());
219 static_cast<Derived&>(*this).leave(x);
220 }
221};
222
223// special handling for where clauses
224template <template <class> class Builder, class Derived>
226{
228 using super::enter;
229 using super::leave;
230 using super::apply;
234
235 template <class T>
236 void apply(T& result, const data::where_clause& x)
237 {
238 data::assignment_expression_list declarations = static_cast<Derived&>(*this).apply(x.declarations());
239 static_cast<Derived&>(*this).enter(x);
240 result = data::where_clause(static_cast<Derived&>(*this).apply(x.body()), declarations);
241 static_cast<Derived&>(*this).leave(x);
242 }
243};
244
246template <template <class> class Builder, class Derived>
247struct add_state_variable_binding: public core::add_binding<Builder, Derived, core::identifier_string>
248{
250 using super::enter;
251 using super::leave;
252 using super::apply;
256
257 void enter(mu const& x)
258 {
260 }
261
262 void leave(mu const& x)
263 {
265 }
266
267 void enter(nu const& x)
268 {
270 }
271
272 void leave(nu const& x)
273 {
275 }
276};
277
278} // namespace state_formulas
279
280} // namespace mcrl2
281
282#endif // MCRL2_MODAL_FORMULA_ADD_BINDING_H
A list of aterm objects.
Definition aterm_list.h:24
\brief The existential quantification operator for action formulas
const data::variable_list & variables() const
\brief The universal quantification operator for action formulas
const data::variable_list & variables() const
Traverser that defines functions for maintaining bound variables.
Definition add_binding.h:26
const std::multiset< variable_type > & bound_variables() const
Returns the bound variables.
Definition add_binding.h:74
void decrease_bind_count(const variable_type &var)
Remove a variable from the multiset of bound variables.
Definition add_binding.h:51
void increase_bind_count(const variable_type &var)
Add a variable to the multiset of bound variables.
Definition add_binding.h:35
\brief A where expression
const data_expression & body() const
const assignment_expression_list & declarations() const
\brief The existential quantification operator for state formulas
const data::variable_list & variables() const
\brief The universal quantification operator for state formulas
const data::variable_list & variables() const
\brief The mu operator for state formulas
const core::identifier_string & name() const
\brief The nu operator for state formulas
const core::identifier_string & name() const
add your file description here.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
Add your file description here.
Maintains a multiset of bound data variables during traversal.
Definition add_binding.h:27
void decrease_bind_count(const assignment_list &assignments)
Definition add_binding.h:51
lps::add_data_variable_binding< Builder, Derived > super
Definition add_binding.h:28
void increase_bind_count(const assignment_list &assignments)
Definition add_binding.h:43
void apply(T &result, const data::where_clause &x)
Definition add_binding.h:92
add_data_variable_binding< Builder, Derived > super
Definition add_binding.h:83
add_data_variable_binding< Builder, Derived > super
Definition add_binding.h:62
Maintains a multiset of bound data variables during traversal.
Definition add_binding.h:26
void decrease_bind_count(const assignment_list &assignments)
Definition add_binding.h:51
void enter(const action_summand &x)
Definition add_binding.h:34
void leave(const action_summand &x)
Definition add_binding.h:39
void increase_bind_count(const assignment_list &assignments)
Definition add_binding.h:43
Maintains a multiset of bound data variables during traversal.
void decrease_bind_count(const assignment_list &assignments)
Definition add_binding.h:51
action_formulas::add_data_variable_binding< Builder, Derived > super
void increase_bind_count(const assignment_list &assignments)
Definition add_binding.h:43
void apply(T &result, const data::where_clause &x)
add_data_variable_binding< Builder, Derived > super
add_data_variable_binding< Builder, Derived > super
Maintains a multiset of bound data variables during traversal.
void decrease_bind_count(const assignment_list &assignments)
Definition add_binding.h:51
regular_formulas::add_data_variable_binding< Builder, Derived > super
void increase_bind_count(const assignment_list &assignments)
Definition add_binding.h:43
add_data_variable_binding< Builder, Derived > super
void apply(T &result, const data::where_clause &x)
add_data_variable_binding< Builder, Derived > super
Maintains a multiset of bound state variables during traversal.
core::add_binding< Builder, Derived, core::identifier_string > super