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/communication_expression.h 10 : /// \brief add your file description here. 11 : 12 : #ifndef MCRL2_PROCESS_COMMUNICATION_EXPRESSION_H 13 : #define MCRL2_PROCESS_COMMUNICATION_EXPRESSION_H 14 : 15 : #include "mcrl2/process/action_name_multiset.h" 16 : 17 : namespace mcrl2 18 : { 19 : 20 : namespace process 21 : { 22 : 23 : //--- start generated class communication_expression ---// 24 : /// \\brief A communication expression 25 : class communication_expression: public atermpp::aterm_appl 26 : { 27 : public: 28 : /// \\brief Default constructor. 29 : communication_expression() 30 : : atermpp::aterm_appl(core::detail::default_values::CommExpr) 31 : {} 32 : 33 : /// \\brief Constructor. 34 : /// \\param term A term 35 : explicit communication_expression(const atermpp::aterm& term) 36 : : atermpp::aterm_appl(term) 37 : { 38 : assert(core::detail::check_term_CommExpr(*this)); 39 : } 40 : 41 : /// \\brief Constructor. 42 393 : communication_expression(const action_name_multiset& action_name, const core::identifier_string& name) 43 393 : : atermpp::aterm_appl(core::detail::function_symbol_CommExpr(), action_name, name) 44 393 : {} 45 : 46 : /// \\brief Constructor. 47 : communication_expression(const action_name_multiset& action_name, const std::string& name) 48 : : atermpp::aterm_appl(core::detail::function_symbol_CommExpr(), action_name, core::identifier_string(name)) 49 : {} 50 : 51 : /// Move semantics 52 0 : communication_expression(const communication_expression&) noexcept = default; 53 274 : communication_expression(communication_expression&&) noexcept = default; 54 : communication_expression& operator=(const communication_expression&) noexcept = default; 55 : communication_expression& operator=(communication_expression&&) noexcept = default; 56 : 57 46271 : const action_name_multiset& action_name() const 58 : { 59 46271 : return atermpp::down_cast<action_name_multiset>((*this)[0]); 60 : } 61 : 62 47058 : const core::identifier_string& name() const 63 : { 64 47058 : return atermpp::down_cast<core::identifier_string>((*this)[1]); 65 : } 66 : }; 67 : 68 : /// \\brief Make_communication_expression constructs a new term into a given address. 69 : /// \\ \param t The reference into which the new communication_expression is constructed. 70 : template <class... ARGUMENTS> 71 : inline void make_communication_expression(atermpp::aterm_appl& t, const ARGUMENTS&... args) 72 : { 73 : atermpp::make_term_appl(t, core::detail::function_symbol_CommExpr(), args...); 74 : } 75 : 76 : /// \\brief list of communication_expressions 77 : typedef atermpp::term_list<communication_expression> communication_expression_list; 78 : 79 : /// \\brief vector of communication_expressions 80 : typedef std::vector<communication_expression> communication_expression_vector; 81 : 82 : /// \\brief Test for a communication_expression expression 83 : /// \\param x A term 84 : /// \\return True if \\a x is a communication_expression expression 85 : inline 86 : bool is_communication_expression(const atermpp::aterm_appl& x) 87 : { 88 : return x.function() == core::detail::function_symbols::CommExpr; 89 : } 90 : 91 : // prototype declaration 92 : std::string pp(const communication_expression& x); 93 : 94 : /// \\brief Outputs the object to a stream 95 : /// \\param out An output stream 96 : /// \\param x Object x 97 : /// \\return The output stream 98 : inline 99 : std::ostream& operator<<(std::ostream& out, const communication_expression& x) 100 : { 101 : return out << process::pp(x); 102 : } 103 : 104 : /// \\brief swap overload 105 : inline void swap(communication_expression& t1, communication_expression& t2) 106 : { 107 : t1.swap(t2); 108 : } 109 : //--- end generated class communication_expression ---// 110 : 111 : } // namespace process 112 : 113 : } // namespace mcrl2 114 : 115 : #endif // MCRL2_PROCESS_COMMUNICATION_EXPRESSION_H