Line data Source code
1 : // Author(s): Jeroen Keiren 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/container_sort.h 10 : /// \brief The class container_sort. 11 : 12 : #ifndef MCRL2_DATA_CONTAINER_SORT_H 13 : #define MCRL2_DATA_CONTAINER_SORT_H 14 : 15 : #include "mcrl2/data/container_type.h" 16 : #include "mcrl2/data/sort_expression.h" 17 : 18 : namespace mcrl2 19 : { 20 : 21 : namespace data 22 : { 23 : 24 : //--- start generated class container_sort ---// 25 : /// \\brief A container sort 26 : class container_sort: public sort_expression 27 : { 28 : public: 29 : /// \\brief Default constructor. 30 : container_sort() 31 : : sort_expression(core::detail::default_values::SortCons) 32 : {} 33 : 34 : /// \\brief Constructor. 35 : /// \\param term A term 36 3258019 : explicit container_sort(const atermpp::aterm& term) 37 3258019 : : sort_expression(term) 38 : { 39 3258019 : assert(core::detail::check_term_SortCons(*this)); 40 3258019 : } 41 : 42 : /// \\brief Constructor. 43 2473610 : container_sort(const container_type& container_name, const sort_expression& element_sort) 44 2473610 : : sort_expression(atermpp::aterm_appl(core::detail::function_symbol_SortCons(), container_name, element_sort)) 45 2473610 : {} 46 : 47 : /// Move semantics 48 : container_sort(const container_sort&) noexcept = default; 49 : container_sort(container_sort&&) noexcept = default; 50 : container_sort& operator=(const container_sort&) noexcept = default; 51 : container_sort& operator=(container_sort&&) noexcept = default; 52 : 53 1485272 : const container_type& container_name() const 54 : { 55 1485272 : return atermpp::down_cast<container_type>((*this)[0]); 56 : } 57 : 58 1793179 : const sort_expression& element_sort() const 59 : { 60 1793179 : return atermpp::down_cast<sort_expression>((*this)[1]); 61 : } 62 : }; 63 : 64 : /// \\brief Make_container_sort constructs a new term into a given address. 65 : /// \\ \param t The reference into which the new container_sort is constructed. 66 : template <class... ARGUMENTS> 67 748 : inline void make_container_sort(atermpp::aterm_appl& t, const ARGUMENTS&... args) 68 : { 69 748 : atermpp::make_term_appl(t, core::detail::function_symbol_SortCons(), args...); 70 748 : } 71 : 72 : // prototype declaration 73 : std::string pp(const container_sort& x); 74 : 75 : /// \\brief Outputs the object to a stream 76 : /// \\param out An output stream 77 : /// \\param x Object x 78 : /// \\return The output stream 79 : inline 80 0 : std::ostream& operator<<(std::ostream& out, const container_sort& x) 81 : { 82 0 : return out << data::pp(x); 83 : } 84 : 85 : /// \\brief swap overload 86 : inline void swap(container_sort& t1, container_sort& t2) 87 : { 88 : t1.swap(t2); 89 : } 90 : //--- end generated class container_sort ---// 91 : 92 : /// \brief list of function sorts 93 : /// 94 : typedef atermpp::term_list<container_sort> container_sort_list; 95 : 96 : /// \brief list of function sorts 97 : /// 98 : typedef std::vector<container_sort> container_sort_vector; 99 : 100 : } // namespace data 101 : 102 : } // namespace mcrl2 103 : 104 : #endif // MCRL2_DATA_CONTAINER_SORT_H 105 :