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/process/multi_action_name.h 10 : /// \brief add your file description here. 11 : 12 : #ifndef MCRL2_PROCESS_MULTI_ACTION_NAME_H 13 : #define MCRL2_PROCESS_MULTI_ACTION_NAME_H 14 : 15 : #include "mcrl2/atermpp/aterm_io_text.h" 16 : #include "mcrl2/core/identifier_string.h" 17 : 18 : namespace mcrl2 { 19 : 20 : namespace process { 21 : 22 : /// \brief Represents the name of a multi action 23 : struct multi_action_name: public std::multiset<core::identifier_string> 24 : { 25 : typedef std::multiset<core::identifier_string> super; 26 : 27 390 : multi_action_name() = default; 28 : 29 : template <typename InputIterator> 30 24 : multi_action_name(InputIterator first, InputIterator last) 31 24 : : super(first, last) 32 24 : {} 33 : }; 34 : 35 : /// \brief Represents a set of multi action names 36 : typedef std::set<multi_action_name> multi_action_name_set; 37 : 38 : /// \brief Pretty print function for a multi action name 39 : inline 40 48 : std::string pp(const multi_action_name& x) 41 : { 42 48 : std::ostringstream out; 43 48 : if (x.empty()) 44 : { 45 0 : out << "tau"; 46 : } 47 : else 48 : { 49 96 : for (auto i = x.begin(); i != x.end(); ++i) 50 : { 51 48 : if (i != x.begin()) 52 : { 53 0 : out << " | "; 54 : } 55 48 : out << *i; 56 : } 57 : } 58 96 : return out.str(); 59 48 : } 60 : 61 : inline 62 : std::ostream& operator<<(std::ostream& out, const multi_action_name& alpha) 63 : { 64 : return out << pp(alpha); 65 : } 66 : 67 : /// \brief Pretty print function for a set of multi action names 68 : inline 69 12 : std::string pp(const multi_action_name_set& A) 70 : { 71 12 : std::ostringstream out; 72 12 : out << "{"; 73 60 : for (auto i = A.begin(); i != A.end(); ++i) 74 : { 75 48 : if (i != A.begin()) 76 : { 77 36 : out << ", "; 78 : } 79 48 : out << pp(*i); 80 : } 81 12 : out << "}"; 82 24 : return out.str(); 83 12 : } 84 : 85 : inline 86 : std::ostream& operator<<(std::ostream& out, const multi_action_name_set& A) 87 : { 88 : return out << pp(A); 89 : } 90 : 91 : } // namespace process 92 : 93 : } // namespace mcrl2 94 : 95 : #endif // MCRL2_PROCESS_MULTI_ACTION_NAME_H