LCOV - code coverage report
Current view: top level - data/include/mcrl2/data - substitution_utility.h (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 11 11 100.0 %
Date: 2024-04-13 03:38:08 Functions: 4 5 80.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/substitution_utility.h
      10             : /// \brief add your file description here.
      11             : 
      12             : #ifndef MCRL2_DATA_SUBSTITUTION_UTILITY_H
      13             : #define MCRL2_DATA_SUBSTITUTION_UTILITY_H
      14             : 
      15             : #include "mcrl2/data/variable.h"
      16             : #include "mcrl2/data/substitutions/mutable_indexed_substitution.h"
      17             : 
      18             : namespace mcrl2 {
      19             : 
      20             : namespace data {
      21             : 
      22             : /// \brief Adds assignments [v := e] to the substitution sigma for each variable in v.
      23             : template <typename VariableSequence, typename DataExpressionSequence>
      24             : inline
      25        5065 : void add_assignments(data::mutable_indexed_substitution<>& sigma, const VariableSequence& v, const DataExpressionSequence& e)
      26             : {
      27        5065 :   assert(v.size() <= e.size());
      28        5065 :   auto vi = v.begin();
      29        5065 :   auto ei = e.begin();
      30       58977 :   for (; vi != v.end(); ++vi, ++ei)
      31             :   {
      32       53912 :     sigma[*vi] = *ei;
      33             :   }
      34        5065 : }
      35             : 
      36             : /// \brief Removes assignments to variables in v from the substitution sigma
      37             : template <typename VariableSequence>
      38             : inline
      39        4582 : void remove_assignments(data::mutable_indexed_substitution<>& sigma, const VariableSequence& v)
      40             : {
      41       52695 :   for (const data::variable& vi: v)
      42             :   {
      43       43531 :     sigma[vi] = vi;
      44             :   }
      45        4582 : }
      46             : 
      47             : } // namespace data
      48             : 
      49             : } // namespace mcrl2
      50             : 
      51             : #endif // MCRL2_DATA_SUBSTITUTION_UTILITY_H

Generated by: LCOV version 1.14