theCore C++ embedded framework
ecl::pool_allocator< T > Class Template Reference

Almost stateless pool allocator. More...

#include </home/travis/build/forGGe/theCore/lib/allocators/export/ecl/pool.hpp>

Public Member Functions

 pool_allocator (pool_base *pool)
 Constructs pool allocator with memory pool given. More...
 
 ~pool_allocator ()
 Deallocates allocator. More...
 
T * allocate (size_t n)
 Allocates memory for given object count. More...
 
void deallocate (T *p, size_t n)
 
template<typename U >
pool_allocator< U > rebind () const
 Create new instanse of the allocator, suitable for a new type. More...
 
pool_allocatoroperator= (const pool_allocator &)=default
 
 pool_allocator (const pool_allocator &)=default
 

Detailed Description

template<typename T>
class ecl::pool_allocator< T >

Almost stateless pool allocator.

Provides the interface for shared memory pool.

Template Parameters
Typefor whom memory should be allocated.

Constructor & Destructor Documentation

◆ pool_allocator() [1/2]

template<typename T >
ecl::pool_allocator< T >::pool_allocator ( pool_base pool)
explicit

Constructs pool allocator with memory pool given.

Parameters
[in]poolMemory pool to use with this allocator.

◆ ~pool_allocator()

template<typename T >
ecl::pool_allocator< T >::~pool_allocator ( )

Deallocates allocator.

◆ pool_allocator() [2/2]

template<typename T>
ecl::pool_allocator< T >::pool_allocator ( const pool_allocator< T > &  )
default

Member Function Documentation

◆ allocate()

template<typename T >
T * ecl::pool_allocator< T >::allocate ( size_t  n)

Allocates memory for given object count.

Warning
This will not call object constructors. Memory will have alingment requirements of given type.
Parameters
[in]nObjects count.
Returns
Valid pointer to an uninitilized memory if allocation sucessed. Nullptr otherwise.

◆ deallocate()

template<typename T>
void ecl::pool_allocator< T >::deallocate ( T *  p,
size_t  n 
)
Todo:
: fill docs

◆ rebind()

template<typename T >
template<typename U >
pool_allocator< U > ecl::pool_allocator< T >::rebind ( ) const

Create new instanse of the allocator, suitable for a new type.

Template Parameters
UA new allocator type.

◆ operator=()

template<typename T>
pool_allocator& ecl::pool_allocator< T >::operator= ( const pool_allocator< T > &  )
default

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