mCRL2
Loading...
Searching...
No Matches
aterm_implementation.cpp
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
13
14using namespace atermpp;
15using namespace atermpp::detail;
16
20static_assert(sizeof(std::size_t) == sizeof(_aterm*), "The size of an aterm pointer is not equal to the size of type std::size_t. Cannot compile the MCRL2 toolset for this platform.");
21static_assert(sizeof(std::size_t) >= 4,"The size of std::size_t should at least be four bytes. Cannot compile the toolset for this platform.");
22
24{
25 g_term_pool().add_deletion_hook(function, callback);
26}
27
28namespace atermpp::detail
29{
32{
33#ifdef MCRL2_ENABLE_MULTITHREADING
35 thread_local thread_aterm_pool instance(g_aterm_pool_instance);
36#else
39#endif
40 return instance;
41}
42
43} // end namespace atermpp::detail
44
46
48
50
51typename std::aligned_storage<sizeof(aterm_pool), alignof(aterm_pool)>::type atermpp::detail::g_aterm_pool_storage = {};
This is the class to which an aterm points.
Definition aterm.h:48
The interface for the term library. Provides the storage of of all classes of terms.
Definition aterm_pool.h:82
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.
This is a thread's specific access to the global aterm pool which ensures that garbage collection and...
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.
static aterm_pool & g_aterm_pool_instance
A reference to the global term pool storage.
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
The main namespace for the aterm++ library.
Definition algorithm.h:21
void add_deletion_hook(const function_symbol &, term_callback)
Check for reasonably sized aterm (32 bits, 4 bytes) This check might break on perfectly valid archite...
void(* term_callback)(const aterm &)
Definition aterm.h:23
static constexpr bool GlobalThreadSafe
Enables thread safety for the whole toolset.