LCOV - code coverage report
Current view: top level - data/include/mcrl2/data - alias.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 21 25 84.0 %
Date: 2024-04-21 03:44:01 Functions: 10 12 83.3 %
Legend: Lines: hit not hit

          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/alias.h
      10             : /// \brief The class alias.
      11             : 
      12             : #ifndef MCRL2_DATA_ALIAS_H
      13             : #define MCRL2_DATA_ALIAS_H
      14             : 
      15             : #include "mcrl2/data/basic_sort.h"
      16             : 
      17             : namespace mcrl2
      18             : {
      19             : 
      20             : namespace data
      21             : {
      22             : 
      23             : //--- start generated class alias ---//
      24             : /// \\brief A sort alias
      25             : class alias: public atermpp::aterm_appl
      26             : {
      27             :   public:
      28             :     /// \\brief Default constructor.
      29          42 :     alias()
      30          42 :       : atermpp::aterm_appl(core::detail::default_values::SortRef)
      31          42 :     {}
      32             : 
      33             :     /// \\brief Constructor.
      34             :     /// \\param term A term
      35         567 :     explicit alias(const atermpp::aterm& term)
      36         567 :       : atermpp::aterm_appl(term)
      37             :     {
      38         567 :       assert(core::detail::check_term_SortRef(*this));
      39         567 :     }
      40             : 
      41             :     /// \\brief Constructor.
      42        1140 :     alias(const basic_sort& name, const sort_expression& reference)
      43        1140 :       : atermpp::aterm_appl(core::detail::function_symbol_SortRef(), name, reference)
      44        1140 :     {}
      45             : 
      46             :     /// Move semantics
      47        8974 :     alias(const alias&) noexcept = default;
      48        1492 :     alias(alias&&) noexcept = default;
      49        1383 :     alias& operator=(const alias&) noexcept = default;
      50           0 :     alias& operator=(alias&&) noexcept = default;
      51             : 
      52       36346 :     const basic_sort& name() const
      53             :     {
      54       36346 :       return atermpp::down_cast<basic_sort>((*this)[0]);
      55             :     }
      56             : 
      57       25066 :     const sort_expression& reference() const
      58             :     {
      59       25066 :       return atermpp::down_cast<sort_expression>((*this)[1]);
      60             :     }
      61             : };
      62             : 
      63             : /// \\brief Make_alias constructs a new term into a given address.
      64             : /// \\ \param t The reference into which the new alias is constructed. 
      65             : template <class... ARGUMENTS>
      66           0 : inline void make_alias(atermpp::aterm_appl& t, const ARGUMENTS&... args)
      67             : {
      68           0 :   atermpp::make_term_appl(t, core::detail::function_symbol_SortRef(), args...);
      69           0 : }
      70             : 
      71             : /// \\brief list of aliass
      72             : typedef atermpp::term_list<alias> alias_list;
      73             : 
      74             : /// \\brief vector of aliass
      75             : typedef std::vector<alias>    alias_vector;
      76             : 
      77             : /// \\brief Test for a alias expression
      78             : /// \\param x A term
      79             : /// \\return True if \\a x is a alias expression
      80             : inline
      81      150082 : bool is_alias(const atermpp::aterm_appl& x)
      82             : {
      83      150082 :   return x.function() == core::detail::function_symbols::SortRef;
      84             : }
      85             : 
      86             : // prototype declaration
      87             : std::string pp(const alias& x);
      88             : 
      89             : /// \\brief Outputs the object to a stream
      90             : /// \\param out An output stream
      91             : /// \\param x Object x
      92             : /// \\return The output stream
      93             : inline
      94           9 : std::ostream& operator<<(std::ostream& out, const alias& x)
      95             : {
      96           9 :   return out << data::pp(x);
      97             : }
      98             : 
      99             : /// \\brief swap overload
     100             : inline void swap(alias& t1, alias& t2)
     101             : {
     102             :   t1.swap(t2);
     103             : }
     104             : //--- end generated class alias ---//
     105             : 
     106             : } // namespace data
     107             : 
     108             : } // namespace mcrl2
     109             : 
     110             : #endif // MCRL2_DATA_ALIAS_H
     111             : 

Generated by: LCOV version 1.14