LCOV - code coverage report
Current view: top level - bes/include/mcrl2/bes - boolean_equation.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 25 25 100.0 %
Date: 2020-10-20 00:45:57 Functions: 15 15 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/boolean_equation.h
      10             : /// \brief add your file description here.
      11             : 
      12             : #ifndef MCRL2_BES_BOOLEAN_EQUATION_H
      13             : #define MCRL2_BES_BOOLEAN_EQUATION_H
      14             : 
      15             : #include "mcrl2/bes/boolean_expression.h"
      16             : #include "mcrl2/pbes/fixpoint_symbol.h"
      17             : 
      18             : namespace mcrl2
      19             : {
      20             : 
      21             : namespace bes
      22             : {
      23             : 
      24             : /// \brief The fixpoint symbol type
      25             : typedef pbes_system::fixpoint_symbol fixpoint_symbol;
      26             : 
      27             : /// \brief boolean equation.
      28             : // <BooleanEquation>   ::= BooleanEquation(<FixPoint>, <BooleanVariable>, <BooleanExpression>)
      29        1622 : class boolean_equation
      30             : {
      31             :   protected:
      32             :     /// \brief The fixpoint symbol of the equation
      33             :     fixpoint_symbol m_symbol;
      34             : 
      35             :     /// \brief The predicate variable of the equation
      36             :     boolean_variable   m_variable;
      37             : 
      38             :     /// \brief The formula of the equation
      39             :     boolean_expression m_formula;
      40             : 
      41             :   public:
      42             :     /// \brief The expression type of the equation.
      43             :     typedef boolean_expression term_type;
      44             : 
      45             :     /// \brief The variable type of the equation.
      46             :     typedef boolean_variable variable_type;
      47             : 
      48             :     /// \brief The symbol type of the equation.
      49             :     typedef fixpoint_symbol symbol_type;
      50             : 
      51             :     /// \brief Constructor.
      52           3 :     boolean_equation()
      53           3 :     {}
      54             : 
      55             :     /// \brief Constructor.
      56             :     /// \brief Constructor.
      57             :     /// \param t A term
      58             :     boolean_equation(const atermpp::aterm_appl &t)
      59             :     {
      60             :       assert(core::detail::check_rule_BooleanEquation(t));
      61             :       atermpp::aterm_appl::iterator i = t.begin();
      62             :       m_symbol   = fixpoint_symbol(*i++);
      63             :       atermpp::aterm_appl var = atermpp::down_cast<atermpp::aterm_appl>(*i++);
      64             :       m_variable = boolean_variable(var);
      65             :       m_formula  = boolean_expression(*i);
      66             :     }
      67             : 
      68             :     /// \brief Constructor.
      69             :     /// \param symbol A fixpoint symbol
      70             :     /// \param variable A boolean variable
      71             :     /// \param expr A boolean expression
      72         198 :     boolean_equation(fixpoint_symbol symbol, boolean_variable variable, boolean_expression expr)
      73         198 :       : m_symbol(symbol),
      74             :         m_variable(variable),
      75         198 :         m_formula(expr)
      76             :     {
      77         198 :     }
      78             : 
      79             :     /// \brief Returns the fixpoint symbol of the equation.
      80             :     /// \return The fixpoint symbol of the equation.
      81         130 :     const fixpoint_symbol& symbol() const
      82             :     {
      83         130 :       return m_symbol;
      84             :     }
      85             : 
      86             :     /// \brief Returns the fixpoint symbol of the equation.
      87             :     /// \return The fixpoint symbol of the equation.
      88          17 :     fixpoint_symbol& symbol()
      89             :     {
      90          17 :       return m_symbol;
      91             :     }
      92             : 
      93             :     /// \brief Returns the boolean_equation_system variable of the equation.
      94             :     /// \return The boolean_equation_system variable of the equation.
      95        1480 :     const boolean_variable& variable() const
      96             :     {
      97        1480 :       return m_variable;
      98             :     }
      99             : 
     100             :     /// \brief Returns the boolean_equation_system variable of the equation.
     101             :     /// \return The boolean_equation_system variable of the equation.
     102          44 :     boolean_variable& variable()
     103             :     {
     104          44 :       return m_variable;
     105             :     }
     106             : 
     107             :     /// \brief Returns the predicate formula on the right hand side of the equation.
     108             :     /// \return The predicate formula on the right hand side of the equation.
     109         113 :     const boolean_expression& formula() const
     110             :     {
     111         113 :       return m_formula;
     112             :     }
     113             : 
     114             :     /// \brief Returns the predicate formula on the right hand side of the equation.
     115             :     /// \return The predicate formula on the right hand side of the equation.
     116          69 :     boolean_expression& formula()
     117             :     {
     118          69 :       return m_formula;
     119             :     }
     120             : 
     121             :     /// \brief Swaps the contents
     122             :     void swap(boolean_equation& other)
     123             :     {
     124             :       using std::swap;
     125             :       swap(m_symbol, other.m_symbol);
     126             :       swap(m_variable, other.m_variable);
     127             :       swap(m_formula, other.m_formula);
     128             :     }
     129             : };
     130             : 
     131             : //--- start generated class boolean_equation ---//
     132             : // prototype declaration
     133             : std::string pp(const boolean_equation& x);
     134             : 
     135             : /// \brief Outputs the object to a stream
     136             : /// \param out An output stream
     137             : /// \param x Object x
     138             : /// \return The output stream
     139             : inline
     140             : std::ostream& operator<<(std::ostream& out, const boolean_equation& x)
     141             : {
     142             :   return out << bes::pp(x);
     143             : }
     144             : 
     145             : /// \brief swap overload
     146             : inline void swap(boolean_equation& t1, boolean_equation& t2)
     147             : {
     148             :   t1.swap(t2);
     149             : }
     150             : //--- end generated class boolean_equation ---//
     151             : 
     152             : /// \brief equality operator
     153             : inline bool
     154           2 : operator==(const boolean_equation& x, const boolean_equation& y)
     155             : {
     156           4 :   return x.symbol() == y.symbol() &&
     157           4 :          x.variable() == y.variable() &&
     158           4 :          x.formula() == y.formula();
     159             : }
     160             : 
     161             : /// \brief inequality operator
     162             : inline bool
     163             : operator!=(const boolean_equation& x, const boolean_equation& y)
     164             : {
     165             :   return !(x == y);
     166             : }
     167             : 
     168             : /// \brief less operator
     169             : inline bool
     170         672 : operator<(const boolean_equation& x, const boolean_equation& y)
     171             : {
     172         672 :   return x.variable() < y.variable();
     173             : }
     174             : 
     175             : } // namespace bes
     176             : 
     177             : } // namespace mcrl2
     178             : 
     179             : #endif // MCRL2_BES_BOOLEAN_EQUATION_H

Generated by: LCOV version 1.13