10#include "mcrl2/data/data_io.h"
12#include "mcrl2/atermpp/algorithm.h"
13#include "mcrl2/data/data_specification.h"
16using namespace mcrl2::
data;
21 if (x.function() == core::detail::function_symbol_OpId())
23 return atermpp::aterm(core::detail::function_symbol_OpIdNoIndex(), x.begin(), --x.end());
31 if (x.function() == core::detail::function_symbol_OpIdNoIndex())
41 return atermpp::aterm(core::detail::function_symbol_DataSpec(),
42 atermpp::aterm(core::detail::function_symbol_SortSpec(), atermpp::aterm_list(s.user_defined_sorts().begin(),s.user_defined_sorts().end()) +
43 atermpp::aterm_list(s.user_defined_aliases().begin(),s.user_defined_aliases().end())),
44 atermpp::aterm(core::detail::function_symbol_ConsSpec(), atermpp::aterm_list(s.user_defined_constructors().begin(),s.user_defined_constructors().end())),
45 atermpp::aterm(core::detail::function_symbol_MapSpec(), atermpp::aterm_list(s.user_defined_mappings().begin(),s.user_defined_mappings().end())),
46 atermpp::aterm(core::detail::function_symbol_DataEqnSpec(), atermpp::aterm_list(s.user_defined_equations().begin(),s.user_defined_equations().end())));
66 basic_sort_vector sorts;
68 function_symbol_vector constructors;
69 function_symbol_vector user_defined_mappings;
70 data_equation_vector user_defined_equations;
74 stream >> constructors;
75 stream >> user_defined_mappings;
76 stream >> user_defined_equations;
79 spec = data_specification(sorts, aliases, constructors, user_defined_mappings, user_defined_equations);
89 stream << spec.user_defined_sorts();
90 stream << spec.user_defined_aliases();
91 stream << spec.user_defined_constructors();
92 stream << spec.user_defined_mappings();
93 stream << spec.user_defined_equations();
The interface for a class that reads aterm from a stream. The default constructed term aterm() indica...
The interface for a class that writes aterm to a stream. Every written term is retrieved by the corre...
A helper class to restore the state of the aterm_{i,o}stream objects upon destruction....
aterm_stream_state(aterm_stream &stream)
A unordered_map class in which aterms can be stored.
function_symbol(const core::identifier_string &name, const sort_expression &sort)
Constructor.
const core::identifier_string & name() const
const sort_expression & sort() const
atermpp::aterm remove_index(const atermpp::aterm &x)
static atermpp::aterm remove_index_impl(const atermpp::aterm &x)
static atermpp::aterm add_index_impl(const atermpp::aterm &x)
atermpp::aterm add_index(const atermpp::aterm &x)
aterm_istream & operator>>(aterm_istream &stream, aterm_transformer transformer)
Sets the given transformer to be applied to following reads.
atermpp::aterm data_specification_to_aterm(const data_specification &s)
atermpp::aterm_istream & operator>>(atermpp::aterm_istream &stream, data_specification &spec)
Reads a data specification from a stream.