LCOV - code coverage report
Current view: top level - data/include/mcrl2/data/detail - data_construction.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 14 15 93.3 %
Date: 2024-04-19 03:43:27 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          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/detail/data_construction.h
      10             : /// \brief add your file description here.
      11             : 
      12             : #ifndef MCRL2_DATA_DETAIL_DATA_CONSTRUCTION_H
      13             : #define MCRL2_DATA_DETAIL_DATA_CONSTRUCTION_H
      14             : 
      15             : #include "mcrl2/data/lambda.h"
      16             : #include "mcrl2/data/set.h"
      17             : 
      18             : namespace mcrl2 {
      19             : 
      20             : namespace data {
      21             : 
      22             : namespace detail {
      23             : 
      24             : /// \brief Create the finite set { x }, with x a data expression.
      25             : inline
      26           6 : data_expression create_finite_set(const data_expression& x)
      27             : {
      28          12 :   data_expression result = data::sort_fset::empty(x.sort());
      29           6 :   result = data::sort_fset::insert(x.sort(), x, result);
      30           6 :   result = data::sort_set::set_fset(x.sort(), result);
      31           6 :   return result;
      32           0 : }
      33             : 
      34             : /// \brief Create the set { x | phi }, with phi a predicate that may depend on the variable x.
      35             : inline
      36           3 : data_expression create_set_comprehension(const variable& x, const data_expression& phi)
      37             : {
      38           3 :   assert(sort_bool::is_bool(phi.sort()));
      39           6 :   data_expression result = sort_set::constructor(x.sort(), lambda(x, phi), sort_fset::empty(x.sort()));
      40           3 :   return result;
      41             : }
      42             : 
      43             : /// \brief Create the predicate 'x in X', with X a set.
      44             : inline
      45          11 : data_expression create_set_in(const data_expression& x, const data_expression& X)
      46             : {
      47          22 :   data_expression result = sort_set::in(x.sort(), x, X);
      48          11 :   return result;
      49             : }
      50             : 
      51             : /// \brief Returns the sort s of Set(s).
      52             : /// \param x A set expression
      53             : inline
      54           3 : sort_expression get_set_sort(const container_sort& x)
      55             : {
      56           3 :   return x.element_sort();
      57             : }
      58             : 
      59             : } // namespace detail
      60             : 
      61             : } // namespace data
      62             : 
      63             : } // namespace mcrl2
      64             : 
      65             : #endif // MCRL2_DATA_DETAIL_DATA_CONSTRUCTION_H

Generated by: LCOV version 1.14