Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::interface6::memory_pool_allocator< T, P > Class Template Reference

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5. More...

#include <memory_pool.h>

Collaboration diagram for tbb::interface6::memory_pool_allocator< T, P >:

Classes

struct  rebind
 

Public Types

typedef tbb::internal::allocator_type< T >::value_type value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 memory_pool_allocator (pool_type &pool) throw ()
 
 memory_pool_allocator (const memory_pool_allocator &src) throw ()
 
template<typename U >
 memory_pool_allocator (const memory_pool_allocator< U, P > &src) throw ()
 
pointer address (reference x) const
 
const_pointer address (const_reference x) const
 
pointer allocate (size_type n, const void *=0)
 Allocate space for n objects. More...
 
void deallocate (pointer p, size_type)
 Free previously allocated block of memory. More...
 
size_type max_size () const throw ()
 Largest value for which method allocate might succeed. More...
 
void construct (pointer p, value_type &&value)
 Copy-construct value at location pointed to by p. More...
 
void construct (pointer p, const value_type &value)
 
void destroy (pointer p)
 Destroy value at location pointed to by p. More...
 

Protected Types

typedef P pool_type
 

Protected Attributes

pool_typemy_pool
 

Friends

template<typename U , typename R >
class memory_pool_allocator
 
template<typename V , typename U , typename R >
bool operator== (const memory_pool_allocator< V, R > &a, const memory_pool_allocator< U, R > &b)
 
template<typename V , typename U , typename R >
bool operator!= (const memory_pool_allocator< V, R > &a, const memory_pool_allocator< U, R > &b)
 

Detailed Description

template<typename T, typename P = internal::pool_base>
class tbb::interface6::memory_pool_allocator< T, P >

Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.

Definition at line 84 of file memory_pool.h.

Member Typedef Documentation

◆ const_pointer

template<typename T, typename P = internal::pool_base>
typedef const value_type* tbb::interface6::memory_pool_allocator< T, P >::const_pointer

Definition at line 97 of file memory_pool.h.

◆ const_reference

template<typename T, typename P = internal::pool_base>
typedef const value_type& tbb::interface6::memory_pool_allocator< T, P >::const_reference

Definition at line 99 of file memory_pool.h.

◆ difference_type

template<typename T, typename P = internal::pool_base>
typedef ptrdiff_t tbb::interface6::memory_pool_allocator< T, P >::difference_type

Definition at line 101 of file memory_pool.h.

◆ pointer

template<typename T, typename P = internal::pool_base>
typedef value_type* tbb::interface6::memory_pool_allocator< T, P >::pointer

Definition at line 96 of file memory_pool.h.

◆ pool_type

template<typename T, typename P = internal::pool_base>
typedef P tbb::interface6::memory_pool_allocator< T, P >::pool_type
protected

Definition at line 86 of file memory_pool.h.

◆ reference

template<typename T, typename P = internal::pool_base>
typedef value_type& tbb::interface6::memory_pool_allocator< T, P >::reference

Definition at line 98 of file memory_pool.h.

◆ size_type

template<typename T, typename P = internal::pool_base>
typedef size_t tbb::interface6::memory_pool_allocator< T, P >::size_type

Definition at line 100 of file memory_pool.h.

◆ value_type

template<typename T, typename P = internal::pool_base>
typedef tbb::internal::allocator_type<T>::value_type tbb::interface6::memory_pool_allocator< T, P >::value_type

Definition at line 95 of file memory_pool.h.

Constructor & Destructor Documentation

◆ memory_pool_allocator() [1/3]

template<typename T, typename P = internal::pool_base>
tbb::interface6::memory_pool_allocator< T, P >::memory_pool_allocator ( pool_type pool)
throw (
)
inlineexplicit

Definition at line 106 of file memory_pool.h.

106 : my_pool(&pool) {}

◆ memory_pool_allocator() [2/3]

template<typename T, typename P = internal::pool_base>
tbb::interface6::memory_pool_allocator< T, P >::memory_pool_allocator ( const memory_pool_allocator< T, P > &  src)
throw (
)
inline

Definition at line 107 of file memory_pool.h.

107 : my_pool(src.my_pool) {}

◆ memory_pool_allocator() [3/3]

template<typename T, typename P = internal::pool_base>
template<typename U >
tbb::interface6::memory_pool_allocator< T, P >::memory_pool_allocator ( const memory_pool_allocator< U, P > &  src)
throw (
)
inline

Definition at line 109 of file memory_pool.h.

109 : my_pool(src.my_pool) {}

Member Function Documentation

