mCRL2
Loading...
Searching...
No Matches
bisimulation_type.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/bisimulation_type.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_BISIMULATION_TYPE_H
13#define MCRL2_PBES_BISIMULATION_TYPE_H
14
15#include "mcrl2/utilities/exception.h"
16#include <string>
17
18namespace mcrl2::pbes_system {
19
20/// \brief An enumerated type for the available bisimulation types
22{
27};
28
29/// \brief Returns the string corresponding to a bisimulation type
30inline
32{
33 if (type == "strong-bisim")
34 {
35 return strong_bisim;
36 }
37 else if (type == "weak-bisim")
38 {
39 return weak_bisim;
40 }
41 else if (type == "branching-bisim")
42 {
43 return branching_bisim;
44 }
45 else if (type == "branching-sim")
46 {
47 return branching_sim;
48 }
49 throw mcrl2::runtime_error(std::string("unknown bisimulation type ") + type + "!");
50 return strong_bisim;
51}
52
53/// \brief Returns a description of a bisimulation type
54inline
56{
57 switch (t)
58 {
59 case strong_bisim:
60 return "strong-bisim";
61 case weak_bisim:
62 return "weak-bisim";
63 case branching_bisim:
64 return "branching-bisim";
65 case branching_sim:
66 return "branching-sim";
67 }
68 throw mcrl2::runtime_error("unknown type");
69}
70
71/// \brief Returns a description of a bisimulation type
72inline
74{
75 switch (t)
76 {
77 case strong_bisim:
78 return "strong bisimulation";
79 case weak_bisim:
80 return "weak bisimulation";
81 case branching_bisim:
82 return "branching bisimulation";
83 case branching_sim:
84 return "branching simulation equivalence";
85 }
86 throw mcrl2::runtime_error("unknown type");
87}
88
89inline
90std::istream& operator>>(std::istream& is, bisimulation_type& t)
91{
92 try
93 {
94 std::string s;
95 is >> s;
96 t = parse_bisimulation_type(s);
97 }
98 catch (mcrl2::runtime_error&)
99 {
100 is.setstate(std::ios_base::failbit);
101 }
102 return is;
103}
104
105inline
106std::ostream& operator<<(std::ostream& os, const bisimulation_type t)
107{
108 os << print_bisimulation_type(t);
109 return os;
110}
111
112
113} // namespace mcrl2::pbes_system
114
115
116
117#endif // MCRL2_PBES_BISIMULATION_TYPE_H
Standard exception class for reporting runtime errors.
Definition exception.h:27
std::istream & operator>>(std::istream &is, bisimulation_type &t)
std::string print_bisimulation_type(const bisimulation_type t)
Returns a description of a bisimulation type.
bisimulation_type
An enumerated type for the available bisimulation types.
std::string description(const bisimulation_type t)
Returns a description of a bisimulation type.
bisimulation_type parse_bisimulation_type(const std::string &type)
Returns the string corresponding to a bisimulation type.
std::size_t operator()(const std::vector< X > &v) const