mCRL2
Loading...
Searching...
No Matches
aterm_list.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_ATERM_LIST_H
11#define MCRL2_ATERMPP_ATERM_LIST_H
12
13#include "mcrl2/atermpp/aterm.h"
14#include "mcrl2/atermpp/detail/aterm_list.h"
15#include "mcrl2/atermpp/detail/aterm_list_iterator.h"
16#include "mcrl2/atermpp/type_traits.h"
17#include <ranges>
18#include <type_traits>
19
20namespace atermpp
21{
22
23/// \brief A list of aterm objects.
24template <typename Term>
25class term_list: public aterm
26{
27protected:
28 /// \brief Constructor for term lists from internally constructed terms delivered as reference.
29 explicit term_list(detail::_aterm_appl<>* t) noexcept : aterm(t)
30 {
31 assert(!defined() || type_is_list());
32 }
33
34public:
35 /// The type of object, T stored in the term_list.
36 using value_type = Term;
37
38 /// Pointer to T.
39 using pointer = Term*;
40
41 /// Reference to T.
42 using reference = Term&;
43
44 /// Const reference to T.
45 using const_reference = const Term&;
46
47 /// An unsigned integral type.
49
50 /// A signed integral type.
51 using difference_type = ptrdiff_t;
52
53 /// Iterator used to iterate through an term_list.
54 using iterator = term_list_iterator<Term>;
55
56 /// Const iterator used to iterate through an term_list.
57 using const_iterator = term_list_iterator<Term>;
58
59 /// Const iterator used to iterate through an term_list.
60 using const_reverse_iterator = reverse_term_list_iterator<Term>;
61
62 /// \brief Default constructor. Creates an empty list.
63 term_list() noexcept
64 : aterm(detail::g_term_pool().empty_list())
65 {}
66
67 /// \brief Constructor from an aterm.
68 /// \param t A list.
69 explicit term_list(const aterm& t) noexcept
70 : aterm(t)
71 {
72 assert(type_is_list()); // A list should not be a default aterm.
73 }
74
75 /// \brief Copy constructor.
76 /// \param t A list.
77 term_list(const term_list<Term>& t) noexcept
78 : aterm(t)
79 {
80 assert(!defined() || type_is_list());
81 }
82
83 /// \brief Move constructor.
84 /// \param t A list.
85 term_list(term_list<Term>&& t) noexcept
86 : aterm(std::move(t))
87 {
88 assert(!defined() || type_is_list());
89 }
90
91 /// This class has user-declared copy constructor so declare copy and move assignment.
92 term_list& operator=(const term_list& other) noexcept = default;
93 term_list& operator=(term_list&& other) noexcept = default;
94
95 /// \brief Creates a term_list with the elements from first to last.
96 /// \details It is assumed that the range can be traversed from last to first.
97 /// \param first The start of a range of elements.
98 /// \param last The end of a range of elements.
99 template <class Iter>
103 Iter last)
105 last,
107 {
108 assert(!defined() || type_is_list());
109 }
110
111 /// \brief Creates a term_list with the elements from first to last converting the elements before inserting.
112 /// \details It is assumed that the range can be traversed from last to first. The operator () in the class
113 /// ATermConverter is applied to each element before inserting it in the list.
114 /// \param first The start of a range of elements.
115 /// \param last The end of a range of elements.
116 /// \param convert_to_aterm A class with a () operation, which is applied to each element
117 /// before it is put into the list.
118 template <class Iter, class ATermConverter>
122 Iter last,
125 {
126 assert(!defined() || type_is_list());
127 }
128
129 /// \brief Creates a term_list with the elements from first to last, converting and filtering the list.
130 /// \details It is assumed that the range can be traversed from last to first. The operator () in the class
131 /// ATermConverter is applied to each element before inserting it in the list. Elements are only
132 /// inserted if the operator () of the class ATermFilter yields true when applied to such an element.
133 /// \param first The start of a range of elements.
134 /// \param last The end of a range of elements.
135 /// \param convert_to_aterm A class with a () operation, which is applied to each element
136 /// before it is put into the list.
137 /// \param aterm_filter A class with an operator () that yields a bool, and if true the elements is inserted in the list.
138 /// Otherwise, it is ignored.
139 template <class Iter, class ATermConverter, class ATermFilter>
143 Iter last,
147 last,
150 {
151 assert(!defined() || type_is_list());
152 }
153
154 /// \brief Creates a term_list from the elements from first to last.
155 /// \details The range is traversed from first to last. This requires
156 /// to copy the elements internally, which is less efficient
157 /// than this function with random access iterators as arguments.
158 /// \param first The start of a range of elements.
159 /// \param last The end of a range of elements.
160 template <class Iter>
164 Iter last)
166 last,
168 {
169 assert(!defined() || type_is_list());
170 }
171
172 /// \brief Creates a term_list from the elements from first to last converting the elements before inserting.
173 /// \details The range is traversed from first to last. This requires
174 /// to copy the elements internally, which is less efficient
175 /// than this function with random access iterators as arguments.
176 /// The operator () in the class
177 /// ATermConverter is applied to each element before inserting it in the list.
178 /// \param first The start of a range of elements.
179 /// \param last The end of a range of elements.
180 /// \param convert_to_aterm A class with a () operation, whic is applied to each element
181 /// before it is put into the list.
182 template <class Iter, class ATermConverter>
186 Iter last,
189 {
190 assert(!defined() || type_is_list());
191 }
192
193 /// \brief Creates a term_list from the elements from first to last converting and filtering the elements before inserting.
194 /// \details The range is traversed from first to last. This requires
195 /// to copy the elements internally, which is less efficient
196 /// than this function with random access iterators as arguments.
197 /// The operator () in the class ATermConverter is applied to
198 /// each element before inserting it in the list. Elements are only
199 /// inserted if the operator () of the class ATermFilter yields true when applied to such an element.
200 /// \param first The start of a range of elements.
201 /// \param last The end of a range of elements.
202 /// \param convert_to_aterm A class with a () operation, whic is applied to each element
203 /// before it is put into the list.
204 /// \param aterm_filter A class with an operator () yielding a bool that if true allows the element to be added to the list.
205 /// Otherwise, the element is not added.
206 template <class Iter, class ATermConverter, class ATermFilter>
210 Iter last,
214 {
215 assert(!defined() || type_is_list());
216 }
217
218 /// \brief Creates a term_list from the elements in the range.
219 template<std::ranges::range R>
221 // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) r is consumed via begin/end iterators; forwarding an rvalue range would be ill-formed for non-borrowed ranges.
222 explicit term_list(R&& r)
225 {
226 assert(!defined() || type_is_list());
227 }
228
229 /// \brief A constructor based on an initializer list.
230 /// \details This constructor is not made explicit to conform to initializer lists in standard containers.
231 /// \param init The initialiser list.
237 {
238 assert(!defined() || type_is_list());
239 }
240
241 /// \brief Returns the tail of the list.
242 /// \return The tail of the list.
243 const term_list<Term>& tail() const
244 {
245 assert(!empty());
246 return (static_cast<const detail::_aterm_list<Term>&>(*m_term)).tail();
247 }
248
249 /// \brief Removes the first element of the list.
251 {
252 *this = tail();
253 }
254
255 /// \brief Returns the first element of the list.
256 /// \return The term at the head of the list.
257 const Term& front() const
258 {
259 return static_cast<const detail::_aterm_list<Term>&>(*m_term).head();
260 }
261
262 /// \brief Inserts a new element at the beginning of the current list.
263 /// \param el The term that is added.
264 void push_front(const Term& el);
265
266 /// \brief Construct and insert a new element at the beginning of the current list.
267 /// \param arguments Arguments forwarded to construct the new element.
268 template<typename ...Args>
269 void emplace_front(Args&&... arguments);
270
271 /// \brief Returns the size of the term_list.
272 /// \details The complexity of this function is linear in the size of the list.
273 /// \return The size of the list.
275 {
276 std::size_t size=0;
277 for(const_iterator i=begin(); i!=end(); ++i)
278 {
279 ++size;
280 }
281 return size;
282 }
283
284 /// \brief Returns true if the list's size is 0.
285 /// \return True iff the list is empty.
286 bool empty() const
287 {
288 return m_term->function() == detail::g_term_pool().as_empty_list();
289 }
290
291 /// \brief Returns a const_iterator pointing to the beginning of the term_list.
292 /// \return The beginning of the list.
293 const_iterator begin() const
294 {
295 return const_iterator(m_term);
296 }
297
298 /// \brief Returns a const_iterator pointing to the end of the term_list.
299 /// \return The end of the list.
300 const_iterator end() const
301 {
302 return const_iterator(detail::address(detail::g_term_pool().empty_list()));
303 }
304
305 /// \brief Returns a const_reverse_iterator pointing to the end of the term_list.
306 /// \details This operator requires linear time and memory in the size of the list to yield the iterator.
307 /// \return The end of the list.
308 const_reverse_iterator rbegin() const
309 {
310 return const_reverse_iterator(m_term);
311 }
312
313 /// \brief Returns a const_iterator pointing to the end of the term_list.
314 /// \return The end of the list.
315 const_reverse_iterator rend() const
316 {
317 return const_reverse_iterator();
318 }
319
320 /// \brief Returns the largest possible size of the term_list.
321 /// \return The largest possible size of the list.
323 {
324 return std::numeric_limits<std::size_t>::max();
325 }
326};
327
328
329/// \brief Make an empty list and put it in target;
330/// \param target The variable to which the empty list is assigned.
331template <class Term>
332void make_term_list(term_list<Term>& target)
333{
334 target=atermpp::down_cast<term_list<Term>>(detail::g_term_pool().empty_list());
335}
336
337/// \brief Creates a term_list with the elements from first to last.
338/// \details It is assumed that the range can be traversed from last to first.
339/// \param target The variable to which the list is assigned.
340/// \param first The start of a range of elements.
341/// \param last The end of a range of elements.
342template <class Term, class Iter>
346 Iter first,
347 Iter last)
348{
351 assert(!target.defined() || target.type_is_list());
352}
353
354/// \brief Creates a term_list with the elements from first to last converting the elements before inserting.
355/// \details It is assumed that the range can be traversed from last to first. The operator () in the class
356/// ATermConverter is applied to each element before inserting it in the list.
357/// \param target The variable to which the list is assigned.
358/// \param first The start of a range of elements.
359/// \param last The end of a range of elements.
360/// \param convert_to_aterm A class with a () operation, which is applied to each element
361/// before it is put into the list.
362template <class Term, class Iter, class ATermConverter>
366 Iter first,
367 Iter last,
369{
371 assert(!target.defined() || target.type_is_list());
372}
373
374/// \brief Creates a term_list with the elements from first to last, converting and filtering the list.
375/// \details It is assumed that the range can be traversed from last to first. The operator () in the class
376/// ATermConverter is applied to each element before inserting it in the list. Elements are only
377/// inserted if the operator () of the class ATermFilter yields true when applied to such an element.
378/// \param target The variable to which the list is assigned.
379/// \param first The start of a range of elements.
380/// \param last The end of a range of elements.
381/// \param convert_to_aterm A class with a () operation, which is applied to each element
382/// before it is put into the list.
383/// \param aterm_filter A class with an operator () that is used to determine whether elements can be inserted in the list.
384template <class Term, class Iter, class ATermConverter, class ATermFilter>
388 Iter first,
389 Iter last,
392{
394 assert(!target.defined() || target.type_is_list());
395}
396
397/// \brief Creates a term_list from the elements from first to last.
398/// \details The range is traversed from first to last. This requires
399/// to copy the elements internally, which is less efficient
400/// than this function with random access iterators as arguments.
401/// \param target The variable to which the list is assigned.
402/// \param first The start of a range of elements.
403/// \param last The end of a range of elements.
404template <class Term, class Iter>
408 Iter first,
409 Iter last)
410{
413 assert(!target.defined() || target.type_is_list());
414}
415
416/// \brief Creates a term_list from the elements from first to last converting the elements before inserting.
417/// \details The range is traversed from first to last. This requires
418/// to copy the elements internally, which is less efficient
419/// than this function with random access iterators as arguments.
420/// The operator () in the class
421/// ATermConverter is applied to each element before inserting it in the list.
422/// \param target The variable to which the list is assigned.
423/// \param first The start of a range of elements.
424/// \param last The end of a range of elements.
425/// \param convert_to_aterm A class with a () operation, which is applied to each element
426/// before it is put into the list.
427template <class Term, class Iter, class ATermConverter>
431 Iter first,
432 Iter last,
434{
437 assert(!target.defined() || target.type_is_list());
438}
439
440/// \brief Creates a term_list from the elements from first to last converting and filtering the elements before inserting.
441/// \details The range is traversed from first to last. This requires
442/// to copy the elements internally, which is less efficient
443/// than this function with random access iterators as arguments.
444/// The operator () in the class ATermConverter is applied to
445/// each element before inserting it in the list. Elements are only
446/// inserted if the operator () of the class ATermFilter yields true when applied to such an element.
447/// \param target The variable to which the list is assigned.
448/// \param first The start of a range of elements.
449/// \param last The end of a range of elements.
450/// \param convert_to_aterm A class with a () operation, which is applied to each element
451/// before it is put into the list.
452/// \param aterm_filter A class with an operator () that is used to determine whether elements can be inserted in the list.
453template <class Term, class Iter, class ATermConverter, class ATermFilter>
457 Iter first,
458 Iter last,
461{
464 assert(!target.defined() || target.type_is_list());
465}
466
467/// \brief A constructor based on an initializer list.
468/// \details This constructor is not made explicit to conform to initializer lists in standard containers.
469/// \param target The variable to which the list is assigned.
470/// \param init The initialiser list.
471template <class Term>
473{
478 assert(!target.defined() || target.type_is_list());
479}
480
481
482
483/// \cond INTERNAL_DOCS
484namespace detail
485{
486
487/// \brief Template specialization to make a term_list recognizable as a container type (see
488/// type_traits.h and detail/type_traits_impl.h).
489template < typename T >
490struct is_container_impl< atermpp::term_list< T > > : public std::true_type
491{ };
492
493
494template <class Term>
495class _aterm_list : public _aterm_appl<2>
496{
497public:
498 /// \returns A reference to the head of the list.
499 const Term& head() const { return static_cast<const Term&>(arg(0)); }
500
501 /// \returns A reference to the tail of the list.
502 const term_list<Term>& tail() const { return static_cast<const term_list<Term>&>(arg(1)); }
503
504 std::size_t size() const
505 {
506 std::size_t size=0;
507 for(_aterm_list const* i=this;
509 i=static_cast<_aterm_list const*>(address(i->tail())))
510 {
511 ++size;
512 }
513 return size;
514 }
515
516};
517
518} // namespace detail
519/// \endcond
520
521
522/// \brief A term_list with elements of type aterm.
524
525/// \brief Returns whether the given list is sorted according to the given ordering which is by default the standard ordering on Term.
526/// \param l A list.
527/// \param ordering A total orderings relation on Term, by default the ordering relation on Terms.
528/// \details This operator has linear complexity.
529/// \return A boolean indicating whether the list is sorted.
530template <typename Term, typename Compare = std::less<Term>>
531inline
532bool is_sorted(const term_list<Term>& l, Compare ordering = Compare{})
533{
534 return std::is_sorted(l.begin(), l.end(), ordering);
535}
536
537
538/// \brief Returns the list with the elements in reversed order.
539/// \param l A list.
540/// \details This operator is linear in the size of the list.
541/// \return The reversed list.
542template <typename Term>
543inline
544term_list<Term> reverse(const term_list<Term>& l);
545
546/// \brief Returns the list with the elements sorted according to given ordering which is by default the ordering of addresses of terms.
547/// \param l A list.
548/// \param ordering An total orderings relation on Term, by default the ordering relation on Terms.
549/// \details This operator has complexity nlog n where n is the size of the list.
550/// \return The sorted list.
551template <typename Term, typename Compare = std::less<Term>>
552inline
553term_list<Term> sort_list(const term_list<Term>& l, Compare ordering = Compare{});
554
555/// \brief Returns the list with element t inserted in l lexicographically according to the provided ordering.
556/// \param t An element to be inserted.
557/// \param l A list.
558/// \param ordering A total orderings relation on Term, by default the ordering relation on Terms.
559/// \details This operator has linear complexity. It is assumed that the list l is ordered for it to work.
560/// \return The sorted list.
561template <typename Term, typename Compare = std::less<Term>>
562inline
563term_list<Term> insert_sorted(const Term& t, const term_list<Term>& l, Compare ordering = Compare{});
564
565/// \brief Returns the merged list sorted according to the given ordering, which is by default the ordering of addresses of terms.
566/// \param l1 An ordered list.
567/// \param l2 Another ordered list.
568/// \param ordering A total orderings relation on Term, by default the ordering relation on Terms.
569/// \details This operator is linear in the cumulative length of l1 and l2. In debug mode it checks whether l1 and l2 are ordered.
570/// \return The sorted list.
571template <typename Term, typename Compare = std::less<Term>>
572inline
573term_list<Term> merge_lists(const term_list<Term>& l1, const term_list<Term>& l2, Compare ordering = Compare{});
574
575
576/// \brief Returns the concatenation of two lists with convertible element types.
577/// \details The type of the result is either the type of l, if the elements of m
578/// can be converted implicitly to the type of the elements of l. Otherwise if the
579/// elements of l can be converted implicitly to the type of the elements
580/// of m, the result type is that or m.
581/// \param l A list.
582/// \param m A list.
583/// \details The complexity of this operator is linear in the length of l.
584/// \return The concatenation of the lists l followed by m.
585
586template <typename Term1, typename Term2>
588operator+(const term_list<Term1>& l, const term_list<Term2>& m);
589
590/// \brief Appends a new element at the end of the list. Note
591/// that the complexity of this function is O(n), with n the number of
592/// elements in the list!!!
593/// \param l The list to which the term is appended.
594/// \param el A term.
595/// \return The list l with elem appended at the end.
596template <typename Term>
597inline
598term_list<Term> push_back(const term_list<Term>& l, const Term& el);
599
600/// \brief Converts the given term list to a vector.
601template <typename T>
603{
604 return std::vector<T>(x.begin(), x.end());
605}
606
607/// \brief Converts the given term list to a set.
608template <typename T>
610{
611 return std::set<T>(x.begin(), x.end());
612}
613
614} // namespace atermpp
615
616
617namespace std
618{
619//
620/// \brief Swaps two term_lists.
621/// \details This operation is more efficient than exchanging terms by an assignment,
622/// as swapping does not require to change the protection of terms.
623/// \param t1 The first term
624/// \param t2 The second term
625template <class T>
626inline void swap(atermpp::term_list<T>& t1, atermpp::term_list<T>& t2) noexcept
627{
628 t1.swap(t2);
629}
630
631/// \brief The standard hash class.
632template <class Term>
633struct hash<atermpp::term_list<Term> >
634{
635 /// \brief A specialization of the standard std::hash function.
636 /// \param l The list for which a hash value is calculated.
637 /// \return A hash value for l.
639 {
640 std::hash<atermpp::aterm> hasher;
641 return hasher(l);
642 }
643};
644
645} // namespace std
646
647#include "mcrl2/atermpp/detail/aterm_list_implementation.h"
648
649#endif // MCRL2_ATERMPP_ATERM_LIST_H
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:33
aterm_int(const aterm &t)
Constructs an integer term from an aterm.
Definition aterm_int.h:39
std::size_t value() const noexcept
Provide the value stored in an aterm.
Definition aterm_int.h:47
void swap(aterm_int &t) noexcept
Swaps two integer terms without changing the protection.
Definition aterm_int.h:56
aterm_int() noexcept=default
Default constructor.
The interface for a class that reads aterm from a stream. The default constructed term aterm() indica...
Definition aterm_io.h:62
virtual void get(aterm &t)=0
Reads an aterm from this stream.
The interface for a class that writes aterm to a stream. Every written term is retrieved by the corre...
Definition aterm_io.h:51
virtual void put(const aterm &term)=0
Write the given term to the stream.
A helper class to restore the state of the aterm_{i,o}stream objects upon destruction....
Definition aterm_io.h:104
aterm_stream_state(aterm_stream_state &&)=delete
aterm_stream_state & operator=(aterm_stream_state &&)=delete
aterm_transformer * m_transformer
Definition aterm_io.h:123
aterm_stream_state(aterm_stream &stream)
Definition aterm_io.h:106
aterm_stream_state(const aterm_stream_state &)=delete
aterm_stream_state & operator=(const aterm_stream_state &)=delete
aterm_stream & m_stream
Definition aterm_io.h:122
The general aterm stream interface, which enables the use of a transformer to change the written/read...
Definition aterm_io.h:34
aterm_transformer * m_transformer
Definition aterm_io.h:45
aterm_transformer * get_transformer() const
Definition aterm_io.h:42
void set_transformer(aterm_transformer transformer)
Sets the given transformer to be applied to following writes.
Definition aterm_io.h:39
aterm(const aterm &other) noexcept=default
This class has user-declared copy constructor so declare default copy and move operators.
thread_aterm_pool(aterm_pool &global_pool)
std::stack< std::reference_wrapper< _aterm > > m_todo
A reusable todo stack.
Reverse iterator for term_list.
Iterator for term_list.
A list of aterm objects.
Definition aterm_list.h:26
size_type size() const
Returns the size of the term_list.
Definition aterm_list.h:274
term_list(const term_list< Term > &t) noexcept
Copy constructor.
Definition aterm_list.h:77
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
Definition aterm_list.h:300
const_reverse_iterator rend() const
Returns a const_iterator pointing to the end of the term_list.
Definition aterm_list.h:315
term_list & operator=(const term_list &other) noexcept=default
This class has user-declared copy constructor so declare copy and move assignment.
term_list(term_list< Term > &&t) noexcept
Move constructor.
Definition aterm_list.h:85
term_list & operator=(term_list &&other) noexcept=default
term_list(const aterm &t) noexcept
Constructor from an aterm.
Definition aterm_list.h:69
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
Definition aterm_list.h:293
size_type max_size() const
Returns the largest possible size of the term_list.
Definition aterm_list.h:322
void emplace_front(Args &&... arguments)
Construct and insert a new element at the beginning of the current list.
term_list(detail::_aterm_appl<> *t) noexcept
Constructor for term lists from internally constructed terms delivered as reference.
Definition aterm_list.h:29
bool empty() const
Returns true if the list's size is 0.
Definition aterm_list.h:286
const_reverse_iterator rbegin() const
Returns a const_reverse_iterator pointing to the end of the term_list.
Definition aterm_list.h:308
term_list() noexcept
Default constructor. Creates an empty list.
Definition aterm_list.h:63
A unordered_map class in which aterms can be stored.
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
aterm_pool & g_aterm_pool_instance()
A reference to the global term pool storage.
thread_aterm_pool * g_main_thread_pool
Pointer to the main thread's pool; set on its first access and used by ~thread_aterm_pool to transfer...
mcrl2::utilities::shared_guard lock_shared_aterm_pool()
Acquires a shared lock on the global thread aterm pool.
std::array< std::byte, sizeof(aterm_pool)> g_aterm_pool_storage
Storage for a global term pool that is not initialized.
The main namespace for the aterm++ library.
term_list< Term > sort_list(const term_list< Term > &l, Compare ordering=Compare{})
Returns the list with the elements sorted according to given ordering which is by default the orderin...
aterm identity(const aterm &x)
The default transformer that maps each term to itself.
Definition aterm_io.h:26
void make_term_list(term_list< Term > &target)
Make an empty list and put it in target;.
Definition aterm_list.h:332
aterm_istream & operator>>(aterm_istream &stream, aterm &term)
Read the given term from the stream, but for aterm_list we want to use a specific one that performs v...
Definition aterm_io.h:93
void read_term_from_binary_stream(std::istream &is, aterm &t)
Reads a term from a stream in binary aterm format.
bool is_sorted(const term_list< Term > &l, Compare ordering=Compare{})
Returns whether the given list is sorted according to the given ordering which is by default the stan...
Definition aterm_list.h:532
aterm read_appl_from_string(const std::string &s)
Reads an aterm from a string. The string can be in either binary or text format.
Definition aterm_io.h:232
std::set< T > as_set(const atermpp::term_list< T > &x)
Converts the given term list to a set.
Definition aterm_list.h:609
aterm_int read_int_from_string(const std::string &s)
Reads an aterm_int from a string. The string can be in either binary or text format.
Definition aterm_io.h:222
term_list< Term > insert_sorted(const Term &t, const term_list< Term > &l, Compare ordering=Compare{})
Returns the list with element t inserted in l lexicographically according to the provided ordering.
term_list< Term > reverse(const term_list< Term > &l)
Returns the list with the elements in reversed order.
aterm read_term_from_string(const std::string &s)
Reads an aterm from a string. The string can be in either binary or text format.
void add_deletion_hook(const function_symbol &, term_callback)
Check for reasonably sized aterm (32 bits, 4 bytes) This check might break on perfectly valid archite...
void write_term_to_text_stream(const aterm &t, std::ostream &os)
Writes term t to a stream in textual format.
aterm_istream & operator>>(aterm_istream &stream, aterm_transformer transformer)
Sets the given transformer to be applied to following reads.
Definition aterm_io.h:73
void make_aterm_int(aterm_int &target, std::size_t value)
Constructs an integer term from a value.
Definition aterm_int.h:64
std::vector< T > as_vector(const atermpp::term_list< T > &x)
Converts the given term list to a vector.
Definition aterm_list.h:602
term_list< Term > merge_lists(const term_list< Term > &l1, const term_list< Term > &l2, Compare ordering=Compare{})
Returns the merged list sorted according to the given ordering, which is by default the ordering of a...
void read_term_from_text_stream(std::istream &is, aterm &t)
Reads a term from a stream which contains the term in textual format.
term_list< Term > push_back(const term_list< Term > &l, const Term &el)
Appends a new element at the end of the list. Note that the complexity of this function is O(n),...
aterm_list read_list_from_string(const std::string &s)
Reads an aterm_list from a string. The string can be in either binary or text format.
Definition aterm_io.h:212
void swap(atermpp::term_list< T > &t1, atermpp::term_list< T > &t2) noexcept
Swaps two term_lists.
Definition aterm_list.h:626
void swap(atermpp::aterm_int &t1, atermpp::aterm_int &t2) noexcept
Swaps two aterm_ints.
Definition aterm_int.h:82
std::size_t operator()(const atermpp::term_list< Term > &l) const
A specialization of the standard std::hash function.
Definition aterm_list.h:638