mCRL2
Loading...
Searching...
No Matches
linearisation_method.h
Go to the documentation of this file.
1// Author(s): Jan Friso Groote
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//
10
11#ifndef MCRL2_LPS_LINEARISATION_METHOD_H
12#define MCRL2_LPS_LINEARISATION_METHOD_H
13
15#include <string>
16
17namespace mcrl2
18{
19
20namespace lps
21{
22
25
29inline
30std::string print_lin_method(const t_lin_method lin_method)
31{
32 switch(lin_method)
33 {
34 case lmStack: return "stack";
35 case lmRegular: return "regular";
36 case lmRegular2: return "regular2";
37 default: throw mcrl2::runtime_error("unknown linearisation method");
38 }
39}
40
41inline
42std::string description(const t_lin_method lin_method)
43{
44 switch(lin_method)
45 {
46 case lmStack: return "for using stack data types (useful when 'regular' and 'regular2' do not work)";
47 case lmRegular: return "for generating an LPS in regular form (specification should be regular)";
48 case lmRegular2: return "for a variant of 'regular' that uses more data variables (useful when 'regular' does not work)";
49 default: throw mcrl2::runtime_error("unknown linearisation method");
50 }
51}
52
56inline
57t_lin_method parse_lin_method(const std::string& s)
58{
59 if(s == "stack")
60 {
61 return lmStack;
62 }
63 else if (s == "regular")
64 {
65 return lmRegular;
66 }
67 else if (s == "regular2")
68 {
69 return lmRegular2;
70 }
71 else
72 {
73 throw mcrl2::runtime_error("unknown linearisation strategy " + s);
74 }
75}
76
77// \overload
78inline
79std::istream& operator>>(std::istream& is, t_lin_method& l)
80{
81 try {
82 std::stringbuf buffer;
83 is >> &buffer;
84 l = parse_lin_method(buffer.str());
85 }
87 {
88 is.setstate(std::ios_base::failbit);
89 }
90
91 return is;
92}
93
94// \overload
95inline
96std::ostream& operator<<(std::ostream& os, const t_lin_method l)
97{
98 os << print_lin_method(l);
99 return os;
100}
101
102} // namespace lps
103} // namespace mcrl2
104
105#endif // MCRL2_LPS_LINEARISATION_METHOD_H
Standard exception class for reporting runtime errors.
Definition exception.h:27
Exception classes for use in libraries and tools.
t_lin_method parse_lin_method(const std::string &s)
Parse a linearisation method.
std::ostream & operator<<(std::ostream &out, const action_summand &x)
std::string description(const exploration_strategy strat)
std::istream & operator>>(std::istream &is, exploration_strategy &strat)
std::string print_lin_method(const t_lin_method lin_method)
String representation of a linearisation method.
t_lin_method
The available linearisation methods.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72