Line data Source code
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/detail/stategraph_utility.h 10 : /// \brief add your file description here. 11 : 12 : #ifndef MCRL2_PBES_DETAIL_STATEGRAPH_UTILITY_H 13 : #define MCRL2_PBES_DETAIL_STATEGRAPH_UTILITY_H 14 : 15 : #include "mcrl2/pbes/pbes_equation.h" 16 : 17 : namespace mcrl2 { 18 : 19 : namespace pbes_system { 20 : 21 : namespace detail { 22 : 23 : inline 24 0 : std::string print_equation(const pbes_equation& eq) 25 : { 26 0 : return (eq.symbol().is_mu() ? "mu " : "nu ") + pbes_system::pp(eq.variable()) + " = " + pbes_system::pp(eq.formula()); 27 : } 28 : 29 : inline 30 0 : std::string print_set(const std::set<std::size_t>& v) 31 : { 32 0 : std::ostringstream out; 33 0 : out << "{"; 34 0 : for (auto i = v.begin(); i != v.end(); ++i) 35 : { 36 0 : if (i != v.begin()) 37 : { 38 0 : out << ", "; 39 : } 40 0 : out << *i; 41 : } 42 0 : out << "}"; 43 0 : return out.str(); 44 0 : } 45 : 46 : inline 47 26 : const data::data_expression& nth_element(const data::data_expression_list& e, std::size_t n) 48 : { 49 26 : assert(n < e.size()); 50 26 : data::data_expression_list::const_iterator i = e.begin(); 51 36 : for (std::size_t j = 0; j < n; ++j) 52 : { 53 10 : ++i; 54 : } 55 26 : return *i; 56 : } 57 : 58 : inline 59 : std::string print_pbes_expressions(const std::set<pbes_expression>& v) 60 : { 61 : std::ostringstream out; 62 : out << "{"; 63 : for (auto j = v.begin(); j != v.end(); ++j) 64 : { 65 : if (j != v.begin()) 66 : { 67 : out << ", "; 68 : } 69 : out << pbes_system::pp(*j); 70 : } 71 : out << "}"; 72 : return out.str(); 73 : } 74 : 75 : } // namespace detail 76 : 77 : } // namespace pbes_system 78 : 79 : } // namespace mcrl2 80 : 81 : #endif // MCRL2_PBES_DETAIL_STATEGRAPH_UTILITY_H