Line data Source code
1 : // Author(s): Wieger Wesselink, Jan Friso Groote. Based on the aterm library by Paul Klint and others. 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/atermpp/detail/function_symbol.h 10 : /// \brief A foundational class for function symbols. 11 : 12 : #ifndef DETAIL_FUNCTION_SYMBOL_H 13 : #define DETAIL_FUNCTION_SYMBOL_H 14 : 15 : #include <string> 16 : #include <cstddef> 17 : 18 : #include "mcrl2/utilities/noncopyable.h" 19 : #include "mcrl2/utilities/shared_reference.h" 20 : #include "mcrl2/atermpp/detail/aterm_configuration.h" 21 : 22 : 23 : namespace atermpp 24 : { 25 : namespace detail 26 : { 27 : 28 : /// \brief Stores the data for a function symbol (name, arity) pair. 29 : class _function_symbol : public mcrl2::utilities::shared_reference_counted<_function_symbol, mcrl2::utilities::detail::GlobalThreadSafe>, private mcrl2::utilities::noncopyable 30 : { 31 : public: 32 : /// \brief A shared reference for this object. 33 : using ref = mcrl2::utilities::shared_reference<const _function_symbol>; 34 : 35 77713 : _function_symbol(const std::string& name, std::size_t arity) : 36 77713 : m_arity(arity), 37 77713 : m_name(name) 38 77713 : {} 39 : 40 59229348 : const std::string& name() const noexcept 41 : { 42 59229348 : return m_name; 43 : } 44 : 45 13114560043 : std::size_t arity() const noexcept 46 : { 47 13114560043 : return m_arity; 48 : } 49 : 50 : bool operator==(const _function_symbol& f) const noexcept 51 : { 52 : return m_arity == f.m_arity && m_name == f.m_name; 53 : } 54 : 55 : private: 56 : const std::size_t m_arity; 57 : const std::string m_name; 58 : }; 59 : 60 : } // namespace detail 61 : } // namespace atermpp 62 : 63 : #endif // DETAIL_FUNCTION_SYMBOL_H 64 :