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 50 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 830 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 814 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 841 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 835 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 845 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 833 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 837 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 784 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 840 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 783 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 766 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 834 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 844 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 832 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 836 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 831 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 848 of file enumerable_thread_specific.h.

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

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

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

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

864  internal::callback_leaf<T,internal::construct_by_exemplar<T> >::make( exemplar )
865  ){}

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

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

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

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

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

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

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

975  : internal::ets_base<ETS_key_type>() /* prevents GCC warnings with -Wextra */
976  {
977  internal_copy(other);
978  }
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 981 of file enumerable_thread_specific.h.

982  {
983  internal_copy(other);
984  }
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 987 of file enumerable_thread_specific.h.

988  {
989  internal_swap(other);
990  }
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 993 of file enumerable_thread_specific.h.

994  {
995  internal_move(std::move(other));
996  }
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:305
void internal_move(enumerable_thread_specific< T, A2, C2 > &&other)

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

909 { 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 914 of file enumerable_thread_specific.h.

914 { 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 926 of file enumerable_thread_specific.h.

926  {
927  my_locals.clear();
928  this->table_clear();
929  // callback is not destroyed
930  }
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 1040 of file enumerable_thread_specific.h.

1040  {
1041  if(begin() == end()) {
1042  internal::ets_element<T> location;
1043  my_construct_callback->construct(location.value());
1044  return *location.value_committed();
1045  }
1046  const_iterator ci = begin();
1047  T my_result = *ci;
1048  while(++ci != end())
1049  my_result = f_combine( my_result, *ci );
1050  return my_result;
1051  }
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 1055 of file enumerable_thread_specific.h.

1055  {
1056  for(iterator ci = begin(); ci != end(); ++ci) {
1057  f_combine( *ci );
1058  }
1059  }
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 817 of file enumerable_thread_specific.h.

817  {
818  size_t nelements = (_size + sizeof(uintptr_t) -1) / sizeof(uintptr_t);
819  return array_allocator_type().allocate(nelements);
820  }
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 792 of file enumerable_thread_specific.h.

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

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

798  {
799  enumerable_thread_specific& ets = static_cast<enumerable_thread_specific&>(base);
800  padded_element& lref = *ets.my_locals.grow_by(1);
801  new(lref.value()) T(*static_cast<T*>(p));
802  return lref.value_committed();
803  }
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 806 of file enumerable_thread_specific.h.

806  {
807  enumerable_thread_specific& ets = static_cast<enumerable_thread_specific&>(base);
808  padded_element& lref = *ets.my_locals.grow_by(1);
809  new(lref.value()) T(std::move(*static_cast<T*>(p)));
810  return lref.value_committed();
811  }
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:305
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.

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

906 { 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 911 of file enumerable_thread_specific.h.

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

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

917 { 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 822 of file enumerable_thread_specific.h.

822  {
823  size_t nelements = (_size + sizeof(uintptr_t) -1) / sizeof(uintptr_t);
824  array_allocator_type().deallocate( reinterpret_cast<uintptr_t *>(_ptr),nelements);
825  }
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 935 of file enumerable_thread_specific.h.

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

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

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

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

947  {
948  using std::swap;
949  __TBB_ASSERT( this!=&other, NULL );
950  swap(my_construct_callback, other.my_construct_callback);
951  // concurrent_vector::swap() preserves storage space,
952  // so addresses to the vector kept in ETS hash table remain valid.
953  swap(my_locals, other.my_locals);
954  this->internal::ets_base<ETS_key_type>::table_swap(other);
955  }
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
void swap(atomic< T > &lhs, atomic< T > &rhs)
Definition: atomic.h:535
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 891 of file enumerable_thread_specific.h.

891  {
892  bool exists;
893  return local(exists);
894  }
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 897 of file enumerable_thread_specific.h.

897  {
898  void* ptr = this->table_lookup(exists);
899  return *(T*)ptr;
900  }

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

1000  {
1001  if( this != &other ) {
1002  this->clear();
1003  my_construct_callback->destroy();
1004  internal_copy( other );
1005  }
1006  return *this;
1007  }
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 1010 of file enumerable_thread_specific.h.

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

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

1021  {
1022  if( this != &other )
1023  internal_swap(other);
1024  return *this;
1025  }
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 1028 of file enumerable_thread_specific.h.

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

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

923 { 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 903 of file enumerable_thread_specific.h.

903 { 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 764 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 786 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 788 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.