Intel(R) Threading Building Blocks Doxygen Documentation version 4.2.3
Loading...
Searching...
No Matches
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type > Class Template Reference

The enumerable_thread_specific container. More...

#include <enumerable_thread_specific.h>

Inheritance diagram for tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >:
Collaboration diagram for tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >:

Classes

class  generic_range_type
 A generic range, used to create range objects from the iterators. More...
 

Public Types

typedef Allocator allocator_type
 Basic types.
 
typedef T value_type
 
typedef T & reference
 
typedef const T & const_reference
 
typedef T * pointer
 
typedef const T * const_pointer
 
typedef internal_collection_type::size_type size_type
 
typedef internal_collection_type::difference_type difference_type
 
typedef internal::enumerable_thread_specific_iterator< internal_collection_type, value_typeiterator
 
typedef internal::enumerable_thread_specific_iterator< internal_collection_type, const value_typeconst_iterator
 
typedef generic_range_type< iteratorrange_type
 
typedef generic_range_type< const_iteratorconst_range_type
 

Public Member Functions

 enumerable_thread_specific ()
 Default constructor. Each local instance of T is default constructed.
 
template<typename Finit , typename = typename internal::enable_if<internal::is_callable_no_args<typename internal::strip<Finit>::type>::value>::type>
 enumerable_thread_specific (Finit finit)
 Constructor with initializer functor. Each local instance of T is constructed by T(finit()).
 
 enumerable_thread_specific (const T &exemplar)
 Constructor with exemplar. Each local instance of T is copy-constructed from the exemplar.
 
 enumerable_thread_specific (T &&exemplar)
 
template<typename P1 , typename... P, typename = typename internal::enable_if<!internal::is_callable_no_args<typename internal::strip<P1>::type>::value && !internal::is_compatible_ets<T, typename internal::strip<P1>::type>::value && !internal::is_same_type<T, typename internal::strip<P1>::type>::value >::type>
 enumerable_thread_specific (P1 &&arg1, P &&... args)
 Variadic constructor with initializer arguments. Each local instance of T is constructed by T(args...)
 
 ~enumerable_thread_specific ()
 Destructor.
 
reference local ()
 returns reference to local, discarding exists
 
reference local (bool &exists)
 Returns reference to calling thread's local copy, creating one if necessary.
 
size_type size () const
 Get the number of local copies.
 
bool empty () const
 true if there have been no local copies created
 
iterator begin ()
 begin iterator
 
iterator end ()
 end iterator
 
const_iterator begin () const
 begin const iterator
 
const_iterator end () const
 end const iterator
 
range_type range (size_t grainsize=1)
 Get range for parallel algorithms.
 
const_range_type range (size_t grainsize=1) const
 Get const range for parallel algorithms.
 
void clear ()
 Destroys local copies.
 
 enumerable_thread_specific (const enumerable_thread_specific &other)
 
template<typename Alloc , ets_key_usage_type Cachetype>
 enumerable_thread_specific (const enumerable_thread_specific< T, Alloc, Cachetype > &other)
 
 enumerable_thread_specific (enumerable_thread_specific &&other)
 
template<typename Alloc , ets_key_usage_type Cachetype>
 enumerable_thread_specific (enumerable_thread_specific< T, Alloc, Cachetype > &&other)
 
enumerable_thread_specificoperator= (const enumerable_thread_specific &other)
 
template<typename Alloc , ets_key_usage_type Cachetype>
enumerable_thread_specificoperator= (const enumerable_thread_specific< T, Alloc, Cachetype > &other)
 
enumerable_thread_specificoperator= (enumerable_thread_specific &&other)
 
template<typename Alloc , ets_key_usage_type Cachetype>
enumerable_thread_specificoperator= (enumerable_thread_specific< T, Alloc, Cachetype > &&other)
 
template<typename combine_func_t >
combine (combine_func_t f_combine)
 
template<typename combine_func_t >
void combine_each (combine_func_t f_combine)
 

Private Types

typedef internal::padded< internal::ets_element< T > > padded_element
 
typedef Allocator::template rebind< padded_element >::other padded_allocator_type
 
typedef tbb::concurrent_vector< padded_element, padded_allocator_typeinternal_collection_type
 
typedef Allocator::template rebind< uintptr_t >::other array_allocator_type
 

