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/action_label.h 10 : /// \brief The class action_label. 11 : 12 : #ifndef MCRL2_PROCESS_ACTION_LABEL_H 13 : #define MCRL2_PROCESS_ACTION_LABEL_H 14 : 15 : #include "mcrl2/data/data_specification.h" 16 : 17 : namespace mcrl2 18 : { 19 : 20 : namespace process 21 : { 22 : 23 : //--- start generated class action_label ---// 24 : /// \\brief An action label 25 : class action_label: public atermpp::aterm_appl 26 : { 27 : public: 28 : /// \\brief Default constructor. 29 13590 : action_label() 30 13590 : : atermpp::aterm_appl(core::detail::default_values::ActId) 31 13590 : {} 32 : 33 : /// \\brief Constructor. 34 : /// \\param term A term 35 448473 : explicit action_label(const atermpp::aterm& term) 36 448473 : : atermpp::aterm_appl(term) 37 : { 38 448473 : assert(core::detail::check_term_ActId(*this)); 39 448473 : } 40 : 41 : /// \\brief Constructor. 42 14613 : action_label(const core::identifier_string& name, const data::sort_expression_list& sorts) 43 14613 : : atermpp::aterm_appl(core::detail::function_symbol_ActId(), name, sorts) 44 14613 : {} 45 : 46 : /// \\brief Constructor. 47 75 : action_label(const std::string& name, const data::sort_expression_list& sorts) 48 75 : : atermpp::aterm_appl(core::detail::function_symbol_ActId(), core::identifier_string(name), sorts) 49 75 : {} 50 : 51 : /// Move semantics 52 6266 : action_label(const action_label&) noexcept = default; 53 8872 : action_label(action_label&&) noexcept = default; 54 : action_label& operator=(const action_label&) noexcept = default; 55 : action_label& operator=(action_label&&) noexcept = default; 56 : 57 430008 : const core::identifier_string& name() const 58 : { 59 430008 : return atermpp::down_cast<core::identifier_string>((*this)[0]); 60 : } 61 : 62 58170 : const data::sort_expression_list& sorts() const 63 : { 64 58170 : return atermpp::down_cast<data::sort_expression_list>((*this)[1]); 65 : } 66 : }; 67 : 68 : /// \\brief Make_action_label constructs a new term into a given address. 69 : /// \\ \param t The reference into which the new action_label is constructed. 70 : template <class... ARGUMENTS> 71 2912 : inline void make_action_label(atermpp::aterm_appl& t, const ARGUMENTS&... args) 72 : { 73 2912 : atermpp::make_term_appl(t, core::detail::function_symbol_ActId(), args...); 74 2912 : } 75 : 76 : /// \\brief list of action_labels 77 : typedef atermpp::term_list<action_label> action_label_list; 78 : 79 : /// \\brief vector of action_labels 80 : typedef std::vector<action_label> action_label_vector; 81 : 82 : /// \\brief Test for a action_label expression 83 : /// \\param x A term 84 : /// \\return True if \\a x is a action_label expression 85 : inline 86 : bool is_action_label(const atermpp::aterm_appl& x) 87 : { 88 : return x.function() == core::detail::function_symbols::ActId; 89 : } 90 : 91 : // prototype declaration 92 : std::string pp(const action_label& 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 0 : std::ostream& operator<<(std::ostream& out, const action_label& x) 100 : { 101 0 : return out << process::pp(x); 102 : } 103 : 104 : /// \\brief swap overload 105 : inline void swap(action_label& t1, action_label& t2) 106 : { 107 : t1.swap(t2); 108 : } 109 : //--- end generated class action_label ---// 110 : 111 : // template function overloads 112 : std::string pp(const action_label_list& x); 113 : std::string pp(const action_label_vector& x); 114 : action_label_list normalize_sorts(const action_label_list& x, const data::sort_specification& sortspec); 115 : std::set<data::sort_expression> find_sort_expressions(const process::action_label_list& x); 116 : 117 : } // namespace process 118 : 119 : } // namespace mcrl2 120 : 121 : #endif // MCRL2_PROCESS_ACTION_LABEL_H