ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
etiss::ObjectPool< T, prealloc_inc > Class Template Reference

prealloc_inc defines the number of objects that is availabe within ObjectPools memory; default: 100 More...

#include <ObjectPool.h>

Collaboration diagram for etiss::ObjectPool< T, prealloc_inc >:
Collaboration graph
[legend]

Classes

struct  rebind
 

Public Types

typedef T value_type
 
typedef T * pointer
 
typedef const T * const_pointer
 
typedef T & reference
 
typedef const T & const_reference
 
typedef std::aligned_storage< sizeof(T), alignof(T)>::type storage
 

Public Member Functions

 ObjectPool (size_t blockElementCount=5000)
 
 ObjectPool (const ObjectPool &alloc)
 
template<class U >
 ObjectPool (const ObjectPool< U > &alloc)
 
 ~ObjectPool ()
 
T * address (T &x) const
 
const T * address (const T &x) const
 
T * allocate (size_t n=1, const T *=0)
 
void deallocate (T *p, size_t n=1)
 
size_t max_size () const
 
template<class U , class... Args>
void construct (U *p, Args &&... args)
 
template<class U >
void destroy (U *p)
 

Public Attributes

const size_t blocksize_
 

Private Attributes

std::set< void * > areas_
 
std::vector< void * > empty_
 
storage stackstore [prealloc_inc]
 
bool stackstore_used
 

Detailed Description

template<typename T, size_t prealloc_inc>
class etiss::ObjectPool< T, prealloc_inc >

prealloc_inc defines the number of objects that is availabe within ObjectPools memory; default: 100

implements the interface of std::allocator. uses blocks of memory to speed up creation/deletion of object. possibly large memory consumption

Definition at line 97 of file ObjectPool.h.

Member Typedef Documentation

◆ const_pointer

template<typename T , size_t prealloc_inc>
typedef const T* etiss::ObjectPool< T, prealloc_inc >::const_pointer

Definition at line 109 of file ObjectPool.h.

◆ const_reference

template<typename T , size_t prealloc_inc>
typedef const T& etiss::ObjectPool< T, prealloc_inc >::const_reference

Definition at line 111 of file ObjectPool.h.

◆ pointer

template<typename T , size_t prealloc_inc>
typedef T* etiss::ObjectPool< T, prealloc_inc >::pointer

Definition at line 108 of file ObjectPool.h.

◆ reference

template<typename T , size_t prealloc_inc>
typedef T& etiss::ObjectPool< T, prealloc_inc >::reference

Definition at line 110 of file ObjectPool.h.

◆ storage

template<typename T , size_t prealloc_inc>
typedef std::aligned_storage<sizeof(T), alignof(T)>::type etiss::ObjectPool< T, prealloc_inc >::storage

Definition at line 113 of file ObjectPool.h.

◆ value_type

template<typename T , size_t prealloc_inc>
typedef T etiss::ObjectPool< T, prealloc_inc >::value_type

Definition at line 107 of file ObjectPool.h.

Constructor & Destructor Documentation

◆ ObjectPool() [1/3]

template<typename T , size_t prealloc_inc>
etiss::ObjectPool< T, prealloc_inc >::ObjectPool ( size_t  blockElementCount = 5000)
inline

Definition at line 126 of file ObjectPool.h.

◆ ObjectPool() [2/3]

template<typename T , size_t prealloc_inc>
etiss::ObjectPool< T, prealloc_inc >::ObjectPool ( const ObjectPool< T, prealloc_inc > &  alloc)
inline

Definition at line 127 of file ObjectPool.h.

◆ ObjectPool() [3/3]

template<typename T , size_t prealloc_inc>
template<class U >
etiss::ObjectPool< T, prealloc_inc >::ObjectPool ( const ObjectPool< U > &  alloc)
inline

Definition at line 129 of file ObjectPool.h.

◆ ~ObjectPool()

template<typename T , size_t prealloc_inc>
etiss::ObjectPool< T, prealloc_inc >::~ObjectPool ( )
inline

Member Function Documentation

◆ address() [1/2]

template<typename T , size_t prealloc_inc>
const T* etiss::ObjectPool< T, prealloc_inc >::address ( const T &  x) const
inline

Definition at line 142 of file ObjectPool.h.

References etiss::fault::x.

◆ address() [2/2]

template<typename T , size_t prealloc_inc>
T* etiss::ObjectPool< T, prealloc_inc >::address ( T &  x) const
inline

Definition at line 141 of file ObjectPool.h.

References etiss::fault::x.

◆ allocate()

template<typename T , size_t prealloc_inc>
T* etiss::ObjectPool< T, prealloc_inc >::allocate ( size_t  n = 1,
const T *  = 0 
)
inline

◆ construct()

template<typename T , size_t prealloc_inc>
template<class U , class... Args>
void etiss::ObjectPool< T, prealloc_inc >::construct ( U *  p,
Args &&...  args 
)
inline

Definition at line 204 of file ObjectPool.h.

References get_metrics::args.

◆ deallocate()

template<typename T , size_t prealloc_inc>
void etiss::ObjectPool< T, prealloc_inc >::deallocate ( T *  p,
size_t  n = 1 
)
inline

Definition at line 187 of file ObjectPool.h.

References etiss::ObjectPool< T, prealloc_inc >::empty_, and unlikely.

Referenced by etiss::decRef().

Here is the caller graph for this function:

◆ destroy()

template<typename T , size_t prealloc_inc>
template<class U >
void etiss::ObjectPool< T, prealloc_inc >::destroy ( U *  p)
inline

Definition at line 210 of file ObjectPool.h.

Referenced by etiss::decRef().

Here is the caller graph for this function:

◆ max_size()

template<typename T , size_t prealloc_inc>
size_t etiss::ObjectPool< T, prealloc_inc >::max_size ( ) const
inline

Definition at line 202 of file ObjectPool.h.

Member Data Documentation

◆ areas_

template<typename T , size_t prealloc_inc>
std::set<void *> etiss::ObjectPool< T, prealloc_inc >::areas_
private

◆ blocksize_

template<typename T , size_t prealloc_inc>
const size_t etiss::ObjectPool< T, prealloc_inc >::blocksize_

Definition at line 100 of file ObjectPool.h.

Referenced by etiss::ObjectPool< T, prealloc_inc >::allocate().

◆ empty_

template<typename T , size_t prealloc_inc>
std::vector<void *> etiss::ObjectPool< T, prealloc_inc >::empty_
private

◆ stackstore

template<typename T , size_t prealloc_inc>
storage etiss::ObjectPool< T, prealloc_inc >::stackstore[prealloc_inc]
private

◆ stackstore_used

template<typename T , size_t prealloc_inc>
bool etiss::ObjectPool< T, prealloc_inc >::stackstore_used
private

Definition at line 117 of file ObjectPool.h.

Referenced by etiss::ObjectPool< T, prealloc_inc >::allocate().


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