Private Member Functions

voidcreate_local () __TBB_override
 
voidcreate_array (size_t _size) __TBB_override
 
void free_array (void *_ptr, size_t _size) __TBB_override
 
template<typename A2 , ets_key_usage_type C2>
void internal_copy (const enumerable_thread_specific< T, A2, C2 > &other)
 
void internal_swap (enumerable_thread_specific &other)
 
template<typename A2 , ets_key_usage_type C2>
void internal_move (enumerable_thread_specific< T, A2, C2 > &&other)
 

Static Private Member Functions

static voidcreate_local_by_copy (internal::ets_base< ETS_key_type > &base, void *p)
 
static voidcreate_local_by_move (internal::ets_base< ETS_key_type > &base, void *p)
 

Private Attributes

internal::callback_base< T > * my_construct_callback
 
internal_collection_type my_locals
 

Friends

template<typename U , typename A , ets_key_usage_type C>
class enumerable_thread_specific
 

Detailed Description

template<typename T, typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
class tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >

The enumerable_thread_specific container.

enumerable_thread_specific has the following properties:

  • thread-local copies are lazily created, with default, exemplar or function initialization.
  • thread-local copies do not move (during lifetime, and excepting clear()) so the address of a copy is invariant.
  • the contained objects need not have operator=() defined if combine is not used.
  • enumerable_thread_specific containers may be copy-constructed or assigned.
  • thread-local copies can be managed by hash-table, or can be accessed via TLS storage for speed.
  • outside of parallel contexts, the contents of all thread-local copies are accessible by iterator or using combine or combine_each methods
Segmented iterator
When the thread-local objects are containers with input_iterators defined, a segmented iterator may be used to iterate over all the elements of all thread-local copies.
combine and combine_each
  • Both methods are defined for enumerable_thread_specific.
  • combine() requires the type T have operator=() defined.
  • neither method modifies the contents of the object (though there is no guarantee that the applied methods do not modify the object.)
  • Both are evaluated in serial context (the methods are assumed to be non-benign.)

Definition at line 799 of file enumerable_thread_specific.h.

Member Typedef Documentation

◆ allocator_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef Allocator tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::allocator_type

Basic types.

Definition at line 867 of file enumerable_thread_specific.h.

◆ array_allocator_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef Allocator::template rebind<uintptr_t>::other tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::array_allocator_type
private

Definition at line 851 of file enumerable_thread_specific.h.

◆ const_iterator

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::const_iterator

Definition at line 878 of file enumerable_thread_specific.h.

◆ const_pointer

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef const T* tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::const_pointer

Definition at line 872 of file enumerable_thread_specific.h.

◆ const_range_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef generic_range_type< const_iterator > tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::const_range_type

Definition at line 882 of file enumerable_thread_specific.h.

◆ const_reference

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef const T& tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::const_reference

Definition at line 870 of file enumerable_thread_specific.h.

◆ difference_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef internal_collection_type::difference_type tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::difference_type

Definition at line 874 of file enumerable_thread_specific.h.

◆ internal_collection_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef tbb::concurrent_vector< padded_element, padded_allocator_type > tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_collection_type
private

Definition at line 821 of file enumerable_thread_specific.h.

◆ iterator

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::iterator

Definition at line 877 of file enumerable_thread_specific.h.

◆ padded_allocator_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef Allocator::template rebind<padded_element>::other tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::padded_allocator_type
private

Definition at line 820 of file enumerable_thread_specific.h.

◆ padded_element

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef internal::padded< internal::ets_element<T> > tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::padded_element
private

Definition at line 803 of file enumerable_thread_specific.h.

◆ pointer

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef T* tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::pointer

Definition at line 871 of file enumerable_thread_specific.h.

◆ range_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef generic_range_type< iterator > tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::range_type

Definition at line 881 of file enumerable_thread_specific.h.

◆ reference

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef T& tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::reference

Definition at line 869 of file enumerable_thread_specific.h.

◆ size_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef internal_collection_type::size_type tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::size_type

Definition at line 873 of file enumerable_thread_specific.h.

◆ value_type

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
typedef T tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::value_type

Definition at line 868 of file enumerable_thread_specific.h.

Constructor & Destructor Documentation

