10#ifndef MCRL2_ATERMPP_DETAIL_ATERM_HASH_H_
11#define MCRL2_ATERMPP_DETAIL_ATERM_HASH_H_
13#include "mcrl2/atermpp/detail/aterm.h"
14#include "mcrl2/atermpp/detail/aterm_int.h"
15#include "mcrl2/atermpp/detail/function_symbol_hash.h"
16#include "mcrl2/utilities/hash_utility.h"
17#include "mcrl2/utilities/detail/memory_utility.h"
43 return reinterpret_cast<
std::uintptr_t>(term) >> 4;
86 using is_transparent =
void;
92 template<
typename ForwardIterator,
93 typename std::enable_if<mcrl2::utilities::is_iterator<ForwardIterator>::value,
void>::type* =
nullptr>
99template<
std::size_t N = 0>
102 using is_transparent =
void;
107 template<
typename ...Args>
114 using is_transparent =
void;
126 using is_transparent =
void;
132 template<
typename ForwardIterator,
133 typename std::enable_if<mcrl2::utilities::is_iterator<ForwardIterator>::value>::type* =
nullptr>
137template<
std::size_t N>
143 template<
typename ...Args>
150 using is_transparent =
void;
166template<
std::size_t N>
170 std::size_t hnr = operator()(f);
176 const _aterm_appl<>& term_appl =
static_cast<
const _aterm_appl<>&>(term);
177 for (
std::size_t i = 0; i < arity; ++i)
179 hnr = combine(hnr, term_appl.arg(i));
184template<
std::size_t N>
188 return function_hasher
(symbol
);
191template<
std::size_t N>
198 std::size_t hnr = operator()(symbol);
199 for (
std::size_t i = 0; i < arity; ++i)
208template<
typename ForwardIterator,
219 std::size_t hnr = operator()(symbol);
220 for (
std::size_t i = 0; i < arity; ++i)
223 hnr = combine(hnr, *it);
231template<
std::size_t N>
234 std::size_t hnr = operator()(symbol);
237 for (
std::size_t i = 0; i < N; ++i)
239 hnr = combine(hnr, arguments[i]);
245template<
std::size_t I = 0,
typename... Tp,
246 typename std::enable_if<I ==
sizeof...(Tp),
void>::type* =
nullptr>
252template<
std::size_t I = 0,
typename... Tp,
253 typename std::enable_if<I <
sizeof...(Tp),
void>::type* =
nullptr>
254std::size_t combine_args(
std::size_t seed,
const Tp&... t)
256 return combine_args<I+1>(combine(seed,
std::get<I>(
std::forward_as_tuple(t...))), t...);
260template<
typename ...Args>
263 std::size_t hnr = operator()(symbol);
266 return combine_args(hnr, args...);
276static inline std::size_t xorshift(
const std::size_t n,
const std::size_t i)
283 const std::size_t p = 0x5555555555555555ull;
284 const std::size_t c = 17316035218449499591ull;
285 return c*xorshift(p*xorshift(value,32),32);
288template<
std::size_t N>
291 if (&first == &second)
301 for (
std::size_t i = 0; i < arity; ++i)
303 if (
static_cast<
const _term_appl&>(first).arg(i)
304 !=
static_cast<
const _term_appl&>(second).arg(i))
313template<
std::size_t N>
319template<
std::size_t N>
325 if (
static_cast<
const _term_appl&>(term).arg(i) != arguments[i])
335template<
typename ForwardIterator,
345 for (
std::size_t i = 0; i < arity; ++i)
348 if (
static_cast<
const _term_appl&>(term).arg(i) != (*it))
359template<
std::size_t N>
363 for (
std::size_t i = 0; i < N; ++i)
365 if (
static_cast<
const _aterm_appl<N>&>(term).arg(i) != arguments[i])
374template<
std::size_t I = 0,
376 typename std::enable_if<I ==
sizeof...(Tp),
void>::type* =
nullptr>
377bool equal_args(
const _aterm_appl<8>&,
const Tp&...)
382template<
std::size_t I = 0,
384 typename std::enable_if<I <
sizeof...(Tp),
void>::type* =
nullptr>
385bool equal_args(
const _aterm_appl<8>& term,
const Tp&... t)
387 return term.arg(I) == std::get<I>(std::forward_as_tuple(t...)) && equal_args<I+1>(term, t...);
391template<
typename ...Args>
394 return term.function() == symbol && equal_args(
static_cast<
const _aterm_appl<8>&>(term), args...);
aterm create_nested_function(const std::string &function_name, const std::string &leaf_name, std::size_t depth)
Create a nested function application f_depth. Where f_0 = c and f_i = f(f_i-1,...,...
aterm create_nested_function(const std::string &function_name, const std::string &leaf_name, std::size_t number_of_arguments, std::size_t depth)
Create a nested function application f_depth. Where f_0 = c and f_i = f(f_i-1,...,...
void benchmark_threads(std::size_t number_of_threads, F f)
The aterm_core base class that provides protection of the underlying shared terms.
aterm_core & operator=(aterm_core &&other) noexcept
Move assignment operator.
~aterm_core() noexcept
Standard destructor.
aterm_core & operator=(const aterm_core &other) noexcept
Assignment operator.
aterm_core(const aterm_core &other) noexcept
Copy constructor.
aterm_core(aterm_core &&other) noexcept
Move constructor.
aterm_core() noexcept
Default constructor.
aterm_core & assign(const aterm_core &other, detail::thread_aterm_pool &pool) noexcept
Assignment operator, to be used if busy and forbidden flags are explicitly available.
aterm_core & unprotected_assign(const aterm_core &other) noexcept
Assignment operator, to be used when the busy flags do not need to be set.
aterm_core(const detail::_aterm *t) noexcept
Constructor based on an internal term data structure. This is not for public use.
aterm(aterm &&other) noexcept=default
aterm(const function_symbol &sym, InputIterator begin, InputIterator end, TermConverter converter)
const_iterator end() const
Returns a const_iterator pointing past the last argument.
aterm(const function_symbol &symbol, const Terms &...arguments)
Constructor for n-arity function application.
const aterm & operator[](const size_type i) const
Returns the i-th argument.
aterm()
Default constructor.
const_iterator begin() const
Returns an iterator pointing to the first argument.
aterm(const function_symbol &sym, InputIterator begin, InputIterator end)
Constructor that provides an aterm based on a function symbol and an input iterator providing the arg...
aterm(const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
Constructor that provides an aterm based on a function symbol and forward iterator providing the argu...
aterm & operator=(const aterm &other) noexcept=default
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
std::size_t size_type
An unsigned integral type.
aterm(const aterm &other) noexcept=default
This class has user-declared copy constructor so declare default copy and move operators.
aterm(detail::_term_appl *t)
Constructor.
ptrdiff_t difference_type
A signed integral type.
bool empty() const
Returns true if the term has no arguments.
aterm & operator=(aterm &&other) noexcept=default
aterm(const function_symbol &sym)
Constructor.
term_appl_iterator< aterm > iterator
Iterator used to iterate through an term_appl.
size_type size() const
Returns the number of arguments of this term.
term_appl_iterator< aterm > const_iterator
Const iterator used to iterate through an term_appl.
constexpr size_type max_size() const
Returns the largest possible number of arguments.
This class allocates _aterm_appl objects where the size is based on the arity of the function symbol.
T * allocate_args(const function_symbol &symbol, unprotected_aterm_core *)
Allocates space for an _aterm_appl where the arity is given by the function symbol.
T * allocate_args(const function_symbol &symbol, ForwardIterator, ForwardIterator)
Allocates space for an _aterm_appl where the arity is given by the function symbol.
std::allocator< char > m_packed_allocator
static constexpr std::size_t term_appl_size(std::size_t arity)
void destroy(T *element)
Specialize destroy for _aterm_appl to only destroy the function symbol. The reference count for the a...
constexpr std::size_t capacity() const
void deallocate(T *element, std::size_t)
constexpr bool has_free_slots() const noexcept
constexpr std::size_t consolidate() const noexcept
void construct(T *element, const function_symbol &symbol, ForwardIterator begin, ForwardIterator end)
Constructs an _aterm_appl with arguments taken from begin, the arity is given by the function symbol.
This class stores a term followed by N arguments. Where N should be equal to the arity of the functio...
_aterm_appl(const function_symbol &sym, const Terms &...arguments)
Constructs a term application with the given symbol and arguments.
_aterm_appl(const function_symbol &symbol, Iterator it, Iterator end, bool)
constructs a term application with the given symbol and its arguments from the iterator.
_aterm_appl(const function_symbol &sym, std::array< unprotected_aterm_core, N > arguments)
Constructs a term application with the given symbol and arguments.
std::array< unprotected_aterm_core, N > m_arguments
operator _aterm_appl< 1 > &()
Convert any known number of arguments aterm<N> to the default _aterm_appl.
_aterm_appl(const function_symbol &sym, Iterator it, Iterator end)
constructs a term application with the given symbol and an iterator where the number of elements is e...
const aterm_core & arg(std::size_t index) const
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.
bool is_marked() const
Check if the term is already marked.
_aterm(const function_symbol &symbol)
Create a term from a function symbol.
function_symbol m_function_symbol
const function_symbol & function() const noexcept
void mark() const
Mark this term to be garbage collected.
void unmark() const
Remove the mark from a term.
Stores the data for a function symbol (name, arity) pair.
const std::size_t m_arity
const std::string & name() const noexcept
bool operator==(const _function_symbol &f) const noexcept
std::size_t arity() const noexcept
This class provides for all types of term storage. It also provides garbage collection via its mark a...
bool create_appl_iterator(aterm &term, const function_symbol &sym, TermConverter converter, InputIterator begin, InputIterator end)
Creates a function application with the given function symbol and the arguments as provided by the gi...
std::stack< std::reference_wrapper< _aterm > > todo
A reusable todo stack.
constexpr bool is_dynamic_storage() const
std::vector< callback_pair > m_deletion_hooks
This array stores creation, resp deletion, hooks for function symbols.
void print_performance_stats(const char *identifier) const
Prints various performance statistics for this storage.
bool create_appl(aterm &term, const function_symbol &sym, const Terms &... arguments)
Creates a function application with the given function symbol and arguments.
bool create_int(aterm &term, std::size_t value)
Creates a integral term with the given value.
bool create_appl_iterator(aterm &term, const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
Creates a function application with the given function symbol and the arguments as provided by the gi...
void resize_if_needed()
Resizes the hash table if necessary.
bool verify_sweep()
Check that all arguments of a term application are marked properly.
unordered_set m_term_set
This is the set of term pointers to keep the terms unique.
aterm_pool_storage(aterm_pool &pool)
std::size_t m_erasedBlocks
void add_deletion_hook(function_symbol sym, term_callback callback)
Add a callback that is triggered whenever a term with the given function symbol is destroyed.
aterm_pool & m_pool
The pool that this storage belongs to.
bool create_appl_dynamic(aterm &term, const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
Creates a function application with the given function symbol and the arguments as provided by the gi...
std::size_t capacity() const noexcept
bool emplace(aterm_core &term, Args &&... args)
Inserts a term constructed by the given arguments, checks for existing term.
iterator destroy(iterator it)
Removes an element from the unordered set and deallocates it.
void call_deletion_hook(unprotected_aterm_core term)
Calls the deletion hook attached to the function symbol of this term. \threadsafe.
aterm_pool_storage(const aterm_pool_storage &other)
A fake copy constructor to fix the issues with GCC 4 and 5.
mcrl2::utilities::cache_metric m_term_metric
Count the number of times a term has been found in or is added to the set.
bool verify_term(const _aterm &term)
Verify that the given term was constructed properly.
bool verify_mark()
Check that all arguments of a term application are marked properly.
bool create_term(aterm &term, const function_symbol &sym)
Creates a term with the given function symbol.
void sweep()
sweep Destroys all terms that are not reachable. Requires that mark() was called first.
The interface for the term library. Provides the storage of of all classes of terms.
const function_symbol & as_int() noexcept
void created_term(bool allow_collect, mcrl2::utilities::shared_mutex &mutex)
Triggers garbage collection and resizing when conditions are met.
bool create_appl(aterm &term, const function_symbol &sym, const Terms &... arguments)
Creates a function application with the given function symbol and arguments.
std::atomic< bool > m_enable_garbage_collection
std::atomic< long > m_count_until_resize
function_symbol create_function_symbol(std::string &&name, const std::size_t arity, const bool check_for_registered_functions=false)
Creates a function symbol pair (name, arity).
void remove_thread_aterm_pool(thread_aterm_pool_interface &pool)
Remove thread specific aterm pool.
std::vector< thread_aterm_pool_interface * > m_thread_pools
The set of local aterm pools.
bool create_int(aterm &term, std::size_t val)
Creates a integral term with the given value.
function_symbol_pool m_function_symbol_pool
Storage for the function symbols.
void collect_impl(mcrl2::utilities::shared_mutex &mutex)
Collect garbage on all storages.
arbitrary_function_application_storage m_appl_dynamic_storage
Storage for term_appl with a dynamic number of arguments larger than 7.
const function_symbol & as_empty_list() noexcept
function_symbol create_function_symbol(const std::string &name, const std::size_t arity, const bool check_for_registered_functions=false)
Creates a function symbol pair (name, arity).
const function_symbol & as_list() noexcept
aterm_core m_empty_list
Represents an empty list.
void print_performance_statistics() const
Prints various performance statistics for the term pool.
std::atomic< long > m_count_until_collection
Track the number of terms destroyed and reduce the freelist.
void register_thread_aterm_pool(thread_aterm_pool_interface &pool)
Register a thread specific aterm pool.
bool create_term(aterm &term, const function_symbol &sym)
Creates a term with the given function symbol.
std::size_t protection_set_size() const
void collect(mcrl2::utilities::shared_mutex &mutex)
Force garbage collection on all storages.
bool create_appl_dynamic(aterm &term, const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
Creates a function application with the given function symbol and the arguments as provided by the gi...
bool create_appl_dynamic(aterm &term, const function_symbol &sym, ATermConverter convert_to_aterm, InputIterator begin, InputIterator end)
Creates a function application with the given function symbol and the arguments as provided by the gi...
aterm & empty_list() noexcept
mcrl2::utilities::shared_mutex m_shared_mutex
Garbage collection is enabled.
void add_deletion_hook(function_symbol sym, term_callback callback)
Add a callback that is triggered whenever a term with the given function symbol is destroyed.
function_symbol_pool & get_symbol_pool()
integer_term_storage m_int_storage
Storage for integral terms.
void resize_if_needed(mcrl2::utilities::shared_mutex &shared)
Resizes all storages if necessary.
void enable_garbage_collection(bool enable)
Enable garbage collection when passing true and disable otherwise.
std::size_t capacity() const noexcept
The number of terms that can be stored without resizing.
This class stores a set of function symbols.
void mark()
Mark the terms created by this thread to prevent them being garbage collected.
std::function< void()> m_mark_function
std::function< void()> m_print_function
std::size_t protection_set_size() const
thread_aterm_pool_interface(aterm_pool &pool, std::function< void()> mark_function, std::function< void()> print_function, std::function< std::size_t()> protection_set_size_function)
void print_local_performance_statistics() const
Print performance statistics for data stored for this thread.
std::function< std::size_t()> m_protection_set_size_function
~thread_aterm_pool_interface()
void create_term(aterm &term, const function_symbol &sym)
Generates unique function symbols with a given prefix.
bool operator!=(const function_symbol &f) const
Inequality test.
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).
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.
function_symbol()=default
bool operator<=(const function_symbol &f) const
Comparison operation.
term_appl_iterator operator++(int)
Postfix increment.
bool operator==(const term_appl_iterator &other) const
Equality of iterators.
bool operator<(const term_appl_iterator &other) const
Comparison of iterators.
term_appl_iterator(const term_appl_iterator &other)
The copy constructor.
bool operator>=(const term_appl_iterator &other) const
Comparison of iterators.
term_appl_iterator operator-(ptrdiff_t n) const
Decrease by a constant value.
term_appl_iterator & operator=(const term_appl_iterator &other)
The assignment operator.
term_appl_iterator & operator--()
Prefix decrement.
ptrdiff_t operator-(const term_appl_iterator &other) const
The negative distance from this to the other iterator.
std::random_access_iterator_tag iterator_category
ptrdiff_t difference_type
bool operator<=(const term_appl_iterator &other) const
Comparison of iterators.
friend term_appl_iterator< Derived > detail::aterm_appl_iterator_cast(term_appl_iterator< Base > a, typename std::enable_if< std::is_base_of< aterm, Base >::value &&std::is_base_of< aterm, Derived >::value >::type *)
term_appl_iterator & operator++()
Prefix increment.
term_appl_iterator & operator-=(difference_type n)
Decrease the iterator with n steps.
const Term & operator[](difference_type n) const
The dereference operator.
term_appl_iterator operator+(ptrdiff_t n) const
Increase by a constant value.
bool operator!=(const term_appl_iterator &other) const
Inequality of iterators.
term_appl_iterator operator--(int)
Post decrement an iterator.
const Term * operator->() const
Dereference the current iterator.
term_appl_iterator & operator+=(difference_type n)
Increase the iterator with n steps.
bool operator>(const term_appl_iterator &other) const
Comparison of iterators.
const Term & operator*() const
The dereference operator.
term_appl_iterator(const Term *t)
Constructor.
ptrdiff_t distance_to(const term_appl_iterator &other) const
Provide the distance to the other iterator.
An unprotected term does not change the reference count of the shared term when it is copied or moved...
bool operator<=(const unprotected_aterm_core &t) const
Comparison operator for two unprotected aterms.
bool operator>=(const unprotected_aterm_core &t) const
Comparison operator for two unprotected aterms.
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 for two unprotected aterms.
bool operator<(const unprotected_aterm_core &t) const
Comparison operator for two unprotected aterms.
bool operator==(const unprotected_aterm_core &t) const
Comparison operator.
unprotected_aterm_core() noexcept
Default constuctor.
bool type_is_appl() const noexcept
Dynamic check whether the term is an aterm.
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 operator!=(const unprotected_aterm_core &t) const
Inequality operator on two unprotected aterms.
const function_symbol & function() const
Yields the function symbol in an aterm.
bool type_is_int() const noexcept
Dynamic check whether the term is an aterm_int.
unprotected_aterm_core(const detail::_aterm *term) noexcept
Constructor.
A helper class to keep track of the number of hits and misses for cache-like data structures.
Inherit from this class to prevent it from being copyable.
noncopyable & operator=(const noncopyable &)=delete
noncopyable(const noncopyable &)=delete
Stores a reference count that can be incremented and decremented.
SizeType m_reference_count
static void count_reference_count_changes()
Increment the number of reference count changes.
shared_reference_counted()
std::size_t reference_count() const
Obtain the reference count.
void increment_reference_count() const
Increment the reference count by one.
static std::atomic< std::size_t > & reference_count_changes()
Obtain the number of times that this reference count has changed.
void decrement_reference_count() const
Decrement the reference count by one.
A reference counted reference to a shared_reference_counted object.
bool operator==(const shared_reference< T > &other) const noexcept
bool operator>=(const shared_reference &other) const noexcept
shared_reference< T > & operator=(shared_reference< T > &&other) noexcept
Move assignment constructor.
T * operator->() const noexcept
bool defined() const
Check whether the shared_reference has a valid reference.
bool operator>(const shared_reference< T > &other) const noexcept
T & operator*() const noexcept
bool tagged() const noexcept
shared_reference() noexcept
The default constructor.
void swap(shared_reference< T > &other)
Swaps *this with the other shared reference.
utilities::tagged_pointer< T > m_reference
shared_reference< T > & operator=(const shared_reference< T > &other) noexcept
Copy assignment constructor.
bool operator!=(const shared_reference< T > &other) const noexcept
bool operator<=(const shared_reference< T > &other) const noexcept
shared_reference(shared_reference< T > &&other) noexcept
Move constructor.
shared_reference(const shared_reference< T > &other) noexcept
Copy constructor.
bool operator<(const shared_reference< T > &other) const noexcept
shared_reference(T *reference) noexcept
Takes ownership of the passed reference, which means that its reference count is incremented.
A pointer storage object that uses a least significant bit as a mark. Can be used by objects that are...
const T * operator->() const
bool operator==(const tagged_pointer &other) const
bool operator>(const tagged_pointer &other) const noexcept
bool operator>=(const tagged_pointer &other) const noexcept
bool operator==(std::nullptr_t) const
void swap(tagged_pointer< T > &other)
void untag() const
Remove the tag.
bool operator<(const tagged_pointer &other) const noexcept
void operator=(std::nullptr_t)
const T & operator*() const
void tag() const
Apply a tag to the pointer that can be checked with tagged().
bool operator!=(std::nullptr_t) const
bool operator<=(const tagged_pointer &other) const noexcept
bool operator!=(const tagged_pointer &other) const
std::conditional_t< detail::GlobalThreadSafe, detail::atomic_wrapper< T * >, T * > m_pointer
Implements a simple stopwatch that starts on construction.
static constexpr bool EnableGarbageCollection
Enable garbage collection.
static constexpr bool EnableHashtableMetrics
Enable to print hashtable collision, size and number of buckets.
aterm_pool & g_term_pool()
obtain a reference to the global aterm pool.
std::aligned_storage< sizeof(aterm_pool), alignof(aterm_pool)>::type g_aterm_pool_storage
Storage for a global term pool that is not initialized.
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...
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.
static constexpr bool EnableCreationMetrics
Enable to obtain the percentage of terms found compared to allocated.
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...
function_symbol g_as_empty_list
static aterm_pool & g_aterm_pool_instance
A reference to the global term pool storage.
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.
std::size_t combine(const std::size_t hnr, const unprotected_aterm_core &term)
Auxiliary function to combine hnr with aterms.
std::size_t combine_args(std::size_t seed, const Tp &...)
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 ...
function_symbol g_as_list
static constexpr bool EnableGarbageCollectionMetrics
Enable to print garbage collection statistics.
term_appl_iterator< Derived > aterm_appl_iterator_cast(term_appl_iterator< Base > a, typename std::enable_if< std::is_base_of< aterm, Base >::value &&std::is_base_of< aterm, Derived >::value >::type *=nullptr)
This function can be used to translate an term_appl_iterator of one sort into another.
static constexpr bool EnableAggressiveGarbageCollection
Performs garbage collection intensively for testing purposes.
function_symbol g_as_int
These function symbols are used to indicate integer, list and empty list terms.
static constexpr bool EnableBlockAllocator
Enable the block allocator for terms.
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.
static constexpr bool EnableVariableRegistrationMetrics
Keep track of the number of variables registered.
void debug_print(std::ostream &o, const _aterm *t, const std::size_t d=3)
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...
void mark_term(const _aterm &root, std::stack< std::reference_wrapper< _aterm > > &todo)
Marks a term and recursively all arguments that are not reachable.
constexpr std::size_t DynamicNumberOfArguments
Indicates that the number of arguments is not known at compile time.
The main namespace for the aterm++ library.
void make_term_appl(Term &target, const function_symbol &sym, InputIterator begin, InputIterator end, TermConverter converter)
Constructor an aterm in a variable based on a function symbol and an forward iterator providing the a...
term_list< aterm > aterm_list
A term_list with elements of type aterm.
void make_term_appl(Term &target, const function_symbol &sym)
Make an term_appl consisting of a single function symbol.
Derived & reference_cast(Derived &t)
A cast from one aterm based type to another, as a reference, allowing to assign to it.
void(* term_callback)(const aterm &)
std::string pp(const atermpp::aterm &t)
Transform an aterm to an ascii string.
void make_term_appl(Term &target, const function_symbol &symbol, const Terms &...arguments)
Make an aterm application for n-arity function application.
void make_term_appl(Term &target, const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
Constructor an aterm in a variable based on a function symbol and an forward iterator providing the a...
void make_term_appl(Term &target, const function_symbol &sym, InputIterator begin, InputIterator end)
Constructor an aterm in a variable based on a function symbol and an input iterator providing the arg...
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...
const DerivedCont & container_cast(const Cont< Base > &t, typename std::enable_if_t< is_container< DerivedCont, aterm >::value &&std::is_same_v< Cont< typename DerivedCont::value_type >, DerivedCont > &&!std::is_base_of_v< DerivedCont, Cont< Base > > &&is_convertible< Base, typename DerivedCont::value_type >::value > *=nullptr)
void make_term_appl_with_index(aterm &target, const function_symbol &symbol, const Terms &...arguments)
Constructor for n-arity function application with an index.
const Derived & vertical_cast(const Base &t, typename std::enable_if< is_convertible< Base, Derived >::value >::type *=nullptr)
A cast form an aterm derived class to a class that inherits in possibly multiple steps from this clas...
const Derived & down_cast(const Base &t, typename std::enable_if< is_convertible< Base, Derived >::value &&!std::is_base_of< Derived, Base >::value >::type *=nullptr)
A cheap cast from one aterm based type to another When casting one aterm based type into another,...
const DerivedCont & vertical_cast(const Cont< Base > &t, typename std::enable_if_t< is_container< DerivedCont, aterm >::value &&std::is_same_v< Cont< typename DerivedCont::value_type >, DerivedCont > &&is_convertible< Base, typename DerivedCont::value_type >::value > *=nullptr)
Derived & reference_cast(Base &t, typename std::enable_if< is_convertible< Base, Derived >::value &&!std::is_base_of< Derived, Base >::value >::type *=nullptr)
A cast from one aterm based type to another, as a reference, allowing to assign to it.
static constexpr bool GlobalThreadSafe
Enables thread safety for the whole toolset.
std::size_t hash_combine_cheap(const std::size_t seed, const std::size_t hash_number)
Auxiliary function to combine seed with a hash number.
T * tag(const T *p)
Applies a tag to a pointer.
T * pointer(const detail::atomic_wrapper< T * > &p)
T * tag(const detail::atomic_wrapper< T * > &p)
constexpr bool is_iterable_v
static constexpr bool EnableReferenceCountMetrics
Enable to count the number of reference count changes.
bool tagged(const detail::atomic_wrapper< T * > &p)
constexpr bool is_iterator_v
void mcrl2_unused(T &&...)
Function that can be used to silence unused parameter warnings.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
void swap(atermpp::aterm &t1, atermpp::aterm &t2) noexcept
Swaps two term_applss.
void swap(mcrl2::utilities::shared_reference< T > &a, mcrl2::utilities::shared_reference< T > &b) noexcept
void swap(atermpp::unprotected_aterm_core &t1, atermpp::unprotected_aterm_core &t2) noexcept
Swaps two aterms.
int main(int argc, char *argv[])
_aterm_appl_allocator< U > other
bool operator()(const _aterm &term, const function_symbol &symbol, const Args &... args) const noexcept
bool operator()(const _aterm &term, const function_symbol &symbol, std::array< unprotected_aterm_core, N > key) const noexcept
Returns true iff first and second are value-equivalent.
bool operator()(const _aterm &term, const function_symbol &symbol, ForwardIterator begin, ForwardIterator end) const noexcept
bool operator()(const _aterm &first, const _aterm &second) const noexcept
bool operator()(const _aterm &term, const function_symbol &symbol) const noexcept
bool operator()(const _aterm &term, const function_symbol &symbol, unprotected_aterm_core arguments[]) const noexcept
Computes the hash of the given term.
std::size_t operator()(const function_symbol &symbol, const Args &... args) const noexcept
std::size_t operator()(const function_symbol &symbol, std::array< unprotected_aterm_core, N > key) const noexcept
Computes the hash of the given term.
std::size_t operator()(const function_symbol &symbol) const noexcept
std::size_t operator()(const _aterm &term) const noexcept
Implementation.
std::size_t operator()(const function_symbol &symbol, ForwardIterator begin, ForwardIterator end) const noexcept
std::size_t operator()(const function_symbol &symbol, unprotected_aterm_core arguments[]) const noexcept
Returns true iff the given term(s) or value are equivalent.
bool operator()(const _aterm_int &term, std::size_t value) const noexcept
bool operator()(const _aterm_int &first, const _aterm_int &second) const noexcept
Computes the hash of the integral term arguments.
std::size_t operator()(const _aterm_int &term) const noexcept
std::size_t operator()(std::size_t value) const noexcept
void operator()(Term &result, const Term &t) const
const Term & operator()(const Term &t) const
Term & operator()(Term &t) const
atomic_wrapper & operator=(const atomic_wrapper< T > &other)
atomic_wrapper(const atomic_wrapper< T > &other)
atomic_wrapper(const T t)
Checks whether condition holds for all types passed as variadic template.
std::tuple_element< i, std::tuple< Args... > >::type type
A typetrait that is std::true_type iff std::begin() and std::end() can be called on type T.
A typetrait that is std::true_type iff the given type has the iterator traits.
std::size_t operator()(const atermpp::aterm &t) const
std::size_t operator()(const atermpp::aterm_core &t) const
std::size_t operator()(const atermpp::detail::_aterm *term) const
std::size_t operator()(const atermpp::detail::reference_aterm< T > &t) const
std::size_t operator()(const atermpp::function_symbol &f) const
std::size_t operator()(const atermpp::unprotected_aterm_core &term) const
std::size_t operator()(const mcrl2::utilities::tagged_pointer< T > &p) const