mCRL2
Loading...
Searching...
No Matches
function_symbol.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink, Jan Friso Groote
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_FUNCTION_SYMBOL_H
11#define MCRL2_ATERMPP_FUNCTION_SYMBOL_H
12
13#include <utility>
15
16namespace atermpp
17{
18namespace detail
19{
20class function_symbol_pool;
21class _aterm;
22}
23
25{
28 friend class detail::_aterm;
29
30 friend struct std::hash<function_symbol>;
31
32public:
33 function_symbol() = default;
34
36 function_symbol(const std::string& name, const std::size_t arity_)
37 : function_symbol(name, arity_, true)
38 {}
39
41 function_symbol(std::string&& name, const std::size_t arity_)
42 : function_symbol(std::forward<std::string>(name), arity_, true)
43 {}
44
46 function_symbol(const function_symbol& other) noexcept = default;
47 function_symbol& operator=(const function_symbol& other) noexcept = default;
48 function_symbol(function_symbol&& other) noexcept = default;
49 function_symbol& operator=(function_symbol&& other) noexcept = default;
50
51 bool defined() const
52 {
54 }
55
58 const std::string& name() const
59 {
60 return m_function_symbol->name();
61 }
62
65 std::size_t arity() const
66 {
67 return m_function_symbol->arity();
68 }
69
74 bool operator ==(const function_symbol& f) const
75 {
77 }
78
82 bool operator !=(const function_symbol& f) const
83 {
85 }
86
90 bool operator <(const function_symbol& f) const
91 {
93 }
94
98 bool operator >(const function_symbol& f) const
99 {
101 }
102
106 bool operator <=(const function_symbol& f) const
107 {
109 }
110
114 bool operator >=(const function_symbol& f) const
115 {
117 }
118
123 {
124 using std::swap;
126 }
127
128private:
131 : m_function_symbol(std::forward<detail::_function_symbol::ref>(f))
132 {}
133
135 function_symbol(const std::string& name, const std::size_t arity, const bool check_for_registered_functions);
136
138 function_symbol(std::string&& name, const std::size_t arity, const bool check_for_registered_functions);
139
141 void destroy();
142
145};
146
148{
149public:
152 global_function_symbol(const std::string& name, const std::size_t arity);
153};
154
155namespace detail
156{
162}
163
164} // namespace atermpp
165
166#endif // MCRL2_ATERMPP_FUNCTION_SYMBOL_H
A foundational class for function symbols.
This is the class to which an aterm points.
Definition aterm.h:48
This class stores a set of function symbols.
Generates unique function symbols with a given prefix.
bool operator!=(const function_symbol &f) const
Inequality test.
function_symbol(const std::string &name, const std::size_t arity_)
Defines a function symbol from a name and arity combination.
function_symbol & operator=(const function_symbol &other) noexcept=default
function_symbol(function_symbol &&other) noexcept=default
bool operator>=(const function_symbol &f) const
Comparison operation.
bool operator==(const function_symbol &f) const
Equality test.
function_symbol(detail::_function_symbol::ref &&f)
Constructor for internal use only.
bool operator<(const function_symbol &f) const
Comparison operation.
function_symbol(const function_symbol &other) noexcept=default
This class has non-trivial destructor so declare default copy and move operators.
void destroy()
Calls the function symbol pool to free our used memory.
void swap(function_symbol &f)
Swap this function with its argument.
function_symbol & operator=(function_symbol &&other) noexcept=default
std::size_t arity() const
Return the arity (number of arguments) of the function symbol (function_symbol).
function_symbol(std::string &&name, const std::size_t arity_)
Defines a function symbol from a name and arity combination.
detail::_function_symbol::ref m_function_symbol
The shared reference to the underlying function symbol.
const std::string & name() const
Return the name of the function_symbol.
bool operator>(const function_symbol &f) const
Comparison operation.
bool operator<=(const function_symbol &f) const
Comparison operation.
bool defined() const
Check whether the shared_reference has a valid reference.
function_symbol g_as_empty_list
function_symbol g_as_list
function_symbol g_as_int
These function symbols are used to indicate integer, list and empty list terms.
The main namespace for the aterm++ library.
Definition algorithm.h:21
STL namespace.
void swap(atermpp::unprotected_aterm &t1, atermpp::unprotected_aterm &t2) noexcept
Swaps two aterms.
Definition aterm.h:384