mCRL2
Loading...
Searching...
No Matches
io.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//
9/// \file mcrl2/data/detail/io.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_DATA_DETAIL_IO_H
13#define MCRL2_DATA_DETAIL_IO_H
14
15#include "mcrl2/atermpp/algorithm.h"
16#include "mcrl2/atermpp/aterm_io.h"
17
18#include "mcrl2/data/index_traits.h"
19
20namespace mcrl2::data::detail {
21
22// transforms OpId to OpIdNoIndex
24{
25 if (x.function() == core::detail::function_symbol_OpId())
26 {
27 return atermpp::aterm(core::detail::function_symbol_OpIdNoIndex(), x.begin(), --x.end());
28 }
29 return x;
30}
31
32// transforms OpIdNoIndex to OpId
34{
35 if (x.function() == core::detail::function_symbol_OpIdNoIndex())
36 {
37 const data::function_symbol& y = reinterpret_cast<const data::function_symbol&>(x);
39 }
40 return x;
41}
42
43inline
45{
46 return atermpp::bottom_up_replace(x, detail::add_index_impl);
47}
48
49inline
51{
52 return atermpp::bottom_up_replace(x, detail::remove_index_impl);
53}
54
55} // namespace mcrl2::data::detail
56
57
58
59
60
61#endif // MCRL2_DATA_DETAIL_IO_H
A list of aterm objects.
Definition aterm_list.h:26
A unordered_map class in which aterms can be stored.
\brief A sort alias
Definition alias.h:23
\brief A basic sort
Definition basic_sort.h:25
basic_sort(const atermpp::aterm &term)
Definition basic_sort.h:34
\brief A container sort
const container_type & container_name() const
const sort_expression & element_sort() const
container_sort(const atermpp::aterm &term)
data_specification(const basic_sort_vector &sorts, const alias_vector &aliases, const function_symbol_vector &constructors, const function_symbol_vector &user_defined_mappings, const data_equation_vector &user_defined_equations)
Constructor from its members.
bool is_well_typed() const
Returns true if.
bool is_certainly_finite(const sort_expression &s) const
Checks whether a sort is certainly finite.
bool is_finite(const container_sort &s)
bool is_finite(const basic_sort &s)
bool is_finite_aux(const sort_expression &s)
bool is_finite(const sort_expression &s)
std::set< sort_expression > m_visiting
bool is_finite(const function_sort &s)
const data_specification & m_specification
finiteness_helper(const data_specification &specification)
bool is_finite(const structured_sort &s)
\brief Container type for finite sets
fset_container()
\brief Default constructor X3.
\brief A function sort
const sort_expression & codomain() const
function_sort(const atermpp::aterm &term)
const sort_expression_list & domain() const
\brief A function symbol
function_symbol(const core::identifier_string &name, const sort_expression &sort)
Constructor.
const core::identifier_string & name() const
const sort_expression & sort() const
\brief Container type for sets
set_container()
\brief Default constructor X3.
\brief A sort expression
sort_expression & operator=(const sort_expression &) noexcept=default
sort_expression(const sort_expression &) noexcept=default
Move semantics.
void add_system_defined_sort(const sort_expression &s)
Adds a sort to this specification, and marks it as system defined.
void sorts_are_not_necessarily_normalised_anymore() const
void import_system_defined_sort(const sort_expression &sort)
Adds the system defined sorts in a sequence. The second argument is used to check which sorts are add...
structured_sort(const atermpp::aterm &term)
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:393
aterm identity(const aterm &x)
The default transformer that maps each term to itself.
Definition aterm_io.h:26
std::string file_source(const std::string &filename)
Definition load_aterm.h:24
atermpp::aterm load_aterm(std::istream &stream, bool binary=true, const std::string &format="aterm", const std::string &source="", atermpp::aterm_transformer transformer=atermpp::identity)
Attempts to read an aterm from a stream.
Definition load_aterm.h:43
bool check_variable_sorts(const VariableContainer &variables, const SortContainer &sorts)
Returns true if the domain sorts and the range sort of the given variables are contained in sorts.
atermpp::aterm add_index(const atermpp::aterm &x)
Definition io.h:44
bool check_variable_names(variable_list const &variables, const std::set< core::identifier_string > &names)
Returns true if names of the given variables are not contained in names.
atermpp::aterm remove_index(const atermpp::aterm &x)
Definition io.h:50
atermpp::aterm remove_index_impl(const atermpp::aterm &x)
Definition io.h:23
bool check_assignment_variables(assignment_list const &assignments, variable_list const &variables)
Returns true if the left hand sides of assignments are contained in variables.
bool check_sort(const sort_expression &s, const SortContainer &sorts)
Returns true if the domain sorts and the codomain sort of the given sort s are contained in sorts.
bool check_data_spec_sorts(const Container &container, const SortContainer &sorts)
Returns true if the domain sorts and range sort of the given functions are contained in sorts.
data::sort_expression_list parameter_sorts(const Container &parameters)
Returns the sorts of a sequence of parameters.
atermpp::aterm add_index_impl(const atermpp::aterm &x)
Definition io.h:33
bool check_sorts(Iterator first, Iterator last, const SortContainer &sorts)
Returns true if the domain sorts and the range sort of the sorts in the sequence [first,...
bool unique_names(const VariableContainer &variables)
Returns true if the names of the given variables are unique.
Namespace for system defined sort bag.
Definition bag1.h:35
bool is_bag(const sort_expression &e)
Recogniser for sort expression Bag(s)
Definition bag1.h:52
Namespace for system defined sort bool_.
Definition bool.h:29
const basic_sort & bool_()
Constructor for sort expression Bool.
Definition bool.h:41
Namespace for system defined sort fbag.
Definition fbag1.h:34
container_sort fbag(const sort_expression &s)
Constructor for sort expression FBag(S)
Definition fbag1.h:40
bool is_fbag(const sort_expression &e)
Recogniser for sort expression FBag(s)
Definition fbag1.h:51
Namespace for system defined sort fset.
Definition fset1.h:32
bool is_fset(const sort_expression &e)
Recogniser for sort expression FSet(s)
Definition fset1.h:49
container_sort fset(const sort_expression &s)
Constructor for sort expression FSet(S)
Definition fset1.h:38
Namespace for system defined sort int_.
const basic_sort & int_()
Constructor for sort expression Int.
Definition int1.h:44
Namespace for system defined sort list.
Definition list1.h:33
bool is_list(const sort_expression &e)
Recogniser for sort expression List(s)
Definition list1.h:50
Namespace for system defined sort nat.
const basic_sort & nat()
Constructor for sort expression Nat.
Definition nat1.h:43
const basic_sort & natpair()
Constructor for sort expression @NatPair.
Definition nat1.h:72
Namespace for system defined sort pos.
const basic_sort & pos()
Constructor for sort expression Pos.
Definition pos1.h:42
Namespace for system defined sort real_.
const basic_sort & real_()
Constructor for sort expression Real.
Definition real1.h:45
Namespace for system defined sort set_.
Definition set1.h:33
bool is_set(const sort_expression &e)
Recogniser for sort expression Set(s)
Definition set1.h:50
container_sort set_(const sort_expression &s)
Constructor for sort expression Set(S)
Definition set1.h:39
bool is_structured_sort(const atermpp::aterm &x)
Returns true if the term t is a structured sort.
static sort_expression find_normal_form(const sort_expression &e, const std::multimap< sort_expression, sort_expression > &map1, std::set< sort_expression > sorts_already_seen=std::set< sort_expression >())
bool is_untyped_possible_sorts(const atermpp::aterm &x)
Returns true if the term t is an expression for multiple possible sorts.
bool is_untyped_sort(const atermpp::aterm &x)
Returns true if the term t is the unknown sort.
bool is_container_sort(const atermpp::aterm &x)
Returns true if the term t is a container sort.
bool is_basic_sort(const atermpp::aterm &x)
Returns true if the term t is a basic sort.
bool is_function_sort(const atermpp::aterm &x)
Returns true if the term t is a function sort.