◆ enumerable_thread_specific() [1/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( )
inline

Default constructor. Each local instance of T is default constructed.

Definition at line 885 of file enumerable_thread_specific.h.

886 internal::callback_leaf<T,internal::construct_by_default<T> >::make(/*dummy argument*/0)
887 ){}

◆ enumerable_thread_specific() [2/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename Finit , typename = typename internal::enable_if<internal::is_callable_no_args<typename internal::strip<Finit>::type>::value>::type>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( Finit  finit)
inlineexplicit

Constructor with initializer functor. Each local instance of T is constructed by T(finit()).

Definition at line 895 of file enumerable_thread_specific.h.

896 internal::callback_leaf<T,internal::construct_by_finit<T,Finit> >::make( tbb::internal::move(finit) )
897 ){}

References tbb::move().

Here is the call graph for this function:

◆ enumerable_thread_specific() [3/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( const T &  exemplar)
inlineexplicit

Constructor with exemplar. Each local instance of T is copy-constructed from the exemplar.

Definition at line 900 of file enumerable_thread_specific.h.

901 internal::callback_leaf<T,internal::construct_by_exemplar<T> >::make( exemplar )
902 ){}

◆ enumerable_thread_specific() [4/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( T &&  exemplar)
inlineexplicit

Definition at line 905 of file enumerable_thread_specific.h.

906 internal::callback_leaf<T,internal::construct_by_exemplar<T> >::make( std::move(exemplar) )
907 ){}

References tbb::move().

Here is the call graph for this function:

◆ enumerable_thread_specific() [5/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename P1 , typename... P, typename = typename internal::enable_if<!internal::is_callable_no_args<typename internal::strip<P1>::type>::value && !internal::is_compatible_ets<T, typename internal::strip<P1>::type>::value && !internal::is_same_type<T, typename internal::strip<P1>::type>::value >::type>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( P1 &&  arg1,
P &&...  args 
)
inline

Variadic constructor with initializer arguments. Each local instance of T is constructed by T(args...)

Definition at line 915 of file enumerable_thread_specific.h.

916 internal::callback_leaf<T,internal::construct_by_args<T,P1,P...> >::make( std::forward<P1>(arg1), std::forward<P>(args)... )
917 ){}

◆ ~enumerable_thread_specific()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::~enumerable_thread_specific ( )
inline

Destructor.

Definition at line 921 of file enumerable_thread_specific.h.

921 {
923 // Deallocate the hash table before overridden free_array() becomes inaccessible
924 this->internal::ets_base<ETS_key_type>::table_clear();
925 }

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_construct_callback.

