mCRL2
Loading...
Searching...
No Matches
unordered_map_implementation.h
Go to the documentation of this file.
1// Author(s): Maurice Laveaux
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_UTILITIES_UNORDERED_MAP_IMPLEMENTATION_H
11#define MCRL2_UTILITIES_UNORDERED_MAP_IMPLEMENTATION_H
12#pragma once
13
14#include "mcrl2/utilities/unordered_map.h"
15
16#define MCRL2_UNORDERED_MAP_TEMPLATES template<typename Key, typename T, typename Hash, typename Equals, typename Allocator, bool ThreadSafe, bool Resize>
17#define MCRL2_UNORDERED_MAP_CLASS unordered_map<Key, T, Hash, Equals, Allocator, ThreadSafe, Resize>
18
19namespace mcrl2::utilities
20{
21
23template<typename ...Args>
24auto MCRL2_UNORDERED_MAP_CLASS::try_emplace(const key_type& key, Args&&... args) -> std::pair<iterator, bool>
25{
26 m_set.rehash_if_needed();
27
28 std::size_t bucket = m_set.find_bucket_index(key);
29 // If the key can be found, then return it and otherwise add it in the same bucket.
30 iterator it = m_set.find_impl(bucket, key);
31 if (it != end())
32 {
33 return std::make_pair(it, false);
34 }
35 else
36 {
37 auto [x, y] = m_set.emplace_impl(bucket, key, std::forward<Args>(args)...);
38 return std::make_pair(iterator(x), y);
39 }
40}
41
43T& MCRL2_UNORDERED_MAP_CLASS::operator[](const key_type& key)
44{
45 // Insert a new object and return a reference to it;
46 // auto pair = m_set.emplace(std::make_pair<const Key, T>(key, mapped_type()));
47 auto pair = m_set.emplace(std::make_pair(key, mapped_type()));
48
49 // The second element of the pair is mutable.
50 return const_cast<mapped_type&>((*pair.first).second);
51}
52
54const T& MCRL2_UNORDERED_MAP_CLASS::at(const key_type& key) const
55{
56 auto it = m_set.find(key);
57 assert(it != m_set.end());
58 return (*it).second;
59}
60
61#undef MCRL2_UNORDERED_MAP_TEMPLATES
62#undef MCRL2_UNORDERED_MAP_CLASS
63
64} // namespace mcrl2::utilities
65
66#endif // MCRL2_UTILITIES_UNORDERED_MAP_IMPLEMENTATION_H
#define ATERM_POOL_STORAGE_TEMPLATES
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.
Definition aterm_core.h:182
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)
Definition aterm.h:116
const_iterator end() const
Returns a const_iterator pointing past the last argument.
Definition aterm.h:172
aterm(const function_symbol &symbol, const Terms &...arguments)
Constructor for n-arity function application.
Definition aterm.h:137
const aterm & operator[](const size_type i) const
Returns the i-th argument.
Definition aterm.h:187
aterm()
Default constructor.
Definition aterm.h:48
const_iterator begin() const
Returns an iterator pointing to the first argument.
Definition aterm.h:165
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...
Definition aterm.h:96
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...
Definition aterm.h:75
aterm & operator=(const aterm &other) noexcept=default
const function_symbol & function() const
Returns the function symbol belonging to an aterm.
Definition aterm.h:144
std::size_t size_type
An unsigned integral type.
Definition aterm.h:36
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.
Definition aterm.h:30
ptrdiff_t difference_type
A signed integral type.
Definition aterm.h:39
bool empty() const
Returns true if the term has no arguments.
Definition aterm.h:158
aterm & operator=(aterm &&other) noexcept=default
aterm(const function_symbol &sym)
Constructor.
Definition aterm.h:128
term_appl_iterator< aterm > iterator
Iterator used to iterate through an term_appl.
Definition aterm.h:42
size_type size() const
Returns the number of arguments of this term.
Definition aterm.h:151
term_appl_iterator< aterm > const_iterator
Const iterator used to iterate through an term_appl.
Definition aterm.h:45
constexpr size_type max_size() const
Returns the largest possible number of arguments.
Definition aterm.h:179
This class allocates _aterm_appl objects where the size is based on the arity of the function symbol.
Definition aterm.h:120
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.
Definition aterm.h:150
T * allocate_args(const function_symbol &symbol, ForwardIterator, ForwardIterator)
Allocates space for an _aterm_appl where the arity is given by the function symbol.
Definition aterm.h:141
std::allocator< char > m_packed_allocator
Definition aterm.h:189
static constexpr std::size_t term_appl_size(std::size_t arity)
Definition aterm.h:123
void destroy(T *element)
Specialize destroy for _aterm_appl to only destroy the function symbol. The reference count for the a...
Definition aterm.h:165
constexpr std::size_t capacity() const
Definition aterm.h:184
void deallocate(T *element, std::size_t)
Definition aterm.h:174
constexpr bool has_free_slots() const noexcept
Definition aterm.h:186
constexpr std::size_t consolidate() const noexcept
Definition aterm.h:185
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.
Definition aterm.h:159
This class stores a term followed by N arguments. Where N should be equal to the arity of the functio...
Definition aterm.h:34
_aterm_appl(const function_symbol &sym, const Terms &...arguments)
Constructs a term application with the given symbol and arguments.
Definition aterm.h:41
_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.
Definition aterm.h:79
_aterm_appl(const function_symbol &sym, std::array< unprotected_aterm_core, N > arguments)
Constructs a term application with the given symbol and arguments.
Definition aterm.h:69
std::array< unprotected_aterm_core, N > m_arguments
Definition aterm.h:109
operator _aterm_appl< 1 > &()
Convert any known number of arguments aterm<N> to the default _aterm_appl.
Definition aterm.h:103
_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...
Definition aterm.h:52
const aterm_core & arg(std::size_t index) const
Definition aterm.h:97
The underlying integer term that actually carries the integer data.
Definition aterm_int.h:22
std::size_t value() const noexcept
Definition aterm_int.h:30
_aterm_int(std::size_t value)
Constructs the underlying term from a given value.
Definition aterm_int.h:25
This is the class to which an aterm points.
Definition aterm_core.h:48
bool is_marked() const
Check if the term is already marked.
Definition aterm_core.h:73
_aterm(const function_symbol &symbol)
Create a term from a function symbol.
Definition aterm_core.h:51
function_symbol m_function_symbol
Definition aterm_core.h:79
const function_symbol & function() const noexcept
Definition aterm_core.h:55
void mark() const
Mark this term to be garbage collected.
Definition aterm_core.h:61
void unmark() const
Remove the mark from a term.
Definition aterm_core.h:67
Stores the data for a function symbol (name, arity) pair.
const std::string & name() const noexcept
bool operator==(const _function_symbol &f) const noexcept
std::size_t arity() const noexcept
aterm_allocator(aterm_allocator &&)=default
T * allocate(size_type n, const void *hint=nullptr)
aterm_allocator & operator=(aterm_allocator &&)=default
std::function< std::size_t()> size_func
std::function< void(term_mark_stack &)> mark_func
aterm_container(std::function< void(term_mark_stack &)> mark_func, std::function< std::size_t()> size_func)
void mark(term_mark_stack &todo) const
Ensure that all the terms in the containers.
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.
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.
Definition aterm_pool.h:82
const function_symbol & as_int() noexcept
Definition aterm_pool.h:118
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
Definition aterm_pool.h:216
std::atomic< long > m_count_until_resize
Definition aterm_pool.h:214
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.
Definition aterm_pool.h:189
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.
Definition aterm_pool.h:192
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.
Definition aterm_pool.h:210
const function_symbol & as_empty_list() noexcept
Definition aterm_pool.h:124
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
Definition aterm_pool.h:121
aterm_core m_empty_list
Represents an empty list.
Definition aterm_pool.h:222
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.
Definition aterm_pool.h:213
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.
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
Definition aterm_pool.h:115
mcrl2::utilities::shared_mutex m_shared_mutex
Garbage collection is enabled.
Definition aterm_pool.h:219
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()
Definition aterm_pool.h:132
integer_term_storage m_int_storage
Storage for integral terms.
Definition aterm_pool.h:195
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.
Definition aterm_pool.h:130
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 sweep()
Collect all garbage function symbols.
std::map< std::string, std::shared_ptr< std::size_t > > m_prefix_to_register_function_map
A map that records a function for each prefix that must be called to set the postfix number to a suff...
void resize_if_needed()
Resize the function symbol pool if necessary.
const function_symbol & as_int() noexcept
unordered_set m_symbol_set
Stores the underlying function symbols.
const function_symbol & as_empty_list() noexcept
std::size_t capacity() const noexcept
mcrl2::utilities::cache_metric m_function_symbol_metrics
Track the number of function symbols found in or added to the set.
const function_symbol & as_list() noexcept
generic_aterm_container & operator=(const generic_aterm_container &)
generic_aterm_container(const generic_aterm_container &)=delete
generic_aterm_container(generic_aterm_container &&)=delete
generic_aterm_container & operator=(generic_aterm_container &)
generic_aterm_container(const Container &container)
Constructor.
reference_aterm(Args &&... args) noexcept
void mark(std::stack< std::reference_wrapper< detail::_aterm > > &todo) const
reference_aterm(const T_type &other) noexcept
const reference_aterm & operator=(T_type &&other) noexcept
reference_aterm(const Args &... args) noexcept
operator T_type &()
Converts implicitly to a protected term of type T.
reference_aterm(T_type &&other) noexcept
const reference_aterm & operator=(const T_type &other) noexcept
void mark()
Mark the terms created by this thread to prevent them being garbage collected.
Definition aterm_pool.h:46
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)
Definition aterm_pool.h:226
void print_local_performance_statistics() const
Print performance statistics for data stored for this thread.
Definition aterm_pool.h:52
std::function< std::size_t()> m_protection_set_size_function
Definition aterm_pool.h:70
void collect()
Triggers a global garbage collection.
void deregister_container(aterm_container *variable)
Removes the given container from the active variables.
void register_container(aterm_container *variable)
Consider the given container when marking underlying terms.
mcrl2::utilities::shared_mutex m_shared_mutex
Keeps track of pointers to all existing aterm variables and containers.
void create_int(aterm &term, std::size_t val)
thread_aterm_pool_interface m_thread_interface
The registered thread aterm pool.
void create_appl(aterm &term, const function_symbol &sym, const Terms &... arguments)
thread_aterm_pool(aterm_pool &global_pool)
function_symbol create_function_symbol(const std::string &name, const std::size_t arity, const bool check_for_registered_functions=false)
void deregister_variable(aterm_core *variable)
Removes the given variable from the active variables.
void create_term(aterm &term, const function_symbol &sym)
bool is_shared_locked()
Returns true iff we are in a shared section.
mcrl2::utilities::hashtable< detail::aterm_container * > * m_containers
void create_appl_dynamic(aterm &term, const function_symbol &sym, ATermConverter convert_to_aterm, InputIterator begin, InputIterator end)
\threadsafe
function_symbol create_function_symbol(std::string &&name, const std::size_t arity, const bool check_for_registered_functions=false)
mcrl2::utilities::hashtable< aterm_core * > * m_variables
std::stack< std::reference_wrapper< _aterm > > m_todo
A reusable todo stack.
void create_appl_dynamic(aterm &term, const function_symbol &sym, ForwardIterator begin, ForwardIterator end)
void register_variable(aterm_core *variable)
Consider the given variable when marking underlying terms.
mcrl2::utilities::lock_guard lock()
Acquire an exclusive lock.
void create_appl_index(aterm &term, const function_symbol &sym, const Terms &... arguments)
mcrl2::utilities::shared_guard lock_shared()
Acquire a shared lock on this thread aterm pool.
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.
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
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.
A list of aterm objects.
Definition aterm_list.h:24
An unprotected term does not change the reference count of the shared term when it is copied or moved...
Definition aterm_core.h:32
bool operator<=(const unprotected_aterm_core &t) const
Comparison operator for two unprotected aterms.
Definition aterm_core.h:122
bool operator>=(const unprotected_aterm_core &t) const
Comparison operator for two unprotected aterms.
Definition aterm_core.h:131
bool type_is_list() const noexcept
Dynamic check whether the term is an aterm_list.
Definition aterm_core.h:72
void swap(unprotected_aterm_core &t) noexcept
Swaps this term with its argument.
Definition aterm_core.h:152
bool operator>(const unprotected_aterm_core &t) const
Comparison operator for two unprotected aterms.
Definition aterm_core.h:113
bool operator<(const unprotected_aterm_core &t) const
Comparison operator for two unprotected aterms.
Definition aterm_core.h:104
bool operator==(const unprotected_aterm_core &t) const
Comparison operator.
Definition aterm_core.h:83
unprotected_aterm_core() noexcept
Default constuctor.
Definition aterm_core.h:41
bool type_is_appl() const noexcept
Dynamic check whether the term is an aterm.
Definition aterm_core.h:55
bool defined() const
Returns true if this term is not equal to the term assigned by the default constructor of aterms,...
Definition aterm_core.h:143
friend detail::_aterm * detail::address(const unprotected_aterm_core &t)
const detail::_aterm * m_term
Definition aterm_core.h:36
bool operator!=(const unprotected_aterm_core &t) const
Inequality operator on two unprotected aterms.
Definition aterm_core.h:92
const function_symbol & function() const
Yields the function symbol in an aterm.
Definition aterm_core.h:161
bool type_is_int() const noexcept
Dynamic check whether the term is an aterm_int.
Definition aterm_core.h:63
unprotected_aterm_core(const detail::_aterm *term) noexcept
Constructor.
Definition aterm_core.h:47
File output class.
Definition logger.h:318
static void set_stream(FILE *stream)
Definition logger.h:336
virtual ~file_output()
Definition logger.h:331
virtual void output(const log_level_t level, const time_t timestamp, const std::string &msg, const bool print_time_information) override
Definition logger.h:350
static std::atomic< FILE * > & get_stream()
Obtain the underlying stream used to print to a file.
Definition logger.h:321
static std::string format(const log_level_t level, const time_t timestamp, const std::string &msg, const bool print_time_information)
Format msg,.
Definition logger.h:259
Mixin that takes care of formatting of a message.
Definition logger.h:273
static std::atomic< std::size_t > & caret_pos()
Definition logger.h:292
static std::atomic< bool > & last_message_ended_with_newline()
Records whether the last message that was printed ended with a new line.
Definition logger.h:278
static std::atomic< std::size_t > & last_caret_pos()
Definition logger.h:299
static std::atomic< bool > & last_message_was_status()
Definition logger.h:285
static std::string format(const log_level_t level, const time_t timestamp, const std::string &msg, const bool print_time_information)
Prefix each line in s with some extra information. The things that are added are:
Definition logger.cpp:32
Class for logging messages.
Definition logger.h:129
static bool & m_print_time_information()
An indication whether time information should be printed.
Definition logger.h:148
static void clear_report_time_info()
Indicate that timing information should not be printed.
Definition logger.h:229
static void unregister_output_policy(output_policy &policy)
Unregister output policy.
Definition logger.h:191
static void set_report_time_info()
Indicate that timing information should be printed.
Definition logger.h:223
log_level_t m_level
The loglevel of the current message.
Definition logger.h:136
static std::set< output_policy * > & output_policies()
Output policies.
Definition logger.h:156
static log_level_t get_reporting_level()
Get reporting level.
Definition logger.h:217
static void set_reporting_level(const log_level_t level)
Set reporting level.
Definition logger.h:210
std::ostringstream & get()
Definition logger.h:243
logger(const log_level_t l)
Default constructor.
Definition logger.h:164
static void clear_output_policies()
Clear all output policies.
Definition logger.h:202
time_t m_timestamp
Timestamp of the current message.
Definition logger.h:139
static void register_output_policy(output_policy &policy)
Register output policy.
Definition logger.h:184
~logger()
Destructor; flushes output. Flushing during destruction is important to confer thread safety to the l...
Definition logger.h:174
static bool get_report_time_info()
Get whether timing information is printed.
Definition logger.h:236
static std::atomic< log_level_t > & log_level()
Definition logger.h:141
std::ostringstream m_os
Stream that is printed to internally Collects the full debug message that we are currently printing.
Definition logger.h:133
Interface class for output policy.
Definition logger.h:100
output_policy()
Constructor.
Definition logger.h:103
virtual void output(const log_level_t level, const time_t timestamp, const std::string &msg, const bool print_time_information)=0
Output message.
virtual ~output_policy()
Destructor.
Definition logger.h:107
The block allocator provides the allocator interface for the memory pool class. As such is can be use...
block_allocator & operator=(block_allocator &&)=default
block_allocator(block_allocator &&)=default
T * allocate(size_type n, const void *hint=nullptr)
A helper class to keep track of the number of hits and misses for cache-like data structures.
void reset()
Resets the cache counters.
void miss()
Should be called when searching the cache was a miss.
void hit()
Should be called when searching the cache was a hit.
Iterator over all keys in a bucket list.
bool operator!=(const key_iterator &it) const noexcept
reference operator*() const
Only allowed whenever it points to an actual node (not before_begin or end)
bool operator==(const key_iterator &it) const noexcept
operator key_iterator() const
Implicit conversion to const_iterator.
pointer operator->() const
Only allowed whenever it points to an actual node (not before_begin or end)
const node_base * get_node() const noexcept
The nodes of the bucket list without carrying any additional informations. Used to make no different ...
Definition bucket_list.h:54
std::atomic< node_base * > m_next
Pointer to the next node.
Definition bucket_list.h:77
void set_next(node_base *next) noexcept
Set the next pointer to the given next pointer.
Definition bucket_list.h:70
bool exchange(node_base *&expected, node_base *value)
Definition bucket_list.h:73
node(Args &&... args)
Constructs a key by using the given arguments.
Definition bucket_list.h:87
const Key & key() const noexcept
Definition bucket_list.h:93
This essentially implements the std::forward_list, with the difference that it does not own the nodes...
Definition bucket_list.h:48
void splice_after(const_iterator pos, bucket_list &other)
Moves the elements from other into this bucket after the given position.
iterator erase_after(NodeAllocator &allocator, const_iterator it)
Removes the element after the given iterator from the list. The returned iterator.
void clear(NodeAllocator &allocator)
Empties the bucket list.
const_iterator before_begin() const
std::pair< iterator, bool > emplace_front_unique(NodeAllocator &allocator, const Equals &equals, Args &&...args)
Constructs an element using the allocator with the given arguments and insert it in the front of the ...
void splice_front(const_iterator pos, bucket_list &other)
Moves the first node from the given bucket into this bucket after the given position.
node_base m_head
The first node in the bucket list.
void emplace_front(NodeAllocator &allocator, Args &&...args)
Constructs an element using the allocator with the given arguments and insert it in the front.
Iterator over all keys in a bucket list.
Definition free_list.h:77
static constexpr Sentinel EndIterator
A end of the iterator sentinel.
Definition free_list.h:89
bool operator!=(const slot_iterator &it) const noexcept
Definition free_list.h:121
std::enable_if< Constant_, reference >::type operator*() const
Definition free_list.h:116
std::enable_if<!Constant_, reference >::type operator*()
Definition free_list.h:110
This essentially implements the std::forward_list, with the difference that it does not own the nodes...
Definition free_list.h:32
bool empty() const noexcept
Definition free_list.h:219
void clear()
Empties the bucket list.
Definition free_list.h:177
void erase_after(iterator position, iterator last)
Erases elements in the range (position, last], constant complexity since no destructors will be calle...
Definition free_list.h:250
bool contains(Element *pointer)
Definition free_list.h:180
static constexpr std::uintptr_t FreeListSentinel
A sentinel value for the next of a slot to indicate that it belonged to the freelist.
Definition free_list.h:36
void push_front(slot &slot)
Puts the given node before the head of the list.
Definition free_list.h:242
const_iterator before_begin() const
Definition free_list.h:159
slot m_head
The first node in the bucket list.
Definition free_list.h:262
const_iterator begin() const
Definition free_list.h:155
iterator erase_after(iterator it)
Removes the element after the given iterator from the list. The returned iterator.
Definition free_list.h:162
Element & pop_front()
Removes the head of the list and returns a reference to this head slot.
Definition free_list.h:234
void destructive_mark()
Mark all elements in this list with a special value, destroys the list.
Definition free_list.h:206
slot & head() noexcept
Provides access to the head as if it was an actual slot.
Definition free_list.h:257
iterator insert_after(iterator it, slot &element)
Inserts an element at the position after the iterator.
Definition free_list.h:225
const_iterator end() const
Definition free_list.h:156
const slot & head() const noexcept
Definition free_list.h:258
A set that assigns each element an unique index.
Definition hashtable.h:27
iterator end()
End of the forward iterator.
Definition hashtable.h:67
size_type size() const
The number of elements in the indexed set.
Definition hashtable.h:140
iterator end() const
End of the forward iterator.
Definition hashtable.h:80
void clear()
Clears the indexed set by removing all its elements. It is not guaranteed that the memory is released...
Definition hashtable.h:72
const_iterator crend() const
End of the reverse const_iterator.
Definition hashtable.h:116
iterator find(const key_type &key)
Find the given key and returns an iterator to that position.
Definition hashtable.h:150
iterator rbegin()
Reverse iterator going through the elements in the set from the largest to the smallest index.
Definition hashtable.h:98
std::vector< Key >::iterator iterator
Definition hashtable.h:40
std::pair< const key_type, size_type > value_type
Definition hashtable.h:31
std::vector< Key >::reverse_iterator reverse_iterator
Definition hashtable.h:43
void rehash(std::size_t size)
Resizes the hash table to the given power of two size.
Definition hashtable.h:24
const value_type * const_pointer
Definition hashtable.h:38
hashtable(std::size_t initial_hashtable_size, const hasher &hash=hasher(), const key_equal &equals=key_equal())
Constructor of an empty index set. Starts with a hashtable of the indicated size.
Definition hashtable.h:60
void resize()
Resize the hashtable. This is not done automatically.
Definition hashtable.h:84
std::vector< Key >::const_reverse_iterator const_reverse_iterator
Definition hashtable.h:44
std::size_t get_index(const key_type &key)
Definition hashtable.h:166
hashtable()
Constructor of an empty indexed set. Starts with a hashtable of size 128.
Definition hashtable.h:54
const_iterator cbegin() const
const_iterator going through the elements in the set numbered from zero upwards.
Definition hashtable.h:86
size_type m_buckets_mask
Always equal to m_hashtable.size() - 1.
Definition hashtable.h:164
bool must_resize()
Check whether the hashtable must be resized. This is not automatic and must be done explicitly.
Definition hashtable.h:78
iterator begin()
Forward iterator which runs through the elements from the lowest to the largest number.
Definition hashtable.h:61
std::pair< iterator, bool > insert(const key_type &key)
Insert a key in the indexed set and return its index.
Definition hashtable.h:90
const_iterator crbegin() const
Reverse const_iterator going through the elements from the highest to the lowest numbered element.
Definition hashtable.h:110
std::vector< Key > m_hashtable
Definition hashtable.h:156
const value_type & const_reference
Definition hashtable.h:36
std::size_t m_number_of_elements
Definition hashtable.h:161
iterator rend()
End of the reverse iterator.
Definition hashtable.h:104
iterator begin() const
Forward iterator which runs through the elements from the lowest to the largest number.
Definition hashtable.h:74
const_iterator cend() const
End of the forward const_iterator.
Definition hashtable.h:92
std::vector< Key >::const_iterator const_iterator
Definition hashtable.h:41
std::ptrdiff_t difference_type
Definition hashtable.h:46
iterator erase(const key_type &key)
Erases the key assuming that this key is present in the hashtable..
Definition hashtable.h:118
An exclusive lock guard for the shared_mutex.
void unlock()
Unlocks the acquired shared guard explicitly. Otherwise, performed in destructor.
lock_guard(shared_mutex &mutex)
The memory pool allocates elements of size T from blocks.
Definition memory_pool.h:34
~memory_pool()
Triggers the (possibly non-trivial) destructor of all elements stored in the pool.
Definition memory_pool.h:40
std::size_t capacity() const noexcept
memory_pool & operator=(memory_pool &&other)=default
memory_pool(memory_pool &&other)=default
T * allocate()
Reuses memory from block and allocates a new block when no slots are free.
Definition memory_pool.h:80
void deallocate(T *pointer)
Free the memory used by the given pointer that has been allocated by this pool.
std::size_t consolidate()
Frees blocks that are no longer storing elements of T.
mcrl2::utilities::mutex m_block_mutex
Ensures that the block list is only modified by a single thread.
bool has_free_slots() const noexcept
Freelist m_freelist
Indicates the head of the freelist.
std::forward_list< Block > m_blocks
The list of blocks allocated by this pool.
SizeType m_number_of_blocks
Equal to the size of the blocks array to prevent iterating over the block list.
This is simply an exclusive lock based on the standard library with the ability to perform no locks w...
Definition mutex.h:23
std::mutex m_mutex
Definition mutex.h:39
Inherit from this class to prevent it from being copyable.
Definition noncopyable.h:21
noncopyable & operator=(const noncopyable &)=delete
noncopyable(const noncopyable &)=delete
A shared lock guard for the shared_mutex.
void lock_shared()
Locks the guard again explicitly.
shared_guard(shared_mutex &mutex)
void unlock_shared()
Unlocks the acquired shared guard explicitly. Otherwise, performed in destructor.
std::atomic< bool > m_forbidden_flag
std::atomic< bool > m_busy_flag
A boolean flag indicating whether this thread is working inside the global aterm pool.
shared_mutex(shared_mutex &&other)
void wait_for_busy() const
Waits for the busy flag to become false.
shared_mutex(const shared_mutex &other)
The copy/move constructor/assignment should not be called while any lock_guard or shared_guard is ali...
std::size_t m_lock_depth
It can happen that un/lock_shared calls are nested, so keep track of the nesting depth and only actua...
std::shared_ptr< shared_mutex_data > m_shared
shared_mutex & operator=(const shared_mutex &other)
shared_mutex & operator=(shared_mutex &&other)
Stores a reference count that can be incremented and decremented.
static void count_reference_count_changes()
Increment the number of reference count changes.
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.
bool defined() const
Check whether the shared_reference has a valid reference.
bool operator>(const shared_reference< T > &other) 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.
Provides (a subset of) the interface of std::array<T> for a portion of preallocated memory....
Definition stack_array.h:30
const_iterator begin() const
Definition stack_array.h:59
std::size_t size() const
Definition stack_array.h:75
reverse_iterator rend()
Definition stack_array.h:72
std::size_t max_size() const
Definition stack_array.h:77
stack_array(T *reserved_memory, std::size_t N)
The given pointer should be able to hold N element of sizeof(T) bytes.
Definition stack_array.h:38
T & operator[](std::size_t index)
Definition stack_array.h:79
reverse_iterator rbegin()
Definition stack_array.h:69
const_iterator end() const
Definition stack_array.h:62
const_reverse_iterator rend() const
Definition stack_array.h:73
const_reverse_iterator rbegin() const
Definition stack_array.h:70
A pointer storage object that uses a least significant bit as a mark. Can be used by objects that are...
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 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
A class for a map of keys to values in T based using the simple hash table set implementation.
unordered_map(std::size_t initial_size, const hasher &hash=hasher(), const key_equal &equals=key_equal())
Constructs an unordered_map that can store initial_size number of elements before resizing.
size_type bucket_size(size_type n) const noexcept
std::pair< iterator, bool > insert_or_assign(const Key &k, M &&obj)
local_iterator begin(size_type n)
iterator try_emplace(const_iterator, const Key &k, Args &&... args)
std::pair< iterator, bool > try_emplace(const key_type &key, Args &&... args)
std::pair< iterator, bool > insert(const value_type &pair)
Inserts elements.
iterator find(const Args &... args)
const_iterator begin() const
const_iterator cend() const
const allocator_type & get_allocator() const noexcept
const_local_iterator cend(size_type n) const
size_type bucket(const key_type &key) const noexcept
const_iterator cbegin() const
iterator try_emplace(const_iterator, Key &&k, Args &&... args)
iterator erase(const_iterator it)
const_iterator find(const Args &... args) const
void rehash(size_type number_of_buckets)
Resize the number buckets to at least number_of_buckets.
const T & at(const key_type &key) const
Provides access to the value associated with the given key.
void erase(const key_type &key)
Erases elements.
std::pair< unordered_map::iterator, bool > insert_return_type
const_iterator end() const
std::pair< iterator, bool > insert_or_assign(const_iterator, const Key &k, M &&obj)
allocator_type & get_allocator() noexcept
size_type max_size() const noexcept
std::pair< iterator, bool > insert(const_iterator hint, const value_type &pair)
mapped_type & operator[](const key_type &key)
Provides access to the value associated with the given key, constructs a default value whenever the k...
bool empty() const noexcept
const_local_iterator end(size_type n) const
std::pair< iterator, bool > insert_or_assign(const_iterator, Key &&k, M &&obj)
Set m_set
The underlying set storing <key, value> pairs.
const_local_iterator cbegin(size_type n) const
size_type count(const key_type &key) const
void reserve(size_type count)
Resizes the set to the given number of elements.
iterator emplace_hint(const_iterator, Args &&... args)
const_local_iterator begin(size_type n) const
void max_load_factor(float factor)
size_type bucket_count() const noexcept
size_type capacity()
Number of elements that can be stored before rehash.
local_iterator end(size_type n)
void clear()
Clears the content.
size_type max_bucket_count() const noexcept
std::pair< iterator, bool > insert_or_assign(Key &&k, M &&obj)
std::pair< iterator, bool > emplace(Args &&... args)
static constexpr bool allow_transparent
True iff the hash and equals functions allow transparent lookup,.
An iterator over all elements in the unordered set.
unordered_set_iterator(bucket_it it, bucket_it end, key_it_type before_it, key_it_type key)
Construct an iterator over all keys passed in this bucket and all remaining buckets.
void goto_next_bucket()
Iterate to the next non-empty bucket.
unordered_set_iterator(bucket_it it)
Construct the end iterator.
unordered_set_iterator(bucket_it it, bucket_it end)
Construct the begin iterator (over all elements).
bool operator==(const unordered_set_iterator &other) const
bool operator!=(const unordered_set_iterator &other) const
A unordered_set with a subset of the interface of std::unordered_set that only stores a single pointe...
std::vector< std::mutex > m_bucket_mutexes
const_local_iterator cbegin(size_type n) const
const_local_iterator end(size_type n) const
void erase(const Args &... args)
Erases the given key_type(args...) from the unordered set.
const_iterator find_impl(size_type bucket_index, const Args &... args) const
Searches for the element in the given bucket.
const_local_iterator begin(size_type n) const
size_type count(const Args &... args) const
Counts the number of occurrences of the given key (1 when it exists and 0 otherwise).
size_type find_bucket_index(const Args &... args) const
std::vector< bucket_type > m_buckets
std::pair< iterator, bool > emplace_impl(size_type bucket_index, Args &&... args)
Inserts T(args...) into the given bucket, assumes that it did not exists before.
const_iterator cend() const
size_type bucket_count() const noexcept
bool empty() const noexcept
void erase_impl(const Args &... args)
Removes T(args...) from the set.
const_iterator begin() const
static constexpr bool allow_transparent
True iff the hash and equals functions allow transparent lookup,.
const_iterator end() const
std::conditional_t< ThreadSafe, std::atomic< size_type >, size_type > m_buckets_mask
Always equal to m_buckets.size() - 1.
size_type max_bucket_count() const noexcept
allocator_type & get_allocator() noexcept
std::pair< iterator, bool > emplace(Args &&... args)
Inserts an element Key(args...) into the set if it did not already exist.
void rehash_if_needed()
Resizes the hash table if necessary.
iterator find(const Args &... args)
const_iterator cbegin() const
std::conditional_t< ThreadSafe, std::atomic< size_type >, size_type > m_number_of_elements
The number of elements stored in this set.
size_type size() const noexcept
void clear()
Removes all elements from the set.
unordered_set(const unordered_set &set)
iterator erase(const_iterator it)
Erases the element pointed to by the iterator.
size_type max_size() const noexcept
void max_load_factor(float factor)
size_type bucket(const key_type &key) const noexcept
size_type capacity() const noexcept
local_iterator end(size_type n)
unordered_set(unordered_set &&other)=default
const_local_iterator cend(size_type n) const
const_iterator find(const Args &... args) const
Searches whether an object key_type(args...) occurs in the set.
void rehash(size_type number_of_buckets)
Resize the number buckets to at least number_of_buckets.
unordered_set & operator=(const unordered_set &set)
local_iterator begin(size_type n)
size_type bucket_size(size_type n) const noexcept
unordered_set(size_type bucket_count, const hasher &hash=hasher(), const key_equal &equals=key_equal())
Constructs an unordered_set that contains bucket_count number of buckets.
unordered_set & operator=(unordered_set &&other)=default
const allocator_type & get_allocator() const noexcept
void reserve(size_type count)
Resizes the set to the given number of elements.
Implements a simple stopwatch that starts on construction.
Definition stopwatch.h:17
double seconds()
Definition stopwatch.h:37
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:391
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.
Definition aterm_hash.h:158
std::size_t combine_args(std::size_t seed, const Tp &...)
Definition aterm_hash.h:247
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.
Definition aterm_hash.h:78
The main namespace for the aterm++ library.
Definition algorithm.h:21
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...
Definition aterm.h:268
void mark_term(const aterm_core &t, term_mark_stack &todo)
term_list< aterm > aterm_list
A term_list with elements of type aterm.
Definition aterm_list.h:497
void make_term_appl(Term &target, const function_symbol &sym)
Make an term_appl consisting of a single function symbol.
Definition aterm.h:286
Derived & reference_cast(Derived &t)
A cast from one aterm based type to another, as a reference, allowing to assign to it.
Definition aterm.h:370
void(* term_callback)(const aterm &)
Definition aterm.h:194
std::string pp(const atermpp::aterm &t)
Transform an aterm to an ascii string.
Definition aterm.h:440
std::stack< std::reference_wrapper< detail::_aterm > > term_mark_stack
void make_term_appl(Term &target, const function_symbol &symbol, const Terms &...arguments)
Make an aterm application for n-arity function application.
Definition aterm.h:301
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...
Definition aterm.h:213
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...
Definition aterm.h:241
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)
Definition aterm.h:379
void make_term_appl_with_index(aterm &target, const function_symbol &symbol, const Terms &...arguments)
Constructor for n-arity function application with an index.
Definition aterm.h:313
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...
Definition aterm.h:399
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,...
Definition aterm.h:337
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)
Definition aterm.h:409
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.
Definition aterm.h:352
output_policy & default_output_policy()
The default output policy used by the logger.
Definition logger.h:366
std::string log_level_to_string(const log_level_t level)
Convert log level to string This string is used to prefix messages in the logging output.
Definition logger.h:45
std::string format_time(const time_t *t)
Definition logger.cpp:17
std::set< output_policy * > initialise_output_policies()
Initialise the output policies. This returns the singleton set containing the default output policy.
Definition logger.h:375
log_level_t
Log levels that are supported.
Definition logger.h:31
@ warning
Definition logger.h:34
@ verbose
Definition logger.h:37
log_level_t log_level_from_string(const std::string &s)
Convert string to log level.
Definition logger.h:54
bool mCRL2logEnabled(const log_level_t level)
Definition logger.h:383
std::size_t hash_combine(const std::size_t h1, const std::size_t h2)
static constexpr Sentinel EndIterator
A end of the iterator sentinel.
Definition bucket_list.h:28
auto allocate(Allocator &allocator, const Args &... args) -> decltype(allocator.allocate_args(args...))
A compile time check for allocate_args in the given allocator, calls allocate(1) otherwise.
Definition bucket_list.h:32
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.
float bytes_to_megabytes(std::size_t bytes)
std::string string_join(const Container &c, const std::string &separator)
Joins a sequence of strings. This is a replacement for boost::algorithm::join, since it gives stack o...
static constexpr std::size_t minimum_size
static constexpr long BucketsPerMutex
Number of buckets per mutex.
void number2string(std::size_t number, std::string &buffer, std::size_t start_position)
Convert a number to a string in the buffer starting at position start_position.
T * tag(const T *p)
Applies a tag to a pointer.
std::vector< std::string > split_paragraphs(const std::string &text)
Split a string into paragraphs.
std::string read_text(std::istream &in)
Read text from a stream.
bool tagged(const T *p)
void trim(std::string &text)
Remove all trailing and leading spaces from the input.
std::string regex_replace(const std::string &src, const std::string &dest, const std::string &text)
Regular expression replacement in a string.
T * pointer(const detail::atomic_wrapper< T * > &p)
T * pointer(const T *p)
std::string read_text(const std::string &filename, bool warn=false)
Read text from a file.
static T round_up_to_power_of_two(T value)
std::string word_wrap_text(const std::string &text, unsigned int max_line_length=78)
Apply word wrapping to a text.
bool is_numeric_string(const std::string &s)
Test if a string is a number.
std::string to_string(const T &x)
Transform parameter into string.
T * tag(const detail::atomic_wrapper< T * > &p)
std::vector< std::string > regex_split(const std::string &text, const std::string &sep)
Split a string using a regular expression separator.
std::string remove_comments(const std::string &text)
Remove comments from a text (everything from '' until end of line).
constexpr bool is_iterable_v
Definition type_traits.h:50
std::string trim_copy(const std::string &text)
Remove all trailing and leading spaces from the input.
static constexpr bool EnableLockfreeInsertion
Enables lockfree implementation of emplace.
std::string remove_whitespace(const std::string &text)
Removes whitespace from a string.
bool contains_only_ascii_symbols(const CharContainer &input)
Checks whether the input only contains proper ascii characters, including common control characters.
static constexpr bool EnableReferenceCountMetrics
Enable to count the number of reference count changes.
std::string number2string(std::size_t number)
Convert a number to string.
static constexpr bool is_power_of_two(T value)
std::vector< std::string > split(const std::string &line, const std::string &separators)
Split the text.
void print_performance_statistics(const T &unordered_set)
Prints various information for unordered_set like data structures.
bool tagged(const detail::atomic_wrapper< T * > &p)
constexpr bool is_iterator_v
Definition type_traits.h:53
void mcrl2_unused(T &&...)
Function that can be used to silence unused parameter warnings.
Definition unused.h:20
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.
Definition aterm.h:475
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.
Definition aterm.h:462
int main(int argc, char *argv[])
#define MCRL2_DECLARE_STACK_ARRAY(NAME, TYPE, SIZE)
Declares a stack_array<TYPE> with the specified NAME that stores SIZE elements type TYPE.
Definition stack_array.h:98
#define MCRL2_STACK_ARRAY_NAME(NAME)
Define a (hopefully) unique name for the underlying reserved stack memory.
Definition stack_array.h:94
_aterm_appl_allocator< U > other
Definition aterm.h:136
aterm_allocator< U, typename Allocator::template rebind< U >::other > 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.
Definition aterm_hash.h:125
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.
Definition aterm_hash.h:101
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
Definition aterm_hash.h:232
Computes the hash of the given term.
Definition aterm_hash.h:85
std::size_t operator()(const function_symbol &symbol) const noexcept
Definition aterm_hash.h:185
std::size_t operator()(const _aterm &term) const noexcept
Implementation.
Definition aterm_hash.h:167
std::size_t operator()(const function_symbol &symbol, ForwardIterator begin, ForwardIterator end) const noexcept
Definition aterm_hash.h:210
std::size_t operator()(const function_symbol &symbol, unprotected_aterm_core arguments[]) const noexcept
Definition aterm_hash.h:192
Returns true iff the given term(s) or value are equivalent.
Definition aterm_hash.h:149
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.
Definition aterm_hash.h:113
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
Definition aterm_list.h:35
const Term & operator()(const Term &t) const
Definition aterm_list.h:40
Term & operator()(Term &t) const
Definition aterm_list.h:45
True iff the given function symbols are equal to eachother or to the given key.
bool operator()(const _function_symbol &first, const _function_symbol &second) const noexcept
Computes the hash for given function symbol objects and for the function_symbol_key.
std::size_t operator()(const _function_symbol &symbol) const noexcept
block_allocator< U, ElementsPerBlock, ThreadSafe > other
atomic_wrapper & operator=(const atomic_wrapper< T > &other)
atomic_wrapper(const atomic_wrapper< T > &other)
Checks whether condition holds for all types passed as variadic template.
Definition type_traits.h:41
A typetrait that is std::true_type iff std::begin() and std::end() can be called on type T.
Definition type_traits.h:21
A typetrait that is std::true_type iff the given type has the iterator traits.
Definition type_traits.h:31
void unregister_mutex(shared_mutex *shared_mutex)
void register_mutex(shared_mutex *shared_mutex)
Adds a shared mutex to the data.
std::vector< shared_mutex * > other
The list of other mutexes.
bool operator()(const value_type &first, const value_type &second) const
std::size_t operator()(const value_type &pair) const
std::size_t operator()(const atermpp::aterm &t) const
Definition aterm.h:483
std::size_t operator()(const atermpp::aterm_core &t) const
Definition aterm_hash.h:63
std::size_t operator()(const atermpp::detail::_aterm *term) const
Definition aterm_hash.h:29
std::size_t operator()(const atermpp::detail::_function_symbol &f) 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
Definition aterm_hash.h:52
std::size_t operator()(const mcrl2::utilities::tagged_pointer< T > &p) const
std::size_t operator()(const std::pair< X, Y > &p) const
The nodes of the free list without.
Definition free_list.h:40
slot * m_next
Pointer to the next node.
Definition free_list.h:68
void next(slot *next) noexcept
Set the next pointer to the given next pointer.
Definition free_list.h:52
Element m_element
Store the actual element.
Definition free_list.h:71
void mark()
Mark this slot with a special value, destroys the slot.
Definition free_list.h:61
#define MCRL2_UNORDERED_SET_CLASS
#define MCRL2_UNORDERED_SET_TEMPLATES
#define MCRL2_UNORDERED_MAP_CLASS
#define MCRL2_UNORDERED_MAP_TEMPLATES