mCRL2
Loading...
Searching...
No Matches
aterm_int.h
Go to the documentation of this file.
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//
11
12#ifndef MCRL2_ATERMPP_ATERM_INT_H
13#define MCRL2_ATERMPP_ATERM_INT_H
14
15#include "mcrl2/atermpp/aterm.h"
17
18namespace atermpp
19{
20
25class aterm_int : public aterm
26{
27public:
29 aterm_int() noexcept
30 {}
31
34 explicit aterm_int(std::size_t value)
35 {
37 }
38
40 explicit aterm_int(const aterm& t)
41 : aterm(t)
42 {
43 assert(type_is_int() || !defined());
44 }
45
47 aterm_int(const aterm_int& other) noexcept = default;
48 aterm_int& operator=(const aterm_int& other) noexcept = default;
49 aterm_int(aterm_int&& other) noexcept = default;
50 aterm_int& operator=(aterm_int&& other) noexcept = default;
51
54 std::size_t value() const noexcept
55 {
56 return reinterpret_cast<const detail::_aterm_int*>(m_term)->value();
57 }
58
61 void swap(aterm_int& t) noexcept
62 {
63 aterm::swap(t);
64 }
65};
66
69inline void make_aterm_int(aterm_int& target, std::size_t value)
70{
72}
73
74} // namespace atermpp
75
76namespace std
77{
78
86template <>
87inline void swap(atermpp::aterm_int& t1, atermpp::aterm_int& t2) noexcept
88{
89 t1.swap(t2);
90}
91} // namespace std
92
93#endif // MCRL2_ATERMPP_ATERM_INT_H
The term_appl class represents function application.
An integer term stores a single std::size_t value. It carries no arguments.
Definition aterm_int.h:26
aterm_int(std::size_t value)
Constructs an integer term from a value.
Definition aterm_int.h:34
aterm_int & operator=(aterm_int &&other) noexcept=default
aterm_int(const aterm &t)
Constructs an integer term from an aterm.
Definition aterm_int.h:40
aterm_int() noexcept
Default constructor.
Definition aterm_int.h:29
aterm_int & operator=(const aterm_int &other) noexcept=default
aterm_int(const aterm_int &other) noexcept=default
This class has user-declared copy constructor so declare default copy and move operators.
std::size_t value() const noexcept
Provide the value stored in an aterm.
Definition aterm_int.h:54
void swap(aterm_int &t) noexcept
Swaps two integer terms without changing the protection.
Definition aterm_int.h:61
aterm_int(aterm_int &&other) noexcept=default
The underlying integer term that actually carries the integer data.
Definition aterm_int.h:22
void create_int(aterm &term, std::size_t val)
void swap(unprotected_aterm_core &t) noexcept
Swaps this term with its argument.
Definition aterm_core.h:152
bool defined() const
Returns true if this term is not equal to the term assigned by the default constructor of aterms,...
Definition aterm_core.h:143
const detail::_aterm * m_term
Definition aterm_core.h:36
bool type_is_int() const noexcept
Dynamic check whether the term is an aterm_int.
Definition aterm_core.h:63
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
The main namespace for the aterm++ library.
Definition algorithm.h:21
void make_aterm_int(aterm_int &target, std::size_t value)
Constructs an integer term from a value.
Definition aterm_int.h:69
STL namespace.
void swap(atermpp::unprotected_aterm_core &t1, atermpp::unprotected_aterm_core &t2) noexcept
Swaps two aterms.
Definition aterm.h:462