mCRL2
Loading...
Searching...
No Matches
absinthe_strategy.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_PBES_ABSINTHE_STRATEGY_H
13#define MCRL2_PBES_ABSINTHE_STRATEGY_H
14
16#include <string>
17
18namespace mcrl2 {
19
20namespace pbes_system {
21
24{
27};
28
30inline
31absinthe_strategy parse_absinthe_strategy(const std::string& strategy)
32{
33 if (strategy == "over")
34 {
35 return absinthe_over;
36 }
37 else if (strategy == "under")
38 {
39 return absinthe_under;
40 }
41 else
42 {
43 throw mcrl2::runtime_error("unknown approximation strategy specified (got `" + strategy + "')");
44 }
45}
46
48inline
49std::string print_absinthe_strategy(const absinthe_strategy strategy)
50{
51 switch (strategy)
52 {
53 case absinthe_over:
54 return "over";
55 case absinthe_under:
56 return "under";
57 }
58 throw mcrl2::runtime_error("unknown absinthe strategy");
59}
60
61inline
62std::istream& operator>>(std::istream& is, absinthe_strategy& strategy)
63{
64 try
65 {
66 std::string s;
67 is >> s;
68 strategy = parse_absinthe_strategy(s);
69 }
71 {
72 is.setstate(std::ios_base::failbit);
73 }
74 return is;
75}
76
77inline
78std::ostream& operator <<(std::ostream& os, const absinthe_strategy strategy)
79{
80 os << print_absinthe_strategy(strategy);
81 return os;
82}
83
85inline
86std::string description(const absinthe_strategy strategy)
87{
88 switch (strategy)
89 {
90 case absinthe_over:
91 return "an over-approximation";
92 case absinthe_under:
93 return "an under-approximation";
94 }
95 throw mcrl2::runtime_error("unknown absinthe strategy");
96}
97
98} // namespace pbes_system
99
100} // namespace mcrl2
101
102#endif // MCRL2_PBES_ABSINTHE_STRATEGY_H
Standard exception class for reporting runtime errors.
Definition exception.h:27
Exception classes for use in libraries and tools.
std::string description(const absinthe_strategy strategy)
Prints an absinthe strategy.
std::istream & operator>>(std::istream &is, absinthe_strategy &strategy)
std::ostream & operator<<(std::ostream &os, const absinthe_strategy strategy)
std::string print_absinthe_strategy(const absinthe_strategy strategy)
Prints an absinthe strategy.
absinthe_strategy parse_absinthe_strategy(const std::string &strategy)
Parses an absinthe strategy.
absinthe_strategy
The approximation strategies of the absinthe tool.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72