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/data/untyped_identifier.h 10 : /// \brief add your file description here. 11 : 12 : #ifndef MCRL2_DATA_UNTYPED_IDENTIFIER_H 13 : #define MCRL2_DATA_UNTYPED_IDENTIFIER_H 14 : 15 : #include "mcrl2/data/data_expression.h" 16 : 17 : namespace mcrl2 { 18 : 19 : namespace data { 20 : 21 : //--- start generated class untyped_identifier ---// 22 : /// \\brief An untyped identifier 23 : class untyped_identifier: public data_expression 24 : { 25 : public: 26 : /// \\brief Default constructor. 27 : untyped_identifier() 28 : : data_expression(core::detail::default_values::UntypedIdentifier) 29 : {} 30 : 31 : /// \\brief Constructor. 32 : /// \\param term A term 33 89049 : explicit untyped_identifier(const atermpp::aterm& term) 34 89049 : : data_expression(term) 35 : { 36 89049 : assert(core::detail::check_term_UntypedIdentifier(*this)); 37 89049 : } 38 : 39 : /// \\brief Constructor. 40 22605 : explicit untyped_identifier(const core::identifier_string& name) 41 22605 : : data_expression(atermpp::aterm_appl(core::detail::function_symbol_UntypedIdentifier(), name)) 42 22605 : {} 43 : 44 : /// \\brief Constructor. 45 259 : untyped_identifier(const std::string& name) 46 259 : : data_expression(atermpp::aterm_appl(core::detail::function_symbol_UntypedIdentifier(), core::identifier_string(name))) 47 259 : {} 48 : 49 : /// Move semantics 50 : untyped_identifier(const untyped_identifier&) noexcept = default; 51 : untyped_identifier(untyped_identifier&&) noexcept = default; 52 : untyped_identifier& operator=(const untyped_identifier&) noexcept = default; 53 : untyped_identifier& operator=(untyped_identifier&&) noexcept = default; 54 : 55 59937 : const core::identifier_string& name() const 56 : { 57 59937 : return atermpp::down_cast<core::identifier_string>((*this)[0]); 58 : } 59 : }; 60 : 61 : /// \\brief Make_untyped_identifier constructs a new term into a given address. 62 : /// \\ \param t The reference into which the new untyped_identifier is constructed. 63 : template <class... ARGUMENTS> 64 : inline void make_untyped_identifier(atermpp::aterm_appl& t, const ARGUMENTS&... args) 65 : { 66 : atermpp::make_term_appl(t, core::detail::function_symbol_UntypedIdentifier(), args...); 67 : } 68 : 69 : // prototype declaration 70 : std::string pp(const untyped_identifier& x); 71 : 72 : /// \\brief Outputs the object to a stream 73 : /// \\param out An output stream 74 : /// \\param x Object x 75 : /// \\return The output stream 76 : inline 77 : std::ostream& operator<<(std::ostream& out, const untyped_identifier& x) 78 : { 79 : return out << data::pp(x); 80 : } 81 : 82 : /// \\brief swap overload 83 : inline void swap(untyped_identifier& t1, untyped_identifier& t2) 84 : { 85 : t1.swap(t2); 86 : } 87 : //--- end generated class untyped_identifier ---// 88 : 89 : } // namespace data 90 : 91 : } // namespace mcrl2 92 : 93 : #endif // MCRL2_DATA_UNTYPED_IDENTIFIER_H