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 lps/include/mcrl2/lps/rewrite.h 10 : /// \brief add your file description here. 11 : 12 : #ifndef MCRL2_LPS_REWRITE_H 13 : #define MCRL2_LPS_REWRITE_H 14 : 15 : #include "mcrl2/data/rewrite.h" 16 : #include "mcrl2/lps/builder.h" 17 : 18 : namespace mcrl2 { 19 : 20 : namespace lps { 21 : 22 : //--- start generated lps rewrite code ---// 23 : /// \\brief Rewrites all embedded expressions in an object x 24 : /// \\param x an object containing expressions 25 : /// \\param R a rewriter 26 : template <typename T, typename Rewriter> 27 735 : void rewrite(T& x, 28 : Rewriter R, 29 : typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr 30 : ) 31 : { 32 735 : data::detail::make_rewrite_data_expressions_builder<lps::data_expression_builder>(R).update(x); 33 735 : } 34 : 35 : /// \\brief Rewrites all embedded expressions in an object x 36 : /// \\param x an object containing expressions 37 : /// \\param R a rewriter 38 : /// \\return the rewrite result 39 : template <typename T, typename Rewriter> 40 : T rewrite(const T& x, 41 : Rewriter R, 42 : typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr 43 : ) 44 : { 45 : T result; 46 : data::detail::make_rewrite_data_expressions_builder<lps::data_expression_builder>(R).apply(result, x); 47 : return result; 48 : } 49 : 50 : /// \\brief Rewrites all embedded expressions in an object x, and applies a substitution to variables on the fly 51 : /// \\param x an object containing expressions 52 : /// \\param R a rewriter 53 : /// \\param sigma a substitution 54 : template <typename T, typename Rewriter, typename Substitution> 55 742 : void rewrite(T& x, 56 : Rewriter R, 57 : const Substitution& sigma, 58 : typename std::enable_if<!std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr 59 : ) 60 : { 61 742 : data::detail::make_rewrite_data_expressions_with_substitution_builder<lps::data_expression_builder>(R, sigma).update(x); 62 742 : } 63 : 64 : /// \\brief Rewrites all embedded expressions in an object x, and applies a substitution to variables on the fly 65 : /// \\param x an object containing expressions 66 : /// \\param R a rewriter 67 : /// \\param sigma a substitution 68 : /// \\return the rewrite result 69 : template <typename T, typename Rewriter, typename Substitution> 70 : T rewrite(const T& x, 71 : Rewriter R, 72 : const Substitution& sigma, 73 : typename std::enable_if<std::is_base_of<atermpp::aterm, T>::value>::type* = nullptr 74 : ) 75 : { 76 : T result; 77 : data::detail::make_rewrite_data_expressions_with_substitution_builder<lps::data_expression_builder>(R, sigma).apply(result, x); 78 : return result; 79 : } 80 : //--- end generated lps rewrite code ---// 81 : 82 : } // namespace lps 83 : 84 : } // namespace mcrl2 85 : 86 : #endif // MCRL2_LPS_REWRITE_H