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/detail/equal_sorts.h 10 : /// \brief add your file description here. 11 : 12 : #ifndef MCRL2_DATA_DETAIL_EQUAL_SORTS_H 13 : #define MCRL2_DATA_DETAIL_EQUAL_SORTS_H 14 : 15 : #include "mcrl2/data/data_specification.h" 16 : 17 : namespace mcrl2 { 18 : 19 : namespace data { 20 : 21 : namespace detail { 22 : 23 : /// \brief Checks if the sorts of the variables/expressions in both lists are equal. 24 : /// \param v A sequence of data variables 25 : /// \param w A sequence of data expressions 26 : /// \return True if the sorts match pairwise 27 : inline 28 2742 : bool equal_sorts(const data::variable_list& v, const data::data_expression_list& w, const data::data_specification& data_spec) 29 : { 30 2742 : if (v.size() != w.size()) 31 : { 32 0 : return false; 33 : } 34 2742 : data::variable_list::iterator i = v.begin(); 35 2742 : data::data_expression_list::iterator j = w.begin(); 36 26439 : for (; i != v.end(); ++i, ++j) 37 : { 38 23697 : if (!data_spec.equal_sorts(i->sort(), j->sort())) 39 : { 40 0 : return false; 41 : } 42 : } 43 2742 : return true; 44 : } 45 : 46 : } // namespace detail 47 : 48 : } // namespace data 49 : 50 : } // namespace mcrl2 51 : 52 : #endif // MCRL2_DATA_DETAIL_EQUAL_SORTS_H