10#ifndef ATERMPP_DETAIL_THREAD_ATERM_POOL_IMPLEMENTATION_H
11#define ATERMPP_DETAIL_THREAD_ATERM_POOL_IMPLEMENTATION_H
34 std::string name_copy = name;
56template<
class ...Terms>
66template<
class Term,
class INDEX_TYPE,
class ...Terms>
74 if constexpr (
sizeof...(arguments)==1)
81 insert(*
reinterpret_cast<INDEX_TYPE*
>(&(argument_array[0]))));
94 insert(*
reinterpret_cast<INDEX_TYPE*
>(&argument_array[0])));
95 added =
m_pool.
create_appl(term, sym, argument_array[0], argument_array[1], term);
102template<
typename InputIterator>
115template<
typename InputIterator,
typename ATermConverter>
118 ATermConverter convert_to_aterm,
141 auto [it, inserted] =
m_variables->insert(variable);
182 if (variable !=
nullptr)
186 if (term !=
nullptr && !term->
is_marked())
196 if (container !=
nullptr)
219 if (container !=
nullptr)
221 result += container->size();
The aterm_core base class that provides protection of the underlying shared terms.
This is the class to which an aterm points.
bool is_marked() const
Check if the term is already marked.
Provides safe storage of unprotected_aterm_core instances in a container by marking them during garba...
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.
bool create_int(aterm &term, std::size_t val)
Creates a integral term with the given value.
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).
bool create_term(aterm &term, const function_symbol &sym)
Creates a term with the given function symbol.
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...
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)
void create_appl(aterm &term, const function_symbol &sym, const Terms &... arguments)
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)
mcrl2::utilities::hashtable< detail::aterm_container * > * m_containers
mcrl2::utilities::hashtable< aterm_core * > * m_variables
std::size_t protection_set_size() const
std::size_t m_container_insertions
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.
std::size_t m_variable_insertions
void print_local_performance_statistics() const
void create_appl_index(aterm &term, const function_symbol &sym, const Terms &... arguments)
An unprotected term does not change the reference count of the shared term when it is copied or moved...
A shared lock guard for the shared_mutex.
void unlock_shared()
Unlocks the acquired shared guard explicitly. Otherwise, performed in destructor.
bool is_shared_locked() const
shared_guard lock_shared()
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
_aterm * address(const unprotected_aterm_core &t)
void store_in_argument_array(std::array< unprotected_aterm_core, N > &argument_array, const Args &... args)
static constexpr bool EnableVariableRegistrationMetrics
Keep track of the number of variables registered.
void mark_term(const _aterm &root, std::stack< std::reference_wrapper< _aterm > > &todo)
Marks a term and recursively all arguments that are not reachable.
The main namespace for the aterm++ library.
void mcrl2_unused(T &&...)
Function that can be used to silence unused parameter warnings.
For several variable types in mCRL2 an implicit mapping of these variables to integers is available....