Line data Source code
1 : // Author(s): Wieger Wesselink, Jan Friso Groote, based on the aterm library. 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 : 10 : #ifndef MCRL2_ATERMPP_DETAIL_ATERM_INT_H 11 : #define MCRL2_ATERMPP_DETAIL_ATERM_INT_H 12 : 13 : #include "mcrl2/atermpp/detail/aterm.h" 14 : 15 : namespace atermpp 16 : { 17 : namespace detail 18 : { 19 : 20 : /// \brief The underlying integer term that actually carries the integer data. 21 : class _aterm_int : public _aterm 22 : { 23 : public: 24 : /// \brief Constructs the underlying term from a given value. 25 42904 : _aterm_int(std::size_t value) : 26 : _aterm(g_as_int), 27 42904 : m_value(value) 28 42904 : {} 29 : 30 21859196 : std::size_t value() const noexcept 31 : { 32 21859196 : return m_value; 33 : } 34 : 35 : private: 36 : std::size_t m_value; 37 : }; 38 : 39 : static_assert(sizeof(_aterm_int) == sizeof(_aterm) + sizeof(std::size_t), "Sanity check: _aterm_int size"); 40 : 41 : } // namespace detail 42 : 43 : } // namespace atermpp 44 : 45 : #endif // MCRL2_ATERMPP_DETAIL_ATERM_INT_H