◆ enumerable_thread_specific() [6/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( const enumerable_thread_specific< T, Allocator, ETS_key_type > &  other)
inline

Definition at line 1011 of file enumerable_thread_specific.h.

1012 : internal::ets_base<ETS_key_type>() /* prevents GCC warnings with -Wextra */
1013 {
1014 internal_copy(other);
1015 }
void internal_copy(const enumerable_thread_specific< T, A2, C2 > &other)

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy().

Here is the call graph for this function:

◆ enumerable_thread_specific() [7/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename Alloc , ets_key_usage_type Cachetype>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( const enumerable_thread_specific< T, Alloc, Cachetype > &  other)
inline

Definition at line 1018 of file enumerable_thread_specific.h.

1019 {
1020 internal_copy(other);
1021 }

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy().

Here is the call graph for this function:

◆ enumerable_thread_specific() [8/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( enumerable_thread_specific< T, Allocator, ETS_key_type > &&  other)
inline

Definition at line 1024 of file enumerable_thread_specific.h.

1025 {
1026 internal_swap(other);
1027 }
void internal_swap(enumerable_thread_specific &other)

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_swap().

Here is the call graph for this function:

◆ enumerable_thread_specific() [9/9]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename Alloc , ets_key_usage_type Cachetype>
tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific ( enumerable_thread_specific< T, Alloc, Cachetype > &&  other)
inline

Definition at line 1030 of file enumerable_thread_specific.h.

1031 {
1032 internal_move(std::move(other));
1033 }
void internal_move(enumerable_thread_specific< T, A2, C2 > &&other)

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_move().

Here is the call graph for this function:

Member Function Documentation

◆ begin() [1/2]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
iterator tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::begin ( )
inline

begin iterator

Definition at line 946 of file enumerable_thread_specific.h.

946{ return iterator( my_locals, 0 ); }
internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > iterator

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals.

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::combine(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::combine_each(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::range().

Here is the caller graph for this function:

◆ begin() [2/2]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
const_iterator tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::begin ( ) const
inline

begin const iterator

Definition at line 951 of file enumerable_thread_specific.h.

951{ return const_iterator(my_locals, 0); }
internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > const_iterator

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals.

◆ clear()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
void tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::clear ( )
inline

Destroys local copies.

Definition at line 963 of file enumerable_thread_specific.h.

963 {
965 this->table_clear();
966 // callback is not destroyed
967 }
void clear()
Clear container while keeping memory allocated.

References tbb::concurrent_vector< T, A >::clear(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals.

Referenced by tbb::combinable< T >::clear(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::operator=().

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

◆ combine()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename combine_func_t >
T tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::combine ( combine_func_t  f_combine)
inline

Definition at line 1077 of file enumerable_thread_specific.h.

1077 {
1078 if(begin() == end()) {
1079 internal::ets_element<T> location;
1080 my_construct_callback->construct(location.value());
1081 return *location.value_committed();
1082 }
1083 const_iterator ci = begin();
1084 T my_result = *ci;
1085 while(++ci != end())
1086 my_result = f_combine( my_result, *ci );
1087 return my_result;
1088 }

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::begin(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::end(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_construct_callback.

Referenced by tbb::combinable< T >::combine().

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

◆ combine_each()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename combine_func_t >
void tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::combine_each ( combine_func_t  f_combine)
inline

Definition at line 1092 of file enumerable_thread_specific.h.

1092 {
1093 for(iterator ci = begin(); ci != end(); ++ci) {
1094 f_combine( *ci );
1095 }
1096 }

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::begin(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::end().

Referenced by tbb::combinable< T >::combine_each().

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

◆ create_array()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
void * tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_array ( size_t  _size)
inlineprivate

Definition at line 854 of file enumerable_thread_specific.h.

854 {
855 size_t nelements = (_size + sizeof(uintptr_t) -1) / sizeof(uintptr_t);
856 return array_allocator_type().allocate(nelements);
857 }
Allocator::template rebind< uintptr_t >::other array_allocator_type

◆ create_local()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
void * tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local ( )
inlineprivate

Definition at line 829 of file enumerable_thread_specific.h.

829 {
830 padded_element& lref = *my_locals.grow_by(1);
831 my_construct_callback->construct(lref.value());
832 return lref.value_committed();
833 }
iterator grow_by(size_type delta)
Grow by "delta" elements.
internal::padded< internal::ets_element< T > > padded_element

References tbb::concurrent_vector< T, A >::grow_by(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_construct_callback, and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals.

Here is the call graph for this function:

◆ create_local_by_copy()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
static void * tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local_by_copy ( internal::ets_base< ETS_key_type > &  base,
void p 
)
inlinestaticprivate

Definition at line 835 of file enumerable_thread_specific.h.

835 {
837 padded_element& lref = *ets.my_locals.grow_by(1);
838 new(lref.value()) T(*static_cast<T*>(p));
839 return lref.value_committed();
840 }
void const char const char int ITT_FORMAT __itt_group_sync p

References tbb::concurrent_vector< T, A >::grow_by(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals, and p.

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy().

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

◆ create_local_by_move()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
static void * tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local_by_move ( internal::ets_base< ETS_key_type > &  base,
void p 
)
inlinestaticprivate

Definition at line 843 of file enumerable_thread_specific.h.

843 {
845 padded_element& lref = *ets.my_locals.grow_by(1);
846 new(lref.value()) T(std::move(*static_cast<T*>(p)));
847 return lref.value_committed();
848 }

References tbb::concurrent_vector< T, A >::grow_by(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals, and p.

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_move().

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

◆ empty()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
bool tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::empty ( ) const
inline

true if there have been no local copies created

Definition at line 943 of file enumerable_thread_specific.h.

943{ return my_locals.empty(); }
bool empty() const
Return false if vector is not empty or has elements under construction at least.

References tbb::concurrent_vector< T, A >::empty(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals.

Here is the call graph for this function:

◆ end() [1/2]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
iterator tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::end ( )
inline

end iterator

Definition at line 948 of file enumerable_thread_specific.h.

948{ return iterator(my_locals, my_locals.size() ); }
size_type size() const
Return size of vector. It may include elements under construction.

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals, and tbb::concurrent_vector< T, A >::size().

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::combine(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::combine_each(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::range().

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

◆ end() [2/2]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
const_iterator tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::end ( ) const
inline

end const iterator

Definition at line 954 of file enumerable_thread_specific.h.

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals, and tbb::concurrent_vector< T, A >::size().

Here is the call graph for this function:

◆ free_array()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
void tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::free_array ( void _ptr,
size_t  _size 
)
inlineprivate

Definition at line 859 of file enumerable_thread_specific.h.

859 {
860 size_t nelements = (_size + sizeof(uintptr_t) -1) / sizeof(uintptr_t);
861 array_allocator_type().deallocate( reinterpret_cast<uintptr_t *>(_ptr),nelements);
862 }

◆ internal_copy()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename A2 , ets_key_usage_type C2>
void tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy ( const enumerable_thread_specific< T, A2, C2 > &  other)
inlineprivate

Definition at line 972 of file enumerable_thread_specific.h.

972 {
973#if __TBB_ETS_USE_CPP11 && TBB_USE_ASSERT
974 // this tests is_compatible_ets
975 __TBB_STATIC_ASSERT( (internal::is_compatible_ets<T, typename internal::strip<decltype(other)>::type>::value), "is_compatible_ets fails" );
976#endif
977 // Initialize my_construct_callback first, so that it is valid even if rest of this routine throws an exception.
978 my_construct_callback = other.my_construct_callback->clone();
979 __TBB_ASSERT(my_locals.size()==0,NULL);
980 my_locals.reserve(other.size());
981 this->table_elementwise_copy( other, create_local_by_copy );
982 }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
#define __TBB_STATIC_ASSERT(condition, msg)
Definition: tbb_stddef.h:553
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
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 ITT_FORMAT lu const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type type
void reserve(size_type n)
Allocate enough space to grow to size n without having to allocate more memory later.
static void * create_local_by_copy(internal::ets_base< ETS_key_type > &base, void *p)
Strips its template type argument from cv- and ref-qualifiers.

References __TBB_ASSERT, __TBB_STATIC_ASSERT, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local_by_copy(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_construct_callback, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals, tbb::concurrent_vector< T, A >::reserve(), tbb::concurrent_vector< T, A >::size(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::size(), type, and value.

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::operator=().

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

◆ internal_move()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename A2 , ets_key_usage_type C2>
void tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_move ( enumerable_thread_specific< T, A2, C2 > &&  other)
inlineprivate

Definition at line 996 of file enumerable_thread_specific.h.

996 {
997#if TBB_USE_ASSERT
998 // this tests is_compatible_ets
999 __TBB_STATIC_ASSERT( (internal::is_compatible_ets<T, typename internal::strip<decltype(other)>::type>::value), "is_compatible_ets fails" );
1000#endif
1001 my_construct_callback = other.my_construct_callback;
1002 other.my_construct_callback = NULL;
1003 __TBB_ASSERT(my_locals.size()==0,NULL);
1004 my_locals.reserve(other.size());
1005 this->table_elementwise_copy( other, create_local_by_move );
1006 }
static void * create_local_by_move(internal::ets_base< ETS_key_type > &base, void *p)

References __TBB_ASSERT, __TBB_STATIC_ASSERT, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local_by_move(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_construct_callback, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals, tbb::concurrent_vector< T, A >::reserve(), tbb::concurrent_vector< T, A >::size(), type, and value.

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::operator=().

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

◆ internal_swap()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
void tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_swap ( enumerable_thread_specific< T, Allocator, ETS_key_type > &  other)
inlineprivate

Definition at line 984 of file enumerable_thread_specific.h.

984 {
985 using std::swap;
986 __TBB_ASSERT( this!=&other, NULL );
987 swap(my_construct_callback, other.my_construct_callback);
988 // concurrent_vector::swap() preserves storage space,
989 // so addresses to the vector kept in ETS hash table remain valid.
990 swap(my_locals, other.my_locals);
991 this->internal::ets_base<ETS_key_type>::table_swap(other);
992 }
void swap(atomic< T > &lhs, atomic< T > &rhs)
Definition: atomic.h:564

References __TBB_ASSERT, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_construct_callback, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals, and tbb::internal::swap().

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::enumerable_thread_specific(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::operator=().

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

◆ local() [1/2]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
reference tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::local ( )
inline

returns reference to local, discarding exists

Definition at line 928 of file enumerable_thread_specific.h.

928 {
929 bool exists;
930 return local(exists);
931 }
reference local()
returns reference to local, discarding exists

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::local().

Referenced by tbb::combinable< T >::local(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::local().

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

◆ local() [2/2]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
reference tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::local ( bool &  exists)
inline

Returns reference to calling thread's local copy, creating one if necessary.

Definition at line 934 of file enumerable_thread_specific.h.

934 {
935 void* ptr = this->table_lookup(exists);
936 return *(T*)ptr;
937 }

◆ operator=() [1/4]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
enumerable_thread_specific & tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::operator= ( const enumerable_thread_specific< T, Allocator, ETS_key_type > &  other)
inline

Definition at line 1036 of file enumerable_thread_specific.h.

1037 {
1038 if( this != &other ) {
1039 this->clear();
1040 my_construct_callback->destroy();
1041 internal_copy( other );
1042 }
1043 return *this;
1044 }

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::clear(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy().

Here is the call graph for this function:

◆ operator=() [2/4]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename Alloc , ets_key_usage_type Cachetype>
enumerable_thread_specific & tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::operator= ( const enumerable_thread_specific< T, Alloc, Cachetype > &  other)
inline

Definition at line 1047 of file enumerable_thread_specific.h.

1048 {
1049 __TBB_ASSERT( static_cast<void*>(this)!=static_cast<const void*>(&other), NULL ); // Objects of different types
1050 this->clear();
1051 my_construct_callback->destroy();
1052 internal_copy(other);
1053 return *this;
1054 }

References __TBB_ASSERT, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::clear(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy().

Here is the call graph for this function:

◆ operator=() [3/4]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
enumerable_thread_specific & tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::operator= ( enumerable_thread_specific< T, Allocator, ETS_key_type > &&  other)
inline

Definition at line 1057 of file enumerable_thread_specific.h.

1058 {
1059 if( this != &other )
1060 internal_swap(other);
1061 return *this;
1062 }

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_swap().

Here is the call graph for this function:

◆ operator=() [4/4]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename Alloc , ets_key_usage_type Cachetype>
enumerable_thread_specific & tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::operator= ( enumerable_thread_specific< T, Alloc, Cachetype > &&  other)
inline

Definition at line 1065 of file enumerable_thread_specific.h.

1066 {
1067 __TBB_ASSERT( static_cast<void*>(this)!=static_cast<const void*>(&other), NULL ); // Objects of different types
1068 this->clear();
1069 my_construct_callback->destroy();
1070 internal_move(std::move(other));
1071 return *this;
1072 }

References __TBB_ASSERT, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::clear(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_move().

Here is the call graph for this function:

◆ range() [1/2]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
range_type tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::range ( size_t  grainsize = 1)
inline

Get range for parallel algorithms.

Definition at line 957 of file enumerable_thread_specific.h.

957{ return range_type( begin(), end(), grainsize ); }

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::begin(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::end().

Here is the call graph for this function:

◆ range() [2/2]

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
const_range_type tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::range ( size_t  grainsize = 1) const
inline

Get const range for parallel algorithms.

Definition at line 960 of file enumerable_thread_specific.h.

960{ return const_range_type( begin(), end(), grainsize ); }
generic_range_type< const_iterator > const_range_type

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::begin(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::end().

Here is the call graph for this function:

◆ size()

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
size_type tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::size ( ) const
inline

Get the number of local copies.

Definition at line 940 of file enumerable_thread_specific.h.

940{ return my_locals.size(); }

References tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_locals, and tbb::concurrent_vector< T, A >::size().

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_copy().

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

Friends And Related Function Documentation

◆ enumerable_thread_specific

template<typename T , typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
template<typename U , typename A , ets_key_usage_type C>
friend class enumerable_thread_specific
friend

Definition at line 801 of file enumerable_thread_specific.h.

Member Data Documentation

◆ my_construct_callback

◆ my_locals


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.