mCRL2
Loading...
Searching...
No Matches
default_expression_generator.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_DATA_DEFAULT_EXPRESSION_GENERATOR_H
13#define MCRL2_DATA_DEFAULT_EXPRESSION_GENERATOR_H
14
16
17namespace mcrl2 {
18
19namespace data {
20
23{
24 protected:
26 std::map<sort_expression, data_expression> default_values;
27
28 public:
30 : generator(dataspec)
31 {}
32
34 {
35 auto i = default_values.find(x);
36 if (i == default_values.end())
37 {
39 if (!d.defined())
40 {
41 throw mcrl2::runtime_error("could not find a default value for sort " + data::pp(x));
42 }
43 i = default_values.insert(std::make_pair(x, d)).first;
44 }
45 return i->second;
46 }
47};
48
49} // namespace data
50
51} // namespace mcrl2
52
53#endif // MCRL2_DATA_DEFAULT_EXPRESSION_GENERATOR_H
bool defined() const
Returns true if this term is not equal to the term assigned by the default constructor of aterms,...
Definition aterm_core.h:143
Expression generator that caches values.
const data_expression & operator()(const sort_expression &x)
default_expression_generator(const data_specification &dataspec)
std::map< sort_expression, data_expression > default_values
Components for generating an arbitrary element of a sort.
\brief A sort expression
Standard exception class for reporting runtime errors.
Definition exception.h:27
std::string pp(const abstraction &x)
Definition data.cpp:39
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
Component for generating representatives of sorts.