mCRL2
Loading...
Searching...
No Matches
pbesinst_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/pbesinst_strategy.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_PBESINST_STRATEGY_H
13#define MCRL2_PBES_PBESINST_STRATEGY_H
14
15#include "mcrl2/utilities/exception.h"
16#include <string>
17
18
19
20namespace mcrl2::pbes_system {
21
22/// \brief pbesinst transformation strategies
24{
28};
29
30/// \brief Parse a pbesinst transformation strategy.
31inline
33{
34 if (s == "finite")
35 {
37 }
38 else if (s == "alternative-lazy")
39 {
41 }
42 else if (s == "lazy")
43 {
45 }
46 else
47 {
48 throw mcrl2::runtime_error("unknown pbesinst strategy specified (got `" + s + "')");
49 }
50}
51
52inline
53std::istream& operator>>(std::istream& is, pbesinst_strategy& s)
54{
55 try
56 {
57 std::string str;
58 is >> str;
59 s = parse_pbesinst_strategy(str);
60 }
61 catch(mcrl2::runtime_error&)
62 {
63 is.setstate(std::ios_base::failbit);
64 }
65 return is;
66}
67
68/// \brief Returns a string representation of a pbesinst transformation strategy.
69inline
71{
72 if (strategy == pbesinst_finite_strategy)
73 {
74 return "finite";
75 }
76 else if (strategy == pbesinst_alternative_lazy_strategy)
77 {
78 return "alternative-lazy";
79 }
80 else if (strategy == pbesinst_lazy_strategy)
81 {
82 return "lazy";
83 }
84 throw mcrl2::runtime_error("unknown pbesinst strategy");
85}
86
87inline
88std::ostream& operator<<(std::ostream& os, const pbesinst_strategy strategy)
89{
90 os << print_pbesinst_strategy(strategy);
91 return os;
92}
93
94/// \brief Returns a string representation of a pbesinst transformation strategy.
95inline
96std::string description(const pbesinst_strategy strategy)
97{
98 if (strategy == pbesinst_finite_strategy)
99 {
100 return "for computing all possible boolean equations";
101 }
102 else if (strategy == pbesinst_alternative_lazy_strategy)
103 {
104 return "an alternative version of the lazy strategy that supports more options";
105 }
106 else if (strategy == pbesinst_lazy_strategy)
107 {
108 return "for computing only boolean equations which can be reached from the initial state";
109 }
110 throw mcrl2::runtime_error("unknown pbesinst strategy");
111}
112
113} // namespace mcrl2::pbes_system
114
115
116
117#endif // MCRL2_PBES_PBESINST_STRATEGY_H
Standard exception class for reporting runtime errors.
Definition exception.h:27
std::istream & operator>>(std::istream &is, pbesinst_strategy &s)
pbesinst_strategy
pbesinst transformation strategies
pbesinst_strategy parse_pbesinst_strategy(const std::string &s)
Parse a pbesinst transformation strategy.
std::string print_pbesinst_strategy(const pbesinst_strategy strategy)
Returns a string representation of a pbesinst transformation strategy.
std::string description(const pbesinst_strategy strategy)
Returns a string representation of a pbesinst transformation strategy.
std::size_t operator()(const std::vector< X > &v) const