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//
9/// \file mcrl2/pbes/absinthe_strategy.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_ABSINTHE_STRATEGY_H
13#define MCRL2_PBES_ABSINTHE_STRATEGY_H
14
15#include "mcrl2/utilities/exception.h"
16#include <string>
17
18namespace mcrl2::pbes_system {
19
20/// The approximation strategies of the absinthe tool.
22{
25};
26
27/// \brief Parses an absinthe strategy
28inline
30{
31 if (strategy == "over")
32 {
33 return absinthe_over;
34 }
35 else if (strategy == "under")
36 {
37 return absinthe_under;
38 }
39 else
40 {
41 throw mcrl2::runtime_error("unknown approximation strategy specified (got `" + strategy + "')");
42 }
43}
44
45/// \brief Prints an absinthe strategy
46inline
48{
49 switch (strategy)
50 {
51 case absinthe_over:
52 return "over";
53 case absinthe_under:
54 return "under";
55 }
56 throw mcrl2::runtime_error("unknown absinthe strategy");
57}
58
59inline
60std::istream& operator>>(std::istream& is, absinthe_strategy& strategy)
61{
62 try
63 {
64 std::string s;
65 is >> s;
66 strategy = parse_absinthe_strategy(s);
67 }
68 catch(mcrl2::runtime_error&)
69 {
70 is.setstate(std::ios_base::failbit);
71 }
72 return is;
73}
74
75inline
76std::ostream& operator <<(std::ostream& os, const absinthe_strategy strategy)
77{
78 os << print_absinthe_strategy(strategy);
79 return os;
80}
81
82/// \brief Prints an absinthe strategy
83inline
84std::string description(const absinthe_strategy strategy)
85{
86 switch (strategy)
87 {
88 case absinthe_over:
89 return "an over-approximation";
90 case absinthe_under:
91 return "an under-approximation";
92 }
93 throw mcrl2::runtime_error("unknown absinthe strategy");
94}
95
96} // namespace mcrl2::pbes_system
97
98
99
100#endif // MCRL2_PBES_ABSINTHE_STRATEGY_H
Standard exception class for reporting runtime errors.
Definition exception.h:27
std::string description(const absinthe_strategy strategy)
Prints an absinthe strategy.
std::istream & operator>>(std::istream &is, 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.
std::size_t operator()(const std::vector< X > &v) const