LCOV - code coverage report
Current view: top level - data/include/mcrl2/data - structured_sort_constructor_argument.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 21 25 84.0 %
Date: 2024-04-26 03:18:02 Functions: 11 16 68.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Author(s): Jeroen Keiren, Jeroen van der Wulp
       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/structured_sort_constructor_argument.h
      10             : /// \brief The class structured_sort_constructor_arguments.
      11             : 
      12             : #ifndef MCRL2_DATA_STRUCTURED_SORT_CONSTRUCTOR_ARGUMENT_H
      13             : #define MCRL2_DATA_STRUCTURED_SORT_CONSTRUCTOR_ARGUMENT_H
      14             : 
      15             : #include "mcrl2/data/function_symbol.h"
      16             : 
      17             : namespace mcrl2
      18             : {
      19             : 
      20             : namespace data
      21             : {
      22             : 
      23             : //--- start generated class structured_sort_constructor_argument ---//
      24             : /// \\brief An argument of a constructor of a structured sort
      25             : class structured_sort_constructor_argument: public atermpp::aterm_appl
      26             : {
      27             :   public:
      28             :     /// \\brief Default constructor.
      29           0 :     structured_sort_constructor_argument()
      30           0 :       : atermpp::aterm_appl(core::detail::default_values::StructProj)
      31           0 :     {}
      32             : 
      33             :     /// \\brief Constructor.
      34             :     /// \\param term A term
      35             :     explicit structured_sort_constructor_argument(const atermpp::aterm& term)
      36             :       : atermpp::aterm_appl(term)
      37             :     {
      38             :       assert(core::detail::check_term_StructProj(*this));
      39             :     }
      40             : 
      41             :     /// \\brief Constructor.
      42       26901 :     structured_sort_constructor_argument(const core::identifier_string& name, const sort_expression& sort)
      43       26901 :       : atermpp::aterm_appl(core::detail::function_symbol_StructProj(), name, sort)
      44       26901 :     {}
      45             : 
      46             :     /// \\brief Constructor.
      47             :     structured_sort_constructor_argument(const std::string& name, const sort_expression& sort)
      48             :       : atermpp::aterm_appl(core::detail::function_symbol_StructProj(), core::identifier_string(name), sort)
      49             :     {}
      50             : 
      51             :     /// Move semantics
      52           8 :     structured_sort_constructor_argument(const structured_sort_constructor_argument&) noexcept = default;
      53       29975 :     structured_sort_constructor_argument(structured_sort_constructor_argument&&) noexcept = default;
      54        3411 :     structured_sort_constructor_argument& operator=(const structured_sort_constructor_argument&) noexcept = default;
      55           0 :     structured_sort_constructor_argument& operator=(structured_sort_constructor_argument&&) noexcept = default;
      56             : 
      57       41563 :     const core::identifier_string& name() const
      58             :     {
      59       41563 :       return atermpp::down_cast<core::identifier_string>((*this)[0]);
      60             :     }
      61             : 
      62       60742 :     const sort_expression& sort() const
      63             :     {
      64       60742 :       return atermpp::down_cast<sort_expression>((*this)[1]);
      65             :     }
      66             : //--- start user section structured_sort_constructor_argument ---//
      67             :     /// \brief Constructor
      68             :     ///
      69             :     /// \param[in] sort The sort of the argument.
      70          11 :     structured_sort_constructor_argument(const sort_expression& sort)
      71          11 :       : atermpp::aterm_appl(core::detail::function_symbol_StructProj(), core::empty_identifier_string(), sort)
      72          11 :     {}
      73             : 
      74             :     /// \brief Constructor.
      75             :     ///
      76             :     /// \overload to work around problem that MSVC reinterprets char* or char[] as core::identifier_string
      77             :     template < std::size_t S >
      78           6 :     structured_sort_constructor_argument(const char(&name)[S], const sort_expression& sort)
      79           6 :       : atermpp::aterm_appl(core::detail::function_symbol_StructProj(), core::identifier_string(name), sort)
      80           6 :     {}
      81             : //--- end user section structured_sort_constructor_argument ---//
      82             : };
      83             : 
      84             : /// \\brief Make_structured_sort_constructor_argument constructs a new term into a given address.
      85             : /// \\ \param t The reference into which the new structured_sort_constructor_argument is constructed. 
      86             : template <class... ARGUMENTS>
      87        5813 : inline void make_structured_sort_constructor_argument(atermpp::aterm_appl& t, const ARGUMENTS&... args)
      88             : {
      89        5813 :   atermpp::make_term_appl(t, core::detail::function_symbol_StructProj(), args...);
      90        5813 : }
      91             : 
      92             : /// \\brief list of structured_sort_constructor_arguments
      93             : typedef atermpp::term_list<structured_sort_constructor_argument> structured_sort_constructor_argument_list;
      94             : 
      95             : /// \\brief vector of structured_sort_constructor_arguments
      96             : typedef std::vector<structured_sort_constructor_argument>    structured_sort_constructor_argument_vector;
      97             : 
      98             : /// \\brief Test for a structured_sort_constructor_argument expression
      99             : /// \\param x A term
     100             : /// \\return True if \\a x is a structured_sort_constructor_argument expression
     101             : inline
     102             : bool is_structured_sort_constructor_argument(const atermpp::aterm_appl& x)
     103             : {
     104             :   return x.function() == core::detail::function_symbols::StructProj;
     105             : }
     106             : 
     107             : // prototype declaration
     108             : std::string pp(const structured_sort_constructor_argument& x);
     109             : 
     110             : /// \\brief Outputs the object to a stream
     111             : /// \\param out An output stream
     112             : /// \\param x Object x
     113             : /// \\return The output stream
     114             : inline
     115          42 : std::ostream& operator<<(std::ostream& out, const structured_sort_constructor_argument& x)
     116             : {
     117          42 :   return out << data::pp(x);
     118             : }
     119             : 
     120             : /// \\brief swap overload
     121             : inline void swap(structured_sort_constructor_argument& t1, structured_sort_constructor_argument& t2)
     122             : {
     123             :   t1.swap(t2);
     124             : }
     125             : //--- end generated class structured_sort_constructor_argument ---//
     126             : 
     127             : } // namespace data
     128             : 
     129             : } // namespace mcrl2
     130             : 
     131             : #endif // MCRL2_DATA_STRUCTURED_SORT_CONSTRUCTOR_ARGUMENT_H
     132             : 

Generated by: LCOV version 1.14