Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::cache_aligned_allocator< T > Class Template Reference

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

#include <cache_aligned_allocator.h>

Collaboration diagram for tbb::cache_aligned_allocator< T >:

Classes

struct  rebind
 

Public Types

typedef internal::allocator_type< T >::value_type value_type
 
typedef value_typepointer
 
typedef value_typereference
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

 cache_aligned_allocator () throw ()
 
 cache_aligned_allocator (const cache_aligned_allocator &) throw ()
 
template<typename U >
 cache_aligned_allocator (const cache_aligned_allocator< U > &) throw ()
 
pointer address (reference x) const
 
const_pointer address (const_reference x) const
 
pointer allocate (size_type n, const void *hint=0)
 Allocate space for n objects, starting on a cache/sector line. More...
 
void deallocate (pointer p, size_type)
 Free block of memory that starts on a cache line. 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...
 

Public Attributes

const typedef value_typeconst_pointer
 
const typedef value_typeconst_reference
 

Detailed Description

template<typename T>
class tbb::cache_aligned_allocator< T >

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

The members are ordered the same way they are in section 20.4.1 of the ISO C++ standard.

Definition at line 60 of file cache_aligned_allocator.h.

Member Typedef Documentation

◆ difference_type

template<typename T >
typedef ptrdiff_t tbb::cache_aligned_allocator< T >::difference_type

Definition at line 68 of file cache_aligned_allocator.h.

◆ pointer

template<typename T >
typedef value_type* tbb::cache_aligned_allocator< T >::pointer

Definition at line 63 of file cache_aligned_allocator.h.

◆ reference

template<typename T >
typedef value_type& tbb::cache_aligned_allocator< T >::reference

Definition at line 65 of file cache_aligned_allocator.h.

◆ size_type

template<typename T >
typedef size_t tbb::cache_aligned_allocator< T >::size_type

Definition at line 67 of file cache_aligned_allocator.h.

◆ value_type

Definition at line 62 of file cache_aligned_allocator.h.

Constructor & Destructor Documentation

◆ cache_aligned_allocator() [1/3]

template<typename T >
tbb::cache_aligned_allocator< T >::cache_aligned_allocator ( )
throw (
)
inline

Definition at line 72 of file cache_aligned_allocator.h.

72 {}

◆ cache_aligned_allocator() [2/3]

template<typename T >
tbb::cache_aligned_allocator< T >::cache_aligned_allocator ( const cache_aligned_allocator< T > &  )
throw (
)
inline

Definition at line 73 of file cache_aligned_allocator.h.

73 {}

◆ cache_aligned_allocator() [3/3]

template<typename T >
template<typename U >
tbb::cache_aligned_allocator< T >::cache_aligned_allocator ( const cache_aligned_allocator< U > &  )
throw (
)
inline

Definition at line 74 of file cache_aligned_allocator.h.

74 {}

Member Function Documentation

◆ address() [1/2]

template<typename T >
const_pointer tbb::cache_aligned_allocator< T >::address ( const_reference  x) const
inline

Definition at line 77 of file cache_aligned_allocator.h.

77 {return &x;}

◆ address() [2/2]

template<typename T >
pointer tbb::cache_aligned_allocator< T >::address ( reference  x) const
inline

Definition at line 76 of file cache_aligned_allocator.h.

76 {return &x;}

◆ allocate()

template<typename T >
pointer tbb::cache_aligned_allocator< T >::allocate ( size_type  n,
const void hint = 0 
)
inline

Allocate space for n objects, starting on a cache/sector line.

Definition at line 80 of file cache_aligned_allocator.h.

80  {
81  // The "hint" argument is always ignored in NFS_Allocate thus const_cast shouldn't hurt
82  return pointer(internal::NFS_Allocate( n, sizeof(value_type), const_cast<void*>(hint) ));
83  }

References tbb::internal::NFS_Allocate().

