mCRL2
Loading...
Searching...
No Matches
find.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_FIND_H
13#define MCRL2_MODAL_FORMULA_FIND_H
14
15#include "mcrl2/process/find.h"
18
19namespace mcrl2
20{
21
22namespace action_formulas
23{
24
25//--- start generated action_formulas find code ---//
30template <typename T, typename OutputIterator>
31void find_all_variables(const T& x, OutputIterator o)
32{
33 data::detail::make_find_all_variables_traverser<action_formulas::variable_traverser>(o).apply(x);
34}
35
39template <typename T>
40std::set<data::variable> find_all_variables(const T& x)
41{
42 std::set<data::variable> result;
43 action_formulas::find_all_variables(x, std::inserter(result, result.end()));
44 return result;
45}
46
51template <typename T, typename OutputIterator>
52void find_free_variables(const T& x, OutputIterator o)
53{
54 data::detail::make_find_free_variables_traverser<action_formulas::data_expression_traverser, action_formulas::add_data_variable_traverser_binding>(o).apply(x);
55}
56
62template <typename T, typename OutputIterator, typename VariableContainer>
63void find_free_variables_with_bound(const T& x, OutputIterator o, const VariableContainer& bound)
64{
65 data::detail::make_find_free_variables_traverser<action_formulas::data_expression_traverser, action_formulas::add_data_variable_traverser_binding>(o, bound).apply(x);
66}
67
71template <typename T>
72std::set<data::variable> find_free_variables(const T& x)
73{
74 std::set<data::variable> result;
75 action_formulas::find_free_variables(x, std::inserter(result, result.end()));
76 return result;
77}
78
83template <typename T, typename VariableContainer>
84std::set<data::variable> find_free_variables_with_bound(const T& x, VariableContainer const& bound)
85{
86 std::set<data::variable> result;
87 action_formulas::find_free_variables_with_bound(x, std::inserter(result, result.end()), bound);
88 return result;
89}
90
95template <typename T, typename OutputIterator>
96void find_identifiers(const T& x, OutputIterator o)
97{
98 data::detail::make_find_identifiers_traverser<action_formulas::identifier_string_traverser>(o).apply(x);
99}
100
104template <typename T>
105std::set<core::identifier_string> find_identifiers(const T& x)
106{
107 std::set<core::identifier_string> result;
108 action_formulas::find_identifiers(x, std::inserter(result, result.end()));
109 return result;
110}
111
116template <typename T, typename OutputIterator>
117void find_sort_expressions(const T& x, OutputIterator o)
118{
119 data::detail::make_find_sort_expressions_traverser<action_formulas::sort_expression_traverser>(o).apply(x);
120}
121
125template <typename T>
126std::set<data::sort_expression> find_sort_expressions(const T& x)
127{
128 std::set<data::sort_expression> result;
129 action_formulas::find_sort_expressions(x, std::inserter(result, result.end()));
130 return result;
131}
132
137template <typename T, typename OutputIterator>
138void find_function_symbols(const T& x, OutputIterator o)
139{
140 data::detail::make_find_function_symbols_traverser<action_formulas::data_expression_traverser>(o).apply(x);
141}
142
146template <typename T>
147std::set<data::function_symbol> find_function_symbols(const T& x)
148{
149 std::set<data::function_symbol> result;
150 action_formulas::find_function_symbols(x, std::inserter(result, result.end()));
151 return result;
152}
153//--- end generated action_formulas find code ---//
154
155} // namespace action_formulas
156
157namespace regular_formulas
158{
159
160//--- start generated regular_formulas find code ---//
165template <typename T, typename OutputIterator>
166void find_all_variables(const T& x, OutputIterator o)
167{
168 data::detail::make_find_all_variables_traverser<regular_formulas::variable_traverser>(o).apply(x);
169}
170
174template <typename T>
175std::set<data::variable> find_all_variables(const T& x)
176{
177 std::set<data::variable> result;
178 regular_formulas::find_all_variables(x, std::inserter(result, result.end()));
179 return result;
180}
181
186template <typename T, typename OutputIterator>
187void find_free_variables(const T& x, OutputIterator o)
188{
189 data::detail::make_find_free_variables_traverser<regular_formulas::data_expression_traverser, regular_formulas::add_data_variable_traverser_binding>(o).apply(x);
190}
191
197template <typename T, typename OutputIterator, typename VariableContainer>
198void find_free_variables_with_bound(const T& x, OutputIterator o, const VariableContainer& bound)
199{
200 data::detail::make_find_free_variables_traverser<regular_formulas::data_expression_traverser, regular_formulas::add_data_variable_traverser_binding>(o, bound).apply(x);
201}
202
206template <typename T>
207std::set<data::variable> find_free_variables(const T& x)
208{
209 std::set<data::variable> result;
210 regular_formulas::find_free_variables(x, std::inserter(result, result.end()));
211 return result;
212}
213
218template <typename T, typename VariableContainer>
219std::set<data::variable> find_free_variables_with_bound(const T& x, VariableContainer const& bound)
220{
221 std::set<data::variable> result;
222 regular_formulas::find_free_variables_with_bound(x, std::inserter(result, result.end()), bound);
223 return result;
224}
225
230template <typename T, typename OutputIterator>
231void find_identifiers(const T& x, OutputIterator o)
232{
233 data::detail::make_find_identifiers_traverser<regular_formulas::identifier_string_traverser>(o).apply(x);
234}
235
239template <typename T>
240std::set<core::identifier_string> find_identifiers(const T& x)
241{
242 std::set<core::identifier_string> result;
243 regular_formulas::find_identifiers(x, std::inserter(result, result.end()));
244 return result;
245}
246
251template <typename T, typename OutputIterator>
252void find_sort_expressions(const T& x, OutputIterator o)
253{
254 data::detail::make_find_sort_expressions_traverser<regular_formulas::sort_expression_traverser>(o).apply(x);
255}
256
260template <typename T>
261std::set<data::sort_expression> find_sort_expressions(const T& x)
262{
263 std::set<data::sort_expression> result;
264 regular_formulas::find_sort_expressions(x, std::inserter(result, result.end()));
265 return result;
266}
267
272template <typename T, typename OutputIterator>
273void find_function_symbols(const T& x, OutputIterator o)
274{
275 data::detail::make_find_function_symbols_traverser<regular_formulas::data_expression_traverser>(o).apply(x);
276}
277
281template <typename T>
282std::set<data::function_symbol> find_function_symbols(const T& x)
283{
284 std::set<data::function_symbol> result;
285 regular_formulas::find_function_symbols(x, std::inserter(result, result.end()));
286 return result;
287}
288//--- end generated regular_formulas find code ---//
289
290} // namespace regular_formulas
291
292namespace state_formulas
293{
294
295//--- start generated state_formulas find code ---//
300template <typename T, typename OutputIterator>
301void find_all_variables(const T& x, OutputIterator o)
302{
303 data::detail::make_find_all_variables_traverser<state_formulas::variable_traverser>(o).apply(x);
304}
305
309template <typename T>
310std::set<data::variable> find_all_variables(const T& x)
311{
312 std::set<data::variable> result;
313 state_formulas::find_all_variables(x, std::inserter(result, result.end()));
314 return result;
315}
316
321template <typename T, typename OutputIterator>
322void find_free_variables(const T& x, OutputIterator o)
323{
324 data::detail::make_find_free_variables_traverser<state_formulas::data_expression_traverser, state_formulas::add_data_variable_traverser_binding>(o).apply(x);
325}
326
332template <typename T, typename OutputIterator, typename VariableContainer>
333void find_free_variables_with_bound(const T& x, OutputIterator o, const VariableContainer& bound)
334{
335 data::detail::make_find_free_variables_traverser<state_formulas::data_expression_traverser, state_formulas::add_data_variable_traverser_binding>(o, bound).apply(x);
336}
337
341template <typename T>
342std::set<data::variable> find_free_variables(const T& x)
343{
344 std::set<data::variable> result;
345 state_formulas::find_free_variables(x, std::inserter(result, result.end()));
346 return result;
347}
348
353template <typename T, typename VariableContainer>
354std::set<data::variable> find_free_variables_with_bound(const T& x, VariableContainer const& bound)
355{
356 std::set<data::variable> result;
357 state_formulas::find_free_variables_with_bound(x, std::inserter(result, result.end()), bound);
358 return result;
359}
360
365template <typename T, typename OutputIterator>
366void find_identifiers(const T& x, OutputIterator o)
367{
368 data::detail::make_find_identifiers_traverser<state_formulas::identifier_string_traverser>(o).apply(x);
369}
370
374template <typename T>
375std::set<core::identifier_string> find_identifiers(const T& x)
376{
377 std::set<core::identifier_string> result;
378 state_formulas::find_identifiers(x, std::inserter(result, result.end()));
379 return result;
380}
381
386template <typename T, typename OutputIterator>
387void find_sort_expressions(const T& x, OutputIterator o)
388{
389 data::detail::make_find_sort_expressions_traverser<state_formulas::sort_expression_traverser>(o).apply(x);
390}
391
395template <typename T>
396std::set<data::sort_expression> find_sort_expressions(const T& x)
397{
398 std::set<data::sort_expression> result;
399 state_formulas::find_sort_expressions(x, std::inserter(result, result.end()));
400 return result;
401}
402
407template <typename T, typename OutputIterator>
408void find_function_symbols(const T& x, OutputIterator o)
409{
410 data::detail::make_find_function_symbols_traverser<state_formulas::data_expression_traverser>(o).apply(x);
411}
412
416template <typename T>
417std::set<data::function_symbol> find_function_symbols(const T& x)
418{
419 std::set<data::function_symbol> result;
420 state_formulas::find_function_symbols(x, std::inserter(result, result.end()));
421 return result;
422}
423//--- end generated state_formulas find code ---//
424
425namespace detail {
426
427// collects state variable names in a set
429{
431 using super::enter;
432 using super::leave;
433 using super::apply;
434
435 std::set<core::identifier_string> names;
436
438 {
439 names.insert(x.name());
440 }
441};
442
443template <template <class> class Traverser, class OutputIterator>
444struct find_state_variables_traverser: public Traverser<find_state_variables_traverser<Traverser, OutputIterator> >
445{
446 typedef Traverser<find_state_variables_traverser<Traverser, OutputIterator> > super;
447 using super::enter;
448 using super::leave;
449 using super::apply;
450
451 OutputIterator out;
452
454 : out(out_)
455 {}
456
457 void apply(const variable& v)
458 {
459 *out = v;
460 }
461};
462
463template <template <class> class Traverser, class OutputIterator>
464find_state_variables_traverser<Traverser, OutputIterator>
466{
468}
469
470template <template <class> class Traverser, template <template <class> class, class> class Binder, class OutputIterator>
471struct find_free_state_variables_traverser: public Binder<Traverser, find_free_state_variables_traverser<Traverser, Binder, OutputIterator> >
472{
473 typedef Binder<Traverser, find_free_state_variables_traverser<Traverser, Binder, OutputIterator> > super;
474 using super::enter;
475 using super::leave;
476 using super::apply;
477 using super::is_bound;
478 using super::bound_variables;
479 using super::increase_bind_count;
480
481 OutputIterator out;
482
484 : out(out_)
485 {}
486
487/*
488 template <typename VariableContainer>
489 find_free_state_variables_traverser(OutputIterator out_, const VariableContainer& v)
490 : out(out_)
491 {
492 increase_bind_count(v);
493 }
494*/
495
496 void apply(const variable& v)
497 {
498 if (!is_bound(v.name()))
499 {
500 *out = v;
501 }
502 }
503};
504
505template <template <class> class Traverser, template <template <class> class, class> class Binder, class OutputIterator>
506find_free_state_variables_traverser<Traverser, Binder, OutputIterator>
508{
510}
511
512template <template <class> class Traverser, template <template <class> class, class> class Binder, class OutputIterator, class VariableContainer>
513find_free_state_variables_traverser<Traverser, Binder, OutputIterator>
514make_find_free_state_variables_traverser(OutputIterator out, const VariableContainer& v)
515{
517}
518
519} // namespace detail
520
523inline
524std::set<core::identifier_string> find_state_variable_names(const state_formula& x)
525{
527 f.apply(x);
528 return f.names;
529}
530
535template <typename T, typename OutputIterator>
536void find_state_variables(const T& x, OutputIterator o)
537{
538 state_formulas::detail::make_find_state_variables_traverser<state_formulas::state_variable_traverser>(o).apply(x);
539}
540
544template <typename T>
545std::set<state_formulas::variable> find_state_variables(const T& x)
546{
547 std::set<state_formulas::variable> result;
548 state_formulas::find_state_variables(x, std::inserter(result, result.end()));
549 return result;
550}
551
556template <typename T, typename OutputIterator>
557void find_free_state_variables(const T& x, OutputIterator o)
558{
559 state_formulas::detail::make_find_free_state_variables_traverser<state_formulas::state_variable_traverser, state_formulas::add_state_variable_binding>(o).apply(x);
560}
561
565template <typename T>
566std::set<state_formulas::variable> find_free_state_variables(const T& x)
567{
568 std::set<state_formulas::variable> result;
569 state_formulas::find_free_state_variables(x, std::inserter(result, result.end()));
570 return result;
571}
572
577template <typename T, typename OutputIterator>
578void find_action_labels(const T& x, OutputIterator o)
579{
580 process::detail::make_find_action_labels_traverser<state_formulas::action_label_traverser>(o).apply(x);
581}
582
586template <typename T>
587std::set<process::action_label> find_action_labels(const T& x)
588{
589 std::set<process::action_label> result;
590 state_formulas::find_action_labels(x, std::inserter(result, result.end()));
591 return result;
592}
593
594} // namespace state_formulas
595
596} // namespace mcrl2
597
598#endif // MCRL2_MODAL_FORMULA_FIND_H
\brief The state formula variable
const core::identifier_string & name() const
add your file description here.
add your file description here.
void find_free_variables_with_bound(const T &x, OutputIterator o, const VariableContainer &bound)
Definition find.h:63
void find_free_variables(const T &x, OutputIterator o)
Definition find.h:52
std::set< data::variable > find_all_variables(const action_formulas::action_formula &x)
void find_function_symbols(const T &x, OutputIterator o)
Definition find.h:138
void find_identifiers(const T &x, OutputIterator o)
Definition find.h:96
void find_sort_expressions(const T &x, OutputIterator o)
Definition find.h:117
void find_function_symbols(const T &x, OutputIterator o)
Definition find.h:273
void find_sort_expressions(const T &x, OutputIterator o)
Definition find.h:252
void find_free_variables_with_bound(const T &x, OutputIterator o, const VariableContainer &bound)
Definition find.h:198
void find_all_variables(const T &x, OutputIterator o)
Definition find.h:166
void find_identifiers(const T &x, OutputIterator o)
Definition find.h:231
void find_free_variables(const T &x, OutputIterator o)
Definition find.h:187
find_free_state_variables_traverser< Traverser, Binder, OutputIterator > make_find_free_state_variables_traverser(OutputIterator out)
Definition find.h:507
find_state_variables_traverser< Traverser, OutputIterator > make_find_state_variables_traverser(OutputIterator out)
Definition find.h:465
void find_function_symbols(const T &x, OutputIterator o)
Definition find.h:408
void find_identifiers(const T &x, OutputIterator o)
Definition find.h:366
void find_sort_expressions(const T &x, OutputIterator o)
Definition find.h:387
void find_action_labels(const T &x, OutputIterator o)
Returns all action labels that occur in an object.
Definition find.h:578
void find_all_variables(const T &x, OutputIterator o)
Definition find.h:301
void find_state_variables(const T &x, OutputIterator o)
Returns all state variables that occur in an object.
Definition find.h:536
std::set< core::identifier_string > find_state_variable_names(const state_formula &x)
Returns the names of the state variables that occur in x.
Definition find.h:524
void find_free_state_variables(const T &x, OutputIterator o)
Returns all free state variables that occur in an object.
Definition find.h:557
void find_free_variables_with_bound(const T &x, OutputIterator o, const VariableContainer &bound)
Definition find.h:333
void find_free_variables(const T &x, OutputIterator o)
Definition find.h:322
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.
Binder< Traverser, find_free_state_variables_traverser< Traverser, Binder, OutputIterator > > super
Definition find.h:473
Traverser< find_state_variables_traverser< Traverser, OutputIterator > > super
Definition find.h:446
state_formulas::state_formula_traverser< state_variable_name_traverser > super
Definition find.h:430
std::set< core::identifier_string > names
Definition find.h:435
void apply(const state_formulas::variable &x)
Definition find.h:437