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/propositional_variable.h 10 : /// \brief The classes propositional_variable and propositional_variable_instantiation. 11 : 12 : #ifndef MCRL2_PBES_PROPOSITIONAL_VARIABLE_H 13 : #define MCRL2_PBES_PROPOSITIONAL_VARIABLE_H 14 : 15 : #include "mcrl2/core/print.h" 16 : #include "mcrl2/data/parse.h" 17 : 18 : namespace mcrl2 19 : { 20 : 21 : namespace pbes_system 22 : { 23 : 24 : //--- start generated class propositional_variable ---// 25 : /// \\brief A propositional variable declaration 26 : class propositional_variable: public atermpp::aterm_appl 27 : { 28 : public: 29 : /// \\brief Default constructor. 30 6461 : propositional_variable() 31 6461 : : atermpp::aterm_appl(core::detail::default_values::PropVarDecl) 32 6461 : {} 33 : 34 : /// \\brief Constructor. 35 : /// \\param term A term 36 0 : explicit propositional_variable(const atermpp::aterm& term) 37 0 : : atermpp::aterm_appl(term) 38 : { 39 0 : assert(core::detail::check_term_PropVarDecl(*this)); 40 0 : } 41 : 42 : /// \\brief Constructor. 43 3695 : propositional_variable(const core::identifier_string& name, const data::variable_list& parameters) 44 3695 : : atermpp::aterm_appl(core::detail::function_symbol_PropVarDecl(), name, parameters) 45 3695 : {} 46 : 47 : /// \\brief Constructor. 48 : propositional_variable(const std::string& name, const data::variable_list& parameters) 49 : : atermpp::aterm_appl(core::detail::function_symbol_PropVarDecl(), core::identifier_string(name), parameters) 50 : {} 51 : 52 : /// Move semantics 53 15480 : propositional_variable(const propositional_variable&) noexcept = default; 54 10815 : propositional_variable(propositional_variable&&) noexcept = default; 55 6457 : propositional_variable& operator=(const propositional_variable&) noexcept = default; 56 74 : propositional_variable& operator=(propositional_variable&&) noexcept = default; 57 : 58 50557 : const core::identifier_string& name() const 59 : { 60 50557 : return atermpp::down_cast<core::identifier_string>((*this)[0]); 61 : } 62 : 63 32519 : const data::variable_list& parameters() const 64 : { 65 32519 : return atermpp::down_cast<data::variable_list>((*this)[1]); 66 : } 67 : //--- start user section propositional_variable ---// 68 : 69 136 : explicit propositional_variable(const atermpp::aterm_string& name) 70 136 : : propositional_variable(name, data::variable_list()) 71 136 : {} 72 : 73 135 : explicit propositional_variable(const std::string& name) 74 135 : : propositional_variable(atermpp::aterm_string(name)) 75 135 : {} 76 : 77 : //--- end user section propositional_variable ---// 78 : }; 79 : 80 : /// \\brief Make_propositional_variable constructs a new term into a given address. 81 : /// \\ \param t The reference into which the new propositional_variable is constructed. 82 : template <class... ARGUMENTS> 83 2881 : inline void make_propositional_variable(atermpp::aterm_appl& t, const ARGUMENTS&... args) 84 : { 85 2881 : atermpp::make_term_appl(t, core::detail::function_symbol_PropVarDecl(), args...); 86 2881 : } 87 : 88 : /// \\brief list of propositional_variables 89 : typedef atermpp::term_list<propositional_variable> propositional_variable_list; 90 : 91 : /// \\brief vector of propositional_variables 92 : typedef std::vector<propositional_variable> propositional_variable_vector; 93 : 94 : /// \\brief Test for a propositional_variable expression 95 : /// \\param x A term 96 : /// \\return True if \\a x is a propositional_variable expression 97 : inline 98 14 : bool is_propositional_variable(const atermpp::aterm_appl& x) 99 : { 100 14 : return x.function() == core::detail::function_symbols::PropVarDecl; 101 : } 102 : 103 : // prototype declaration 104 : std::string pp(const propositional_variable& x); 105 : 106 : /// \\brief Outputs the object to a stream 107 : /// \\param out An output stream 108 : /// \\param x Object x 109 : /// \\return The output stream 110 : inline 111 0 : std::ostream& operator<<(std::ostream& out, const propositional_variable& x) 112 : { 113 0 : return out << pbes_system::pp(x); 114 : } 115 : 116 : /// \\brief swap overload 117 : inline void swap(propositional_variable& t1, propositional_variable& t2) 118 : { 119 : t1.swap(t2); 120 : } 121 : //--- end generated class propositional_variable ---// 122 : 123 : // template function overloads 124 : std::string pp(const propositional_variable_list& x); 125 : std::string pp(const propositional_variable_vector& x); 126 : 127 : } // namespace pbes_system 128 : 129 : } // namespace mcrl2 130 : 131 : #endif // MCRL2_PBES_PROPOSITIONAL_VARIABLE_H