10#ifndef MCRL2_UTILITIES_WORKAROUNDS_H
11#define MCRL2_UTILITIES_WORKAROUNDS_H
An integer term stores a single std::size_t value. It carries no arguments.
aterm_int(std::size_t value)
Constructs an integer term from a value.
aterm_int & operator=(aterm_int &&other) noexcept=default
aterm_int(const aterm &t)
Constructs an integer term from an aterm.
aterm_int() noexcept
Default constructor.
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.
void swap(aterm_int &t) noexcept
Swaps two integer terms without changing the protection.
aterm_int(aterm_int &&other) noexcept=default
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
aterm(const aterm &other) noexcept=default
This class has user-declared copy constructor so declare default copy and move operators.
The underlying integer term that actually carries the integer data.
std::size_t value() const noexcept
This is the class to which an aterm points.
const function_symbol & function() const noexcept
const function_symbol & as_empty_list() noexcept
const function_symbol & as_list() noexcept
aterm & empty_list() noexcept
void enable_garbage_collection(bool enable)
Enable garbage collection when passing true and disable otherwise.
void create_int(aterm &term, std::size_t val)
bool operator==(const function_symbol &f) const
Equality test.
Reverse iterator for term_list.
reverse_term_list_iterator & operator=(const reverse_term_list_iterator &other)=delete
Assignment is not available.
bool operator>=(const reverse_term_list_iterator &other) const
Comparison of iterators.
bool operator>(const reverse_term_list_iterator &other) const
Comparison of iterators.
ptrdiff_t difference_type
reverse_term_list_iterator()
Default constructor.
bool operator==(const reverse_term_list_iterator &other) const
Equality of iterators.
reverse_term_list_iterator(detail::_aterm const *l)
Constructor from an aterm which must be a list.
bool operator<=(const reverse_term_list_iterator &other) const
Comparison of iterators.
reverse_term_list_iterator & operator++()
Prefix increment operator on iterator.
const Term & operator*() const
Dereference operator on an iterator.
bool operator<(const reverse_term_list_iterator &other) const
Comparison of iterators.
const Term * operator->() const
Arrow operator on an iterator.
reverse_term_list_iterator(const reverse_term_list_iterator &other)=delete
The copy constructor is not available.
std::unique_ptr< detail::_aterm_list< Term > const *[]> m_list_element_references
bool operator!=(const reverse_term_list_iterator &other) const
Inequality of iterators.
void operator++(int)
Postfix increment operator on iterator.
std::forward_iterator_tag iterator_category
const detail::_aterm_list< Term > * m_list
term_list_iterator()
Default constructor.
std::forward_iterator_tag iterator_category
bool operator<=(const term_list_iterator &other) const
Comparison of iterators.
bool operator<(const term_list_iterator &other) const
Comparison of iterators.
term_list_iterator & operator=(const term_list_iterator &other)
Assignment.
term_list_iterator operator++(int)
Postfix increment operator on iterator.
bool operator>(const term_list_iterator &other) const
Comparison of iterators.
term_list_iterator(const term_list_iterator &other)
Copy constructor.
const Term & operator*() const
Dereference operator on an iterator.
term_list_iterator(const detail::_aterm *l)
Constructor from an aterm which must be a list.
ptrdiff_t difference_type
bool operator>=(const term_list_iterator &other) const
Comparison of iterators.
bool operator!=(const term_list_iterator &other) const
Inequality of iterators.
term_list_iterator & operator++()
Prefix increment operator on iterator.
bool operator==(const term_list_iterator &other) const
Equality of iterators.
const Term * operator->() const
Arrow operator on an iterator.
size_type size() const
Returns the size of the term_list.
term_list(const term_list< Term > &t) noexcept
Copy constructor.
const_iterator end() const
Returns a const_iterator pointing to the end of the term_list.
Term value_type
The type of object, T stored in the term_list.
const_reverse_iterator rend() const
Returns a const_iterator pointing to the end of the term_list.
term_list(Iter first, Iter last, const ATermConverter &convert_to_aterm, const ATermFilter &aterm_filter, typename std::enable_if< std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=0)
Creates a term_list with the elements from first to last, converting and filtering the list.
std::size_t size_type
An unsigned integral type.
term_list & operator=(const term_list &other) noexcept=default
This class has user-declared copy constructor so declare copy and move assignment.
reverse_term_list_iterator< Term > const_reverse_iterator
Const iterator used to iterate through an term_list.
const Term & const_reference
Const reference to T.
const term_list< Term > & tail() const
Returns the tail of the list.
const Term & front() const
Returns the first element of the list.
term_list(term_list< Term > &&t) noexcept
Move constructor.
ptrdiff_t difference_type
A signed integral type.
term_list & operator=(term_list &&other) noexcept=default
void pop_front()
Removes the first element of the list.
term_list(const aterm &t) noexcept
Constructor from an aterm.
term_list_iterator< Term > iterator
Iterator used to iterate through an term_list.
Term & reference
Reference to T.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the term_list.
size_type max_size() const
Returns the largest possible size of the term_list.
void emplace_front(Args &&... arguments)
Construct and insert a new element at the beginning of the current list.
term_list(Iter first, Iter last, const ATermConverter &convert_to_aterm, typename std::enable_if< std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=0)
Creates a term_list with the elements from first to last converting the elements before inserting.
term_list_iterator< Term > const_iterator
Const iterator used to iterate through an term_list.
Term * pointer
Pointer to T.
term_list(detail::_aterm_appl<> *t) noexcept
Constructor for term lists from internally constructed terms delivered as reference.
bool empty() const
Returns true if the list's size is 0.
term_list(std::initializer_list< Term > init)
A constructor based on an initializer list.
term_list(Iter first, Iter last, typename std::enable_if< std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=nullptr)
Creates a term_list with the elements from first to last.
void push_front(const Term &el)
Inserts a new element at the beginning of the current list.
const_reverse_iterator rbegin() const
Returns a const_reverse_iterator pointing to the end of the term_list.
term_list() noexcept
Default constructor. Creates an empty list.
bool type_is_list() const noexcept
Dynamic check whether the term is an aterm_list.
void swap(unprotected_aterm_core &t) noexcept
Swaps this term with its argument.
bool operator==(const unprotected_aterm_core &t) const
Comparison operator.
bool defined() const
Returns true if this term is not equal to the term assigned by the default constructor of aterms,...
friend detail::_aterm * detail::address(const unprotected_aterm_core &t)
const detail::_aterm * m_term
bool type_is_int() const noexcept
Dynamic check whether the term is an aterm_int.
Exception class for errors raised by the command-line parser.
virtual ~command_line_error()
static std::string format(const std::string &name, const std::string &message)
command_line_error(const std::string &name, const std::string &message)
Standard exception class for reporting runtime errors.
runtime_error(const std::string &message)
Constructor.
cached_bottom_up_replace_aterm_builder< Builder, ReplaceFunction > make_cached_bottom_up_replace_aterm_builder(ReplaceFunction f, std::unordered_map< aterm, aterm > &cache)
aterm make_list_backward(Iter first, Iter last, ATermConverter convert_to_aterm)
Constructs a list starting from first to last. The iterators are traversed backwards and each element...
replace_aterm_builder< Builder, ReplaceFunction > make_replace_aterm_builder(ReplaceFunction f)
partial_replace_aterm_builder< Builder, ReplaceFunction > make_partial_replace_aterm_builder(ReplaceFunction f)
void make_list_forward(term_list< Term > &result, Iter first, Iter last, ATermConverter convert_to_aterm)
Constructs a list starting from first to last. Each element is converted using the TermConverter.
void make_list_forward(term_list< Term > &result, Iter first, Iter last, ATermConverter convert_to_aterm, ATermFilter aterm_filter)
Constructs a list traversing the iterator from first to last, putting the result in place in the vari...
aterm make_list_forward(Iter first, Iter last, ATermConverter convert_to_aterm)
Constructs a list starting from first to last. Each element is converted using the TermConverter.
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
void make_list_forward_helper(term_list< Term > &result, ForwardTraversalIterator &p, const ForwardTraversalIterator last, Transformer transformer)
aterm make_list_forward(Iter first, Iter last, ATermConverter convert_to_aterm, ATermFilter aterm_filter)
Constructs a list starting from first to last. Each element is converted using the TermConverter and ...
void make_list_backward(term_list< Term > &result, Iter first, Iter last, ATermConverter convert_to_aterm, ATermFilter aterm_filter)
Construct a list iterating from the last to the first element. Result is put in the variable result.
void make_list_backward(term_list< Term > &result, Iter first, Iter last, ATermConverter convert_to_aterm)
Constructs a list starting from first to last where the result is put in result.
bottom_up_replace_aterm_builder< Builder, ReplaceFunction > make_bottom_up_replace_aterm_builder(ReplaceFunction f)
aterm make_list_backward(Iter first, Iter last, ATermConverter convert_to_aterm, ATermFilter aterm_filter)
Constructs a list starting from first to last. The iterators are traversed backwards and each element...
The main namespace for the aterm++ library.
Term replace(const Term &t, ReplaceFunction r)
Replaces each subterm x of t by r(x). The ReplaceFunction r has the following signature: aterm x; ate...
term_list< Term > remove_one_element(const term_list< Term > &list, const Term &t)
Term replace(const Term &t, const aterm &old_value, const aterm &new_value)
Replaces each subterm in t that is equal to old_value with new_value. The replacements are performed ...
void make_term_list(term_list< Term > &target)
Make an empty list and put it in target;.
term_list< aterm > aterm_list
A term_list with elements of type aterm.
Term bottom_up_replace(Term t, ReplaceFunction r, std::unordered_map< aterm, aterm > &cache)
Replaces each subterm x of t by r(x). The ReplaceFunction r has the following signature: aterm x; ate...
void partial_find_all_if(Term t, MatchPredicate match, StopPredicate stop, OutputIterator destBegin)
Finds all subterms of t that match a given predicate, and writes the found terms to the destination r...
void make_term_list(term_list< Term > &target, Iter first, Iter last, typename std::enable_if< std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=nullptr)
Creates a term_list with the elements from first to last.
Term bottom_up_replace(Term t, const aterm &old_value, const aterm &new_value)
Replaces each subterm in t that is equal to old_value with new_value. The replacements are performed ...
aterm find_if(const Term &t, MatchPredicate match)
Finds a subterm of t that matches a given predicate.
std::set< T > as_set(const atermpp::term_list< T > &x)
Converts the given term list to a set.
UnaryFunction for_each(Term t, UnaryFunction op)
Calls op(elem) for subterms of the term t.
void find_all_if(const Term &t, MatchPredicate match, OutputIterator destBegin)
Finds all subterms of t that match a given predicate, and writes the found terms to the destination r...
Term partial_replace(Term t, ReplaceFunction r)
Replaces subterms x of t by r(x). The replace function r returns an additional boolean value....
term_list< Term > sort_list(const term_list< Term > &l, const std::function< bool(const Term &, const Term &)> &ordering=[](const Term &t1, const Term &t2){ return t1< t2;})
Returns the list with the elements sorted according to given ordering which is by default the orderin...
term_list< Term > reverse(const term_list< Term > &l)
Returns the list with the elements in reversed order.
aterm partial_find_if(Term t, MatchPredicate match, StopPredicate stop)
Finds a subterm of t that matches a given predicate. The term is only partially traversed....
constexpr std::size_t LengthOfShortList
void make_term_list(term_list< Term > &target, std::initializer_list< Term > init)
A constructor based on an initializer list.
void make_term_list(term_list< Term > &target, Iter first, Iter last, const ATermConverter &convert_to_aterm, typename std::enable_if< std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=0)
Creates a term_list with the elements from first to last converting the elements before inserting.
std::conditional< std::is_convertible< Term2, Term1 >::value, term_list< Term1 >, term_list< Term2 > >::type operator+(const term_list< Term1 > &l, const term_list< Term2 > &m)
Returns the concatenation of two lists with convertible element types.
void make_aterm_int(aterm_int &target, std::size_t value)
Constructs an integer term from a value.
std::vector< T > as_vector(const atermpp::term_list< T > &x)
Converts the given term list to a vector.
void make_term_list(term_list< Term > &target, Iter first, Iter last, const ATermConverter &convert_to_aterm, const ATermFilter &aterm_filter, typename std::enable_if< std::is_base_of< std::bidirectional_iterator_tag, typename std::iterator_traits< Iter >::iterator_category >::value >::type *=0)
Creates a term_list with the elements from first to last, converting and filtering the list.
void make_reverse(term_list< Term > &result, const term_list< Term > &l)
Term bottom_up_replace(Term t, ReplaceFunction r)
Replaces each subterm x of t by r(x). The ReplaceFunction r has the following signature: aterm x; ate...
term_list< Term > merge_lists(const term_list< Term > &l1, const term_list< Term > &l2, const std::function< bool(const Term &, const Term &)> &ordering=[](const Term &t1, const Term &t2){ return t1< t2;})
Returns the merged list sorted according to the <-operator, which is by default the ordering of addre...
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),...
T && return_std_move(T &t)
This is a workaround for the return by value diagnostic (clang -Wreturn-std-move)....
void swap(atermpp::term_list< T > &t1, atermpp::term_list< T > &t2) noexcept
Swaps two term_lists.
void swap(atermpp::aterm_int &t1, atermpp::aterm_int &t2) noexcept
Swaps two aterm_ints.
int main(int argc, char *argv[])
void apply(T &result, const aterm_int &x)
void apply(T &result, const aterm &x)
void apply(T &result, const aterm_list &x)
Builder< bottom_up_replace_aterm_builder< Builder, ReplaceFunction > > super
void apply(T &result, const aterm &x)
bottom_up_replace_aterm_builder(ReplaceFunction f_)
Builder< cached_bottom_up_replace_aterm_builder< Builder, ReplaceFunction > > super
std::unordered_map< aterm, aterm > & cache
cached_bottom_up_replace_aterm_builder(ReplaceFunction f_, std::unordered_map< aterm, aterm > &cache_)
void apply(T &result, const aterm &x)
partial_replace_aterm_builder(ReplaceFunction f_)
void apply(T &result, const aterm &x)
Builder< partial_replace_aterm_builder< Builder, ReplaceFunction > > super
void apply(T &result, const aterm &x)
replace_aterm_builder(ReplaceFunction f_)
Builder< replace_aterm_builder< Builder, ReplaceFunction > > super
std::size_t operator()(const atermpp::detail::reference_aterm< T > &t) const
std::size_t operator()(const atermpp::term_list< Term > &l) const
A specialization of the standard std::hash function.