◆ address() [1/2]

template<typename T, typename P = internal::pool_base>
pointer tbb::interface6::memory_pool_allocator< T, P >::address ( reference  x) const
inline

Definition at line 111 of file memory_pool.h.

111 { return &x; }

◆ address() [2/2]

template<typename T, typename P = internal::pool_base>
const_pointer tbb::interface6::memory_pool_allocator< T, P >::address ( const_reference  x) const
inline

Definition at line 112 of file memory_pool.h.

112 { return &x; }

◆ allocate()

template<typename T, typename P = internal::pool_base>
pointer tbb::interface6::memory_pool_allocator< T, P >::allocate ( size_type  n,
const void = 0 
)
inline

Allocate space for n objects.

Definition at line 115 of file memory_pool.h.

115  {
116  pointer p = static_cast<pointer>( my_pool->malloc( n*sizeof(value_type) ) );
117  if (!p)
118  tbb::internal::throw_exception(std::bad_alloc());
119  return p;
120  }
void const char const char int ITT_FORMAT __itt_group_sync p
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
tbb::internal::allocator_type< T >::value_type value_type
Definition: memory_pool.h:95

References tbb::interface6::memory_pool_allocator< T, P >::my_pool, p, and tbb::internal::throw_exception().

Here is the call graph for this function:

◆ construct() [1/2]

template<typename T, typename P = internal::pool_base>
void tbb::interface6::memory_pool_allocator< T, P >::construct ( pointer  p,
value_type &&  value 
)
inline

Copy-construct value at location pointed to by p.

Definition at line 137 of file memory_pool.h.

137 {::new((void*)(p)) value_type(std::move(value));}
void const char const char int ITT_FORMAT __itt_group_sync p
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
tbb::internal::allocator_type< T >::value_type value_type
Definition: memory_pool.h:95
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319

References tbb::move(), p, and value.

Here is the call graph for this function:

◆ construct() [2/2]

template<typename T, typename P = internal::pool_base>
void tbb::interface6::memory_pool_allocator< T, P >::construct ( pointer  p,
const value_type value 
)
inline

Definition at line 139 of file memory_pool.h.

139 { ::new((void*)(p)) value_type(value); }
void const char const char int ITT_FORMAT __itt_group_sync p
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
tbb::internal::allocator_type< T >::value_type value_type
Definition: memory_pool.h:95

References p, and value.

◆ deallocate()

template<typename T, typename P = internal::pool_base>
void tbb::interface6::memory_pool_allocator< T, P >::deallocate ( pointer  p,
size_type   
)
inline

Free previously allocated block of memory.

Definition at line 122 of file memory_pool.h.

122  {
123  my_pool->free(p);
124  }
void const char const char int ITT_FORMAT __itt_group_sync p

References tbb::interface6::memory_pool_allocator< T, P >::my_pool, and p.

◆ destroy()

template<typename T, typename P = internal::pool_base>
void tbb::interface6::memory_pool_allocator< T, P >::destroy ( pointer  p)
inline

Destroy value at location pointed to by p.

Definition at line 143 of file memory_pool.h.

143 { p->~value_type(); }
void const char const char int ITT_FORMAT __itt_group_sync p

References p.

◆ max_size()

template<typename T, typename P = internal::pool_base>
size_type tbb::interface6::memory_pool_allocator< T, P >::max_size ( ) const
throw (
)
inline

Largest value for which method allocate might succeed.

Definition at line 126 of file memory_pool.h.

126  {
127  size_type max = static_cast<size_type>(-1) / sizeof (value_type);
128  return (max > 0 ? max : 1);
129  }
T max(const T &val1, const T &val2)
Utility template function returning greater of the two values.
Definition: tbb_misc.h:119
tbb::internal::allocator_type< T >::value_type value_type
Definition: memory_pool.h:95

References tbb::internal::max().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ memory_pool_allocator

template<typename T, typename P = internal::pool_base>
template<typename U , typename R >
friend class memory_pool_allocator
friend

Definition at line 89 of file memory_pool.h.

◆ operator!=

template<typename T, typename P = internal::pool_base>
template<typename V , typename U , typename R >
bool operator!= ( const memory_pool_allocator< V, R > &  a,
const memory_pool_allocator< U, R > &  b 
)
friend

◆ operator==

template<typename T, typename P = internal::pool_base>
template<typename V , typename U , typename R >
bool operator== ( const memory_pool_allocator< V, R > &  a,
const memory_pool_allocator< U, R > &  b 
)
friend

Member Data Documentation

◆ my_pool


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

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.