Line data Source code
1 : // Author(s): Jeroen van der Wulp, Jan Friso Groote 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/enumeration.h 10 : /// \brief Template class for substitution 11 : 12 : 13 : 14 : #ifndef _MCRL2_DATA_DETAIL_REWRITER_WRAPPER_H 15 : #define _MCRL2_DATA_DETAIL_REWRITER_WRAPPER_H 16 : 17 : #include "mcrl2/data/rewriter.h" 18 : 19 : namespace mcrl2 20 : { 21 : namespace data 22 : { 23 : 24 : namespace detail 25 : { 26 : 27 : struct rewriter_wrapper 28 : { 29 : public: 30 : typedef Rewriter::substitution_type substitution_type; 31 : 32 : typedef data_expression term_type; 33 : 34 1144 : rewriter_wrapper(Rewriter* r): 35 1144 : m_rewriter(r) 36 1144 : {} 37 : 38 68648 : data_expression operator()(const data_expression& t, Rewriter::substitution_type& sigma) const 39 : { 40 68648 : return m_rewriter->rewrite(t,sigma); 41 : } 42 : 43 16 : void operator()(data_expression& result, const data_expression& t, Rewriter::substitution_type& sigma) const 44 : { 45 16 : return m_rewriter->rewrite(result, t, sigma); 46 : } 47 : 48 8 : data_expression operator()(const data_expression& t) const 49 : { 50 8 : Rewriter::substitution_type sigma; 51 16 : return m_rewriter->rewrite(t,sigma); 52 8 : } 53 : 54 : void operator()(data_expression& result, const data_expression& t) const 55 : { 56 : Rewriter::substitution_type sigma; 57 : m_rewriter->rewrite(result, t, sigma); 58 : } 59 : 60 : protected: 61 : Rewriter* m_rewriter; 62 : }; 63 : 64 : 65 : } // namespace detail 66 : } // namespace data 67 : } // namespace mcrl2 68 : 69 : #endif // _MCRL2_DATA_DETAIL_REWRITER_WRAPPER_H