Referenced by tbb::internal::concurrent_queue_iterator_base_v3::assign(), tbb::internal::concurrent_queue_base_v3::concurrent_queue_base_v3(), tbb::internal::input_buffer::grow(), tbb::internal::concurrent_queue_iterator_base_v3::initialize(), tbb::internal::rml::make_private_server(), and tbb::internal::rml::private_server::private_server().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ construct() [1/2]

template<typename T >
void tbb::cache_aligned_allocator< T >::construct ( pointer  p,
const value_type value 
)
inline

Definition at line 104 of file cache_aligned_allocator.h.

104 {::new((void*)(p)) value_type(value);}

References p, and value.

◆ construct() [2/2]

template<typename T >
void tbb::cache_aligned_allocator< T >::construct ( pointer  p,
value_type &&  value 
)
inline

Copy-construct value at location pointed to by p.

Definition at line 102 of file cache_aligned_allocator.h.

102 {::new((void*)(p)) value_type(std::move(value));}

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

Here is the call graph for this function:

◆ deallocate()

template<typename T >
void tbb::cache_aligned_allocator< T >::deallocate ( pointer  p,
size_type   
)
inline

Free block of memory that starts on a cache line.

Definition at line 86 of file cache_aligned_allocator.h.

86  {
88  }

References tbb::internal::NFS_Free(), and p.

Referenced by tbb::internal::concurrent_queue_iterator_base_v3::assign(), tbb::internal::input_buffer::grow(), tbb::internal::rml::private_server::remove_server_ref(), tbb::internal::concurrent_queue_base_v3::~concurrent_queue_base_v3(), tbb::internal::concurrent_queue_iterator_base_v3::~concurrent_queue_iterator_base_v3(), tbb::internal::input_buffer::~input_buffer(), and tbb::internal::rml::private_server::~private_server().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

template<typename T >
void tbb::cache_aligned_allocator< T >::destroy ( pointer  p)
inline

Destroy value at location pointed to by p.

Definition at line 108 of file cache_aligned_allocator.h.

108 {p->~value_type();}

References p.

◆ max_size()

template<typename T >
size_type tbb::cache_aligned_allocator< T >::max_size ( ) const
throw (
)
inline

Largest value for which method allocate might succeed.

Definition at line 91 of file cache_aligned_allocator.h.

91  {
92  return (~size_t(0)-internal::NFS_MaxLineSize)/sizeof(value_type);
93  }

References tbb::internal::NFS_MaxLineSize.

Member Data Documentation

◆ const_pointer

template<typename T >
const typedef value_type* tbb::cache_aligned_allocator< T >::const_pointer

Definition at line 64 of file cache_aligned_allocator.h.

◆ const_reference

template<typename T >
const typedef value_type& tbb::cache_aligned_allocator< T >::const_reference

Definition at line 66 of file cache_aligned_allocator.h.


The documentation for this class was generated from the following file:
tbb::cache_aligned_allocator::pointer
value_type * pointer
Definition: cache_aligned_allocator.h:63
tbb::cache_aligned_allocator::value_type
internal::allocator_type< T >::value_type value_type
Definition: cache_aligned_allocator.h:62
tbb::move
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
tbb::internal::NFS_MaxLineSize
const size_t NFS_MaxLineSize
Compile-time constant that is upper bound on cache line/sector size.
Definition: tbb_stddef.h:216
value
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
Definition: ittnotify_static.h:192
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91
tbb::internal::NFS_Free
void __TBB_EXPORTED_FUNC NFS_Free(void *)
Free memory allocated by NFS_Allocate.
Definition: cache_aligned_allocator.cpp:198
tbb::internal::NFS_Allocate
void *__TBB_EXPORTED_FUNC NFS_Allocate(size_t n_element, size_t element_size, void *hint)
Allocate memory on cache/sector line boundary.
Definition: cache_aligned_allocator.cpp:176

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.