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/enumerator_iteration_limit.h 10 : /// \brief Stores a static variable that indicates the number of iterations 11 : /// allowed during enumeration 12 : 13 : #ifndef MCRL2_DATA_DETAIL_ENUMERATOR_ITERATION_LIMIT_H 14 : #define MCRL2_DATA_DETAIL_ENUMERATOR_ITERATION_LIMIT_H 15 : 16 : #include <cstddef> 17 : 18 : namespace mcrl2 { 19 : 20 : namespace data { 21 : 22 : namespace detail { 23 : 24 : // Stores the maximum number of iterations that may be performed during enumeration. 25 : template <class T> // note, T is only a dummy 26 : struct enumerator_iteration_limit 27 : { 28 : static std::size_t max_enumerator_iterations; 29 : }; 30 : 31 : // Initialization 32 : template <class T> 33 : std::size_t enumerator_iteration_limit<T>::max_enumerator_iterations = 1000; 34 : 35 : inline 36 1 : void set_enumerator_iteration_limit(std::size_t size) 37 : { 38 1 : enumerator_iteration_limit<std::size_t>::max_enumerator_iterations = size; 39 1 : } 40 : 41 : inline 42 323 : std::size_t get_enumerator_iteration_limit() 43 : { 44 323 : return enumerator_iteration_limit<std::size_t>::max_enumerator_iterations; 45 : } 46 : 47 : } // namespace detail 48 : 49 : } // namespace data 50 : 51 : } // namespace mcrl2 52 : 53 : #endif // MCRL2_DATA_DETAIL_ENUMERATOR_ITERATION_LIMIT_H