mCRL2
Loading...
Searching...
No Matches
aterm_string.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//
9
10#ifndef MCRL2_ATERMPP_ATERM_STRING_H
11#define MCRL2_ATERMPP_ATERM_STRING_H
12
13#include "mcrl2/atermpp/aterm.h"
14
15namespace atermpp
16{
17
19class aterm_string: public aterm
20{
21public:
24 {}
25
28 explicit aterm_string(const aterm& t)
29 : aterm(t)
30 {
31 assert(size() == 0);
32 }
33
37 : aterm(f)
38 {
39 assert(f.arity() == 0);
40 assert(size() == 0);
41 }
42
45 aterm_string(const std::string& s)
47 {
48 assert(size() == 0);
49 }
50
53 aterm_string(const aterm_string& t) noexcept = default;
54
57 aterm_string(aterm_string&& t) noexcept = default;
58
61 aterm_string& operator=(const aterm_string& t) noexcept = default;
62
65 aterm_string& operator=(aterm_string&& t) noexcept = default;
66
69 operator const std::string&() const
70 {
71 return function().name();
72 }
73};
74
76inline
78{
79 static atermpp::aterm_string t("");
80 return t;
81}
82
83} // namespace atermpp
84
85
86namespace std
87{
88
96
97template <>
98inline void swap(atermpp::aterm_string& t1, atermpp::aterm_string& t2) noexcept
99{
100 t1.swap(t2);
101}
102} // namespace std
103
104#endif // MCRL2_ATERMPP_ATERM_STRING_H
The term_appl class represents function application.
Term containing a string.
aterm_string & operator=(aterm_string &&t) noexcept=default
aterm_string(const function_symbol &f)
Constructor.
aterm_string(const aterm &t)
Constructor.
aterm_string(const aterm_string &t) noexcept=default
aterm_string(const std::string &s)
Constructor that allows construction from a string.
aterm_string & operator=(const aterm_string &t) noexcept=default
aterm_string()
Default constructor.
aterm_string(aterm_string &&t) noexcept=default
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
Definition aterm.h:144
size_type size() const
Returns the number of arguments of this term.
Definition aterm.h:151
std::size_t arity() const
Return the arity (number of arguments) of the function symbol (function_symbol).
const std::string & name() const
Return the name of the function_symbol.
The main namespace for the aterm++ library.
Definition algorithm.h:21
const aterm_string & empty_string()
Returns the empty aterm_string.
STL namespace.
void swap(atermpp::unprotected_aterm_core &t1, atermpp::unprotected_aterm_core &t2) noexcept
Swaps two aterms.
Definition aterm.h:462