12#ifndef MCRL2_DATA_FIND_H
13#define MCRL2_DATA_FIND_H
28template <
template <
class>
class Traverser,
class OutputIterator>
29struct find_identifiers_traverser:
public Traverser<find_identifiers_traverser<Traverser, OutputIterator> >
31 typedef Traverser<find_identifiers_traverser<Traverser, OutputIterator> > super;
39 explicit find_identifiers_traverser(OutputIterator out_)
43 void apply(
const core::identifier_string& v)
49template <
template <
class>
class Traverser,
class OutputIterator>
50find_identifiers_traverser<Traverser, OutputIterator>
51make_find_identifiers_traverser(OutputIterator out)
53 return find_identifiers_traverser<Traverser, OutputIterator>(out);
56template <
template <
class>
class Traverser,
class OutputIterator>
57struct find_function_symbols_traverser:
public Traverser<find_function_symbols_traverser<Traverser, OutputIterator> >
59 typedef Traverser<find_function_symbols_traverser<Traverser, OutputIterator> > super;
66 explicit find_function_symbols_traverser(OutputIterator out_)
70 void apply(
const function_symbol& v)
76template <
template <
class>
class Traverser,
class OutputIterator>
77find_function_symbols_traverser<Traverser, OutputIterator>
78make_find_function_symbols_traverser(OutputIterator out)
80 return find_function_symbols_traverser<Traverser, OutputIterator>(out);
83template <
template <
class>
class Traverser,
class OutputIterator>
84struct find_sort_expressions_traverser:
public Traverser<find_sort_expressions_traverser<Traverser, OutputIterator> >
86 typedef Traverser<find_sort_expressions_traverser<Traverser, OutputIterator> > super;
93 explicit find_sort_expressions_traverser(OutputIterator out_)
98 void apply(
const data::sort_expression& v)
107template <
template <
class>
class Traverser,
class OutputIterator>
108find_sort_expressions_traverser<Traverser, OutputIterator>
109make_find_sort_expressions_traverser(OutputIterator out)
111 return find_sort_expressions_traverser<Traverser, OutputIterator>(out);
114template <
template <
class>
class Traverser,
class OutputIterator>
115struct find_data_expressions_traverser:
public Traverser<find_data_expressions_traverser<Traverser, OutputIterator> >
117 typedef Traverser<find_data_expressions_traverser<Traverser, OutputIterator> > super;
124 explicit find_data_expressions_traverser(OutputIterator out_)
128 void apply(
const data::data_expression& v)
137template <
template <
class>
class Traverser,
class OutputIterator>
138find_data_expressions_traverser<Traverser, OutputIterator>
139make_find_data_expressions_traverser(OutputIterator out)
141 return find_data_expressions_traverser<Traverser, OutputIterator>(out);
144template <
template <
class>
class Traverser,
class OutputIterator>
145struct find_all_variables_traverser:
public Traverser<find_all_variables_traverser<Traverser, OutputIterator> >
147 typedef Traverser<find_all_variables_traverser<Traverser, OutputIterator> > super;
154 explicit find_all_variables_traverser(OutputIterator out_)
158 void apply(
const variable& v)
164template <
template <
class>
class Traverser,
class OutputIterator>
165find_all_variables_traverser<Traverser, OutputIterator>
166make_find_all_variables_traverser(OutputIterator out)
168 return find_all_variables_traverser<Traverser, OutputIterator>(out);
171template <
typename T,
typename OutputIterator>
void find_free_variables(
const T& x, OutputIterator o);
173template <
template <
class>
class Traverser,
template <
template <
class>
class,
class>
class Binder, class OutputIterator>
174struct find_free_variables_traverser:
public Binder<Traverser, find_free_variables_traverser<Traverser, Binder, OutputIterator> >
176 typedef Binder<Traverser, find_free_variables_traverser<Traverser, Binder, OutputIterator> > super;
180 using super::is_bound;
181 using super::bound_variables;
182 using super::increase_bind_count;
186 explicit find_free_variables_traverser(OutputIterator out_)
190 template <
typename VariableContainer>
191 find_free_variables_traverser(OutputIterator out_,
const VariableContainer& v)
194 increase_bind_count(v);
197 void apply(
const variable& v)
206template <
template <
class>
class Traverser,
template <
template <
class>
class,
class>
class Binder, class OutputIterator>
207find_free_variables_traverser<Traverser, Binder, OutputIterator>
208make_find_free_variables_traverser(OutputIterator out)
210 return find_free_variables_traverser<Traverser, Binder, OutputIterator>(out);
213template <
template <
class>
class Traverser,
template <
template <
class>
class,
class>
class Binder, class OutputIterator, class VariableContainer>
214find_free_variables_traverser<Traverser, Binder, OutputIterator>
215make_find_free_variables_traverser(OutputIterator out, const VariableContainer& v)
217 return find_free_variables_traverser<Traverser, Binder, OutputIterator>(out, v);
220template <
template <
class>
class Traverser>
221struct search_variable_traverser:
public Traverser<search_variable_traverser<Traverser> >
223 typedef Traverser<search_variable_traverser<Traverser> > super;
231 explicit search_variable_traverser(
const variable& v_)
232 : found(false), v(v_)
235 void apply(
const variable& x)
244template <
template <
class>
class Traverser>
245search_variable_traverser<Traverser>
246make_search_variable_traverser(
const data::variable& v)
248 return search_variable_traverser<Traverser>(v);
251template <
template <
class>
class Traverser,
template <
template <
class>
class,
class>
class Binder>
252struct search_free_variable_traverser:
public Binder<Traverser, search_free_variable_traverser<Traverser, Binder> >
254 typedef Binder<Traverser, search_free_variable_traverser<Traverser, Binder> > super;
258 using super::is_bound;
259 using super::bound_variables;
260 using super::increase_bind_count;
263 const data::variable& v;
265 explicit search_free_variable_traverser(
const data::variable& v_)
266 : found(false), v(v_)
269 void apply(
const variable& x)
271 if (v == x && !is_bound(x))
278template <
template <
class>
class Traverser,
template <
template <
class>
class,
class>
class Binder>
279search_free_variable_traverser<Traverser, Binder>
280make_search_free_variable_traverser(const data::variable& v)
282 return search_free_variable_traverser<Traverser, Binder>(v);
293template <
typename T,
typename OutputIterator>
296 data::detail::make_find_all_variables_traverser<data::variable_traverser>(o).apply(x);
305 std::set<data::variable> result;
314template <
typename T,
typename OutputIterator>
317 data::detail::make_find_free_variables_traverser<data::data_expression_traverser, data::add_data_variable_traverser_binding>(o).apply(x);
325template <
typename T,
typename OutputIterator,
typename VariableContainer>
328 data::detail::make_find_free_variables_traverser<data::data_expression_traverser, data::add_data_variable_traverser_binding>(o, bound).apply(x);
337 std::set<data::variable> result;
346template <
typename T,
typename VariableContainer>
349 std::set<data::variable> result;
358template <
typename T,
typename OutputIterator>
361 data::detail::make_find_identifiers_traverser<data::identifier_string_traverser>(o).apply(x);
370 std::set<core::identifier_string> result;
379template <
typename T,
typename OutputIterator>
382 data::detail::make_find_sort_expressions_traverser<data::sort_expression_traverser>(o).apply(x);
391 std::set<data::sort_expression> result;
400template <
typename T,
typename OutputIterator>
403 data::detail::make_find_function_symbols_traverser<data::data_expression_traverser>(o).apply(x);
412 std::set<data::function_symbol> result;
422template <
typename T,
typename OutputIterator>
425 data::detail::make_find_data_expressions_traverser<data::data_expression_traverser>(o).apply(x);
434 std::set<data::data_expression> result;
446 data::detail::search_variable_traverser<data::variable_traverser> f(v);
458 data::detail::search_free_variable_traverser<data::data_expression_traverser, data::add_data_variable_traverser_binding> f(v);
467template <
typename Container>
471 return sort_expressions.find(s) != sort_expressions.end();
478template <
typename Container>
482 return data_expressions.find(s) != data_expressions.end();
add your file description here.
add your file description here.
Add your file description here.
void find_identifiers(const T &x, OutputIterator o)
void find_free_variables_with_bound(const T &x, OutputIterator o, const VariableContainer &bound)
bool search_data_expression(Container const &container, const data_expression &s)
Returns true if the term has a given data expression as subterm.
std::set< data::variable > find_all_variables(const data::data_expression &x)
bool search_free_variable(const T &x, const variable &v)
Returns true if the term has a given free variable as subterm.
bool search_sort_expression(Container const &container, const sort_expression &s)
Returns true if the term has a given sort expression as subterm.
std::set< data::sort_expression > find_sort_expressions(const data::data_equation &x)
std::set< data::function_symbol > find_function_symbols(const data::data_equation &x)
std::set< data::variable > find_free_variables(const data::data_expression &x)
void find_data_expressions(const T &x, OutputIterator o)
Returns all data expressions that occur in an object.
bool search_variable(const data::data_expression &x, const data::variable &v)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...