mCRL2
Loading...
Searching...
No Matches
remove_level.h
Go to the documentation of this file.
1// Author(s): Jan Friso Groote, XIAO Qi
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 remove_level.h
10/// \brief BES variable remove level when generating a BES from a PBES.
11
12#ifndef MCRL2_PBES_REMOVE_LEVEL_H
13#define MCRL2_PBES_REMOVE_LEVEL_H
14
15#include <string>
16#include "mcrl2/utilities/exception.h"
17
18
19
20namespace mcrl2::pbes_system
21{
22
23/// \brief BES variable remove level when generating a BES from a PBES.
25{
26 none, // Do not remove bes variables.
27 some, // Remove bes variables that are not used, and of which
28 // the rhs of its equation is not equal to true and false.
29 all // Remove all bes variables whenever they are not used in
30 // any other equation.
31};
32
33inline
35{
36 if (s == "none")
37 {
38 return none;
39 }
40 else if (s == "some")
41 {
42 return some;
43 }
44 else if (s == "all")
45 {
46 return all;
47 }
48 else
49 {
50 throw mcrl2::runtime_error("unknown bes variables remove level " + s);
51 }
52}
53
54inline
56{
57 switch(s)
58 {
59 case none: return "none";
60 case some: return "some";
61 case all: return "all";
62 }
63 throw mcrl2::runtime_error("unknown remove_level");
64}
65
66inline
67std::istream& operator>>(std::istream& is, remove_level& level)
68{
69 try
70 {
71 std::string s;
72 is >> s;
73 level = parse_remove_level(s);
74 }
75 catch(mcrl2::runtime_error&)
76 {
77 is.setstate(std::ios_base::failbit);
78 }
79 return is;
80}
81
82inline
83std::ostream& operator<<(std::ostream& os, const remove_level s)
84{
85 os << print_remove_level(s);
86 return os;
87}
88
89inline
91{
92 switch(s)
93 {
94 case none: return "never remove a generated bes variable and its equation. This can lead to excessive"
95 " memory usage.";
96 case some: return "remove generated bes variables that do not occur anymore in the generated BES, except if"
97 " the right hand side of its equation is true or false. The rhss of removed variables"
98 " must have to be recalculated, when this bes variable is encountered again.";
99 case all: return "remove the equation for bes variables that do not occur anymore in generated boolean equation system."
100 " This is quite memory efficient, but it can be very time consuming as the rhss of removed bes"
101 " variables may have to be recalculated quite often.";
102 }
103 throw mcrl2::runtime_error("unknown remove level");
104}
105
106} // namespace mcrl2::pbes_system
107
108
109
110#endif // MCRL2_PBES_REMOVE_LEVEL_H
Standard exception class for reporting runtime errors.
Definition exception.h:27
remove_level parse_remove_level(const std::string &s)
std::string print_remove_level(const remove_level s)
remove_level
BES variable remove level when generating a BES from a PBES.
std::string description(const remove_level s)
std::istream & operator>>(std::istream &is, remove_level &level)
std::size_t operator()(const std::vector< X > &v) const