LCOV - code coverage report
Current view: top level - bes/include/mcrl2/bes - pbesinst_conversion.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 13 13 100.0 %
Date: 2020-10-20 00:45:57 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/bes/pbesinst_conversion.h
      10             : /// \brief add your file description here.
      11             : 
      12             : #ifndef MCRL2_BES_PBESINST_CONVERSION_H
      13             : #define MCRL2_BES_PBESINST_CONVERSION_H
      14             : 
      15             : #include "mcrl2/bes/boolean_equation_system.h"
      16             : #include "mcrl2/bes/detail/pbes_expression2boolean_expression_traverser.h"
      17             : #include "mcrl2/pbes/algorithms.h"
      18             : 
      19             : namespace mcrl2
      20             : {
      21             : 
      22             : namespace bes
      23             : {
      24             : 
      25             : /// \brief Converts a propositional variable into a boolean variable
      26             : /// \param v A propositional variable
      27             : inline
      28           1 : bes::boolean_variable pbesinst_conversion(const pbes_system::propositional_variable_instantiation& v)
      29             : {
      30           1 :   return bes::boolean_variable(v.name());
      31             : }
      32             : 
      33             : /// \brief Converts a PBES expression into a boolean expression
      34             : /// \param x A PBES expression
      35             : inline
      36           2 : bes::boolean_expression pbesinst_conversion(const pbes_system::pbes_expression& x)
      37             : {
      38           2 :   return bes::pbes_expression2boolean_expression(x);
      39             : }
      40             : 
      41             : /// \brief Converts a PBES equation into a boolean equation
      42             : /// \param eq A PBES equation
      43             : inline
      44           2 : bes::boolean_equation pbesinst_conversion(const pbes_system::pbes_equation& eq)
      45             : {
      46           2 :   return bes::boolean_equation(eq.symbol(), bes::boolean_variable(eq.variable().name()), pbesinst_conversion(eq.formula()));
      47             : }
      48             : 
      49             : /// \brief Converts a PBES into a BES
      50             : /// \param p A PBES
      51             : /// \pre The PBES must be a BES
      52             : inline
      53           1 : bes::boolean_equation_system pbesinst_conversion(const pbes_system::pbes& p)
      54             : {
      55           1 :   assert(pbes_system::algorithms::is_bes(p));
      56             : 
      57           2 :   std::vector<bes::boolean_equation> equations;
      58           3 :   for (const pbes_system::pbes_equation& eqn: p.equations())
      59             :   {
      60           2 :     equations.push_back(pbesinst_conversion(eqn));
      61             :   }
      62           2 :   bes::boolean_expression initial_state = pbesinst_conversion(p.initial_state());
      63             : 
      64           2 :   return bes::boolean_equation_system(equations, initial_state);
      65             : }
      66             : 
      67             : } // namespace bes
      68             : 
      69             : } // namespace mcrl2
      70             : 
      71             : #endif // MCRL2_BES_PBESINST_CONVERSION_H

Generated by: LCOV version 1.13