Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
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. More...
 
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. More...
 
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()). More...
 
 enumerable_thread_specific (const T &exemplar)
 Constructor with exemplar. Each local instance of T is copy-constructed from the exemplar. More...
 
 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...) More...
 
 ~enumerable_thread_specific ()
 Destructor. More...
 
reference local ()
 returns reference to local, discarding exists More...
 
reference local (bool &exists)
 Returns reference to calling thread's local copy, creating one if necessary. More...
 
size_type size () const
 Get the number of local copies. More...
 
bool empty () const
 true if there have been no local copies created More...
 
iterator begin ()
 begin iterator More...
 
iterator end ()
 end iterator More...
 
const_iterator begin () const
 begin const iterator More...
 
const_iterator end () const
 end const iterator More...
 
range_type range (size_t grainsize=1)
 Get range for parallel algorithms. More...
 
const_range_type range (size_t grainsize=1) const
 Get const range for parallel algorithms. More...
 
void clear ()
 Destroys local copies. More...
 
 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_no_key > &base, void *p)
 
static voidcreate_local_by_move (internal::ets_base< ets_no_key > &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 54 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 834 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 818 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 845 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 839 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 849 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 837 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 841 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 788 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 844 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 787 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 770 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 838 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 848 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 836 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 840 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 835 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 852 of file enumerable_thread_specific.h.

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

◆ 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 862 of file enumerable_thread_specific.h.

863  internal::callback_leaf<T,internal::construct_by_finit<T,Finit> >::make( tbb::internal::move(finit) )
864  ){}
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:309

◆ 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 867 of file enumerable_thread_specific.h.

868  internal::callback_leaf<T,internal::construct_by_exemplar<T> >::make( exemplar )
869  ){}

◆ 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 872 of file enumerable_thread_specific.h.

873  internal::callback_leaf<T,internal::construct_by_exemplar<T> >::make( std::move(exemplar) )
874  ){}
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:309

◆ 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 882 of file enumerable_thread_specific.h.

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

◆ ~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 888 of file enumerable_thread_specific.h.

888  {
890  // Deallocate the hash table before overridden free_array() becomes inaccessible
891  this->internal::ets_base<ets_no_key>::table_clear();
892  }

◆ 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 978 of file enumerable_thread_specific.h.

979  : internal::ets_base<ETS_key_type>() /* prevents GCC warnings with -Wextra */
980  {
981  internal_copy(other);
982  }
void internal_copy(const enumerable_thread_specific< T, A2, C2 > &other)

◆ 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 985 of file enumerable_thread_specific.h.

986  {
987  internal_copy(other);
988  }
void internal_copy(const enumerable_thread_specific< T, A2, C2 > &other)

◆ 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 991 of file enumerable_thread_specific.h.

992  {
993  internal_swap(other);
994  }
void internal_swap(enumerable_thread_specific &other)

◆ 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 997 of file enumerable_thread_specific.h.

998  {
999  internal_move(std::move(other));
1000  }
void internal_move(enumerable_thread_specific< T, A2, C2 > &&other)
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:309

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 913 of file enumerable_thread_specific.h.

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

◆ 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 918 of file enumerable_thread_specific.h.

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

◆ 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 930 of file enumerable_thread_specific.h.

930  {
931  my_locals.clear();
932  this->table_clear();
933  // callback is not destroyed
934  }
void clear()
Clear container while keeping memory allocated.

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

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 1044 of file enumerable_thread_specific.h.

1044  {
1045  if(begin() == end()) {
1046  internal::ets_element<T> location;
1047  my_construct_callback->construct(location.value());
1048  return *location.value_committed();
1049  }
1050  const_iterator ci = begin();
1051  T my_result = *ci;
1052  while(++ci != end())
1053  my_result = f_combine( my_result, *ci );
1054  return my_result;
1055  }
internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > const_iterator

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

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 1059 of file enumerable_thread_specific.h.

1059  {
1060  for(iterator ci = begin(); ci != end(); ++ci) {
1061  f_combine( *ci );
1062  }
1063  }
internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > iterator

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

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 821 of file enumerable_thread_specific.h.

821  {
822  size_t nelements = (_size + sizeof(uintptr_t) -1) / sizeof(uintptr_t);
823  return array_allocator_type().allocate(nelements);
824  }
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 796 of file enumerable_thread_specific.h.

796  {
797  padded_element& lref = *my_locals.grow_by(1);
798  my_construct_callback->construct(lref.value());
799  return lref.value_committed();
800  }
internal::padded< internal::ets_element< T > > padded_element
iterator grow_by(size_type delta)
Grow by "delta" elements.

◆ 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_no_key > &  base,
void p 
)
inlinestaticprivate

Definition at line 802 of file enumerable_thread_specific.h.

802  {
803  enumerable_thread_specific& ets = static_cast<enumerable_thread_specific&>(base);
804  padded_element& lref = *ets.my_locals.grow_by(1);
805  new(lref.value()) T(*static_cast<T*>(p));
806  return lref.value_committed();
807  }
internal::padded< internal::ets_element< T > > padded_element
void const char const char int ITT_FORMAT __itt_group_sync p
enumerable_thread_specific()
Default constructor. Each local instance of T is default constructed.

◆ 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_no_key > &  base,
void p 
)
inlinestaticprivate

Definition at line 810 of file enumerable_thread_specific.h.

810  {
811  enumerable_thread_specific& ets = static_cast<enumerable_thread_specific&>(base);
812  padded_element& lref = *ets.my_locals.grow_by(1);
813  new(lref.value()) T(std::move(*static_cast<T*>(p)));
814  return lref.value_committed();
815  }
internal::padded< internal::ets_element< T > > padded_element
void const char const char int ITT_FORMAT __itt_group_sync p
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:309
enumerable_thread_specific()
Default constructor. Each local instance of T is default constructed.

◆ 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 910 of file enumerable_thread_specific.h.

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

◆ 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 915 of file enumerable_thread_specific.h.

915 { return iterator(my_locals, my_locals.size() ); }
size_type size() const
Return size of vector. It may include elements under construction.
internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > iterator

◆ 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 921 of file enumerable_thread_specific.h.

921 { return const_iterator(my_locals, my_locals.size()); }
internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > const_iterator
size_type size() const
Return size of vector. It may include elements under construction.

◆ 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 826 of file enumerable_thread_specific.h.

826  {
827  size_t nelements = (_size + sizeof(uintptr_t) -1) / sizeof(uintptr_t);
828  array_allocator_type().deallocate( reinterpret_cast<uintptr_t *>(_ptr),nelements);
829  }
Allocator::template rebind< uintptr_t >::other array_allocator_type

◆ 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 939 of file enumerable_thread_specific.h.

939  {
940 #if __TBB_ETS_USE_CPP11 && TBB_USE_ASSERT
941  // this tests is_compatible_ets
942  __TBB_STATIC_ASSERT( (internal::is_compatible_ets<T, typename internal::strip<decltype(other)>::type>::value), "is_compatible_ets fails" );
943 #endif
944  // Initialize my_construct_callback first, so that it is valid even if rest of this routine throws an exception.
945  my_construct_callback = other.my_construct_callback->clone();
946  __TBB_ASSERT(my_locals.size()==0,NULL);
947  my_locals.reserve(other.size());
948  this->table_elementwise_copy( other, create_local_by_copy );
949  }
void reserve(size_type n)
Allocate enough space to grow to size n without having to allocate more memory later.
#define __TBB_STATIC_ASSERT(condition, msg)
Definition: tbb_stddef.h:536
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
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_id __itt_string_handle __itt_metadata_type type
static void * create_local_by_copy(internal::ets_base< ets_no_key > &base, void *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
size_type size() const
Return size of vector. It may include elements under construction.

◆ 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 963 of file enumerable_thread_specific.h.

963  {
964 #if TBB_USE_ASSERT
965  // this tests is_compatible_ets
966  __TBB_STATIC_ASSERT( (internal::is_compatible_ets<T, typename internal::strip<decltype(other)>::type>::value), "is_compatible_ets fails" );
967 #endif
968  my_construct_callback = other.my_construct_callback;
969  other.my_construct_callback = NULL;
970  __TBB_ASSERT(my_locals.size()==0,NULL);
971  my_locals.reserve(other.size());
972  this->table_elementwise_copy( other, create_local_by_move );
973  }
void reserve(size_type n)
Allocate enough space to grow to size n without having to allocate more memory later.
#define __TBB_STATIC_ASSERT(condition, msg)
Definition: tbb_stddef.h:536
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
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_id __itt_string_handle __itt_metadata_type type
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
size_type size() const
Return size of vector. It may include elements under construction.
static void * create_local_by_move(internal::ets_base< ets_no_key > &base, void *p)

◆ 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 951 of file enumerable_thread_specific.h.

951  {
952  using std::swap;
953  __TBB_ASSERT( this!=&other, NULL );
954  swap(my_construct_callback, other.my_construct_callback);
955  // concurrent_vector::swap() preserves storage space,
956  // so addresses to the vector kept in ETS hash table remain valid.
957  swap(my_locals, other.my_locals);
958  this->internal::ets_base<ETS_key_type>::table_swap(other);
959  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
void swap(atomic< T > &lhs, atomic< T > &rhs)
Definition: atomic.h:539
void swap(concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)

◆ 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 895 of file enumerable_thread_specific.h.

895  {
896  bool exists;
897  return local(exists);
898  }
reference local()
returns reference to local, discarding exists

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

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 901 of file enumerable_thread_specific.h.

901  {
902  void* ptr = this->table_lookup(exists);
903  return *(T*)ptr;
904  }

◆ 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 1003 of file enumerable_thread_specific.h.

1004  {
1005  if( this != &other ) {
1006  this->clear();
1007  my_construct_callback->destroy();
1008  internal_copy( other );
1009  }
1010  return *this;
1011  }
void internal_copy(const enumerable_thread_specific< T, A2, C2 > &other)

◆ 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 1014 of file enumerable_thread_specific.h.

1015  {
1016  __TBB_ASSERT( static_cast<void*>(this)!=static_cast<const void*>(&other), NULL ); // Objects of different types
1017  this->clear();
1018  my_construct_callback->destroy();
1019  internal_copy(other);
1020  return *this;
1021  }
void internal_copy(const enumerable_thread_specific< T, A2, C2 > &other)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169

◆ 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 1024 of file enumerable_thread_specific.h.

1025  {
1026  if( this != &other )
1027  internal_swap(other);
1028  return *this;
1029  }
void internal_swap(enumerable_thread_specific &other)

◆ 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 1032 of file enumerable_thread_specific.h.

1033  {
1034  __TBB_ASSERT( static_cast<void*>(this)!=static_cast<const void*>(&other), NULL ); // Objects of different types
1035  this->clear();
1036  my_construct_callback->destroy();
1037  internal_move(std::move(other));
1038  return *this;
1039  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
void internal_move(enumerable_thread_specific< T, A2, C2 > &&other)
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:309

◆ 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 924 of file enumerable_thread_specific.h.

◆ 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 927 of file enumerable_thread_specific.h.

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

◆ 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 907 of file enumerable_thread_specific.h.

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

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 768 of file enumerable_thread_specific.h.

Member Data Documentation

◆ my_construct_callback

template<typename T, typename Allocator = cache_aligned_allocator<T>, ets_key_usage_type ETS_key_type = ets_no_key>
internal::callback_base<T>* tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_construct_callback
private

Definition at line 790 of file enumerable_thread_specific.h.

◆ my_locals

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

Definition at line 792 of file enumerable_thread_specific.h.


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

Copyright © 2005-2019 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.