LCOV - code coverage report
Current view: top level - data/include/mcrl2/data - lambda.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 17 19 89.5 %
Date: 2024-04-17 03:40:49 Functions: 15 76 19.7 %
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/lambda.h
      10             : /// \brief The class lambda.
      11             : 
      12             : #ifndef MCRL2_DATA_LAMBDA_H
      13             : #define MCRL2_DATA_LAMBDA_H
      14             : 
      15             : #include "mcrl2/data/abstraction.h"
      16             : #include "mcrl2/data/application.h"
      17             : 
      18             : namespace mcrl2
      19             : {
      20             : 
      21             : namespace data
      22             : {
      23             : 
      24             : /// \brief function symbol.
      25             : ///
      26             : class lambda: public abstraction
      27             : {
      28             :   public:
      29             :     /// Constructor.
      30           6 :     lambda()
      31           6 :     {}
      32             : 
      33             :     /// Constructor.
      34             :     ///
      35             :     /// \param[in] d An aterm.
      36             :     /// \pre d is a lambda abstraction.
      37        5017 :     explicit lambda(const aterm& d)
      38        5017 :       : abstraction(d)
      39             :     {
      40        5017 :       assert(is_abstraction(d));
      41        5017 :       assert(static_cast<abstraction>(d).binding_operator() == lambda_binder());
      42        5017 :     }
      43             : 
      44             :     /// Constructor.
      45             :     ///
      46             :     /// \param[in] variable A nonempty list of binding variables.
      47             :     /// \param[in] body The body of the lambda abstraction.
      48             :     /// \pre variables is not empty.
      49          19 :     lambda(const variable& variable,
      50             :            const data_expression& body)
      51          38 :       : abstraction(lambda_binder(), { variable }, body)
      52             :     {
      53          19 :     }
      54             : 
      55             :     /// Constructor.
      56             :     ///
      57             :     /// \param[in] variables A nonempty list of binding variables (objects of type variable).
      58             :     /// \param[in] body The body of the lambda abstraction.
      59             :     /// \pre variables is not empty.
      60             :     template < typename Container >
      61          94 :     lambda(const Container& variables,
      62             :            const data_expression& body,
      63             :            typename atermpp::enable_if_container< Container, variable >::type* = nullptr)
      64          94 :       : abstraction(lambda_binder(), variables, body)
      65             :     {
      66          94 :       assert(!variables.empty());
      67          94 :     }
      68             : 
      69             :     /// Move semantics
      70             :     lambda(const lambda&) noexcept = default;
      71             :     lambda(lambda&&) noexcept = default;
      72             :     lambda& operator=(const lambda&) noexcept = default;
      73             :     lambda& operator=(lambda&&) noexcept = default;
      74             : 
      75             : }; // class lambda
      76             : 
      77             : template <class... ARGUMENTS>
      78        2237 : void make_lambda(atermpp::aterm& result, ARGUMENTS... arguments)
      79             : {
      80        2237 :   make_abstraction(result, lambda_binder(), arguments...);
      81        2237 : }
      82             : 
      83             : 
      84             : //--- start generated class lambda ---//
      85             : // prototype declaration
      86             : std::string pp(const lambda& x);
      87             : 
      88             : /// \\brief Outputs the object to a stream
      89             : /// \\param out An output stream
      90             : /// \\param x Object x
      91             : /// \\return The output stream
      92             : inline
      93           0 : std::ostream& operator<<(std::ostream& out, const lambda& x)
      94             : {
      95           0 :   return out << data::pp(x);
      96             : }
      97             : 
      98             : /// \\brief swap overload
      99             : inline void swap(lambda& t1, lambda& t2)
     100             : {
     101             :   t1.swap(t2);
     102             : }
     103             : //--- end generated class lambda ---//
     104             : 
     105             : } // namespace data
     106             : 
     107             : } // namespace mcrl2
     108             : 
     109             : #endif // MCRL2_DATA_LAMBDA_H
     110             : 

Generated by: LCOV version 1.14