mCRL2
Loading...
Searching...
No Matches
mcrl2::lts::detail::my_pool< T, NR_ELEMENTS > Class Template Reference

#include <simple_list.h>

Classes

class  pool_block_t
 

Public Member Functions

 my_pool ()
 constructor
 
 ~my_pool ()
 destructor
 
template<class U , class... Args>
U * construct (Args &&... args)
 allocate and construct a new element (of any type)
 
template<class U >
void destroy (U *const old_el)
 destroy and delete some element
 

Private Member Functions

template<class U , class... Args>
U * construct_samesize (Args &&... args)
 allocate and construct a new element of the same size as the free list
 
template<class U , class... Args>
U * construct_othersize (Args &&... args)
 allocate and construct a new element of a size that doesn't fit the free list
 

Static Private Member Functions

static void *& deref_void (void *addr)
 

Private Attributes

pool_block_tfirst_block
 first chunk in list of chunks
 
void * begin_used_in_first_block
 start of part in the first chunk that is already in use
 
void * first_free_T
 first freed element
 

Detailed Description

template<class T, std::size_t NR_ELEMENTS = 4000>
class mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >

Definition at line 111 of file simple_list.h.

Constructor & Destructor Documentation

◆ my_pool()

template<class T , std::size_t NR_ELEMENTS = 4000>
mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::my_pool ( )
inline

constructor

Definition at line 141 of file simple_list.h.

◆ ~my_pool()

template<class T , std::size_t NR_ELEMENTS = 4000>
mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::~my_pool ( )
inline

destructor

Definition at line 150 of file simple_list.h.

Member Function Documentation

◆ construct()

template<class T , std::size_t NR_ELEMENTS = 4000>
template<class U , class... Args>
U * mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::construct ( Args &&...  args)
inline

allocate and construct a new element (of any type)

Definition at line 244 of file simple_list.h.

◆ construct_othersize()

template<class T , std::size_t NR_ELEMENTS = 4000>
template<class U , class... Args>
U * mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::construct_othersize ( Args &&...  args)
inlineprivate

allocate and construct a new element of a size that doesn't fit the free list

Definition at line 197 of file simple_list.h.

◆ construct_samesize()

template<class T , std::size_t NR_ELEMENTS = 4000>
template<class U , class... Args>
U * mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::construct_samesize ( Args &&...  args)
inlineprivate

allocate and construct a new element of the same size as the free list

Definition at line 167 of file simple_list.h.

◆ deref_void()

template<class T , std::size_t NR_ELEMENTS = 4000>
static void *& mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::deref_void ( void *  addr)
inlinestaticprivate

Definition at line 135 of file simple_list.h.

◆ destroy()

template<class T , std::size_t NR_ELEMENTS = 4000>
template<class U >
void mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::destroy ( U *const  old_el)
inline

destroy and delete some element

destroy() is only allowed if the destructor of U is trivial. This ensures that in my_pool::~my_pool() we do not have to test whether some element has been freed before we destroy it. Also, the size of U has to be the same size as the size of T, so each entry in the free list has the same size.

Definition at line 264 of file simple_list.h.

Member Data Documentation

◆ begin_used_in_first_block

template<class T , std::size_t NR_ELEMENTS = 4000>
void* mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::begin_used_in_first_block
private

start of part in the first chunk that is already in use

Definition at line 130 of file simple_list.h.

◆ first_block

template<class T , std::size_t NR_ELEMENTS = 4000>
pool_block_t* mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::first_block
private

first chunk in list of chunks

All chunks except the first one are completely in use.

Definition at line 127 of file simple_list.h.

◆ first_free_T

template<class T , std::size_t NR_ELEMENTS = 4000>
void* mcrl2::lts::detail::my_pool< T, NR_ELEMENTS >::first_free_T
private

first freed element

Definition at line 133 of file simple_list.h.


The documentation for this class was generated from the following file: