tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type > Class Template Reference
Containers

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_type > | iterator
typedef internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > | const_iterator
typedef generic_range_type< iterator > | range_type
typedef generic_range_type< const_iterator > | const_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_specific & | operator= (const enumerable_thread_specific &other)
template<typename Alloc , ets_key_usage_type Cachetype>
enumerable_thread_specific & | operator= (const enumerable_thread_specific< T, Alloc, Cachetype > &other)
enumerable_thread_specific & | operator= (enumerable_thread_specific &&other)
template<typename Alloc , ets_key_usage_type Cachetype>
enumerable_thread_specific & | operator= (enumerable_thread_specific< T, Alloc, Cachetype > &&other)
template<typename combine_func_t >
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_type > | internal_collection_type
typedef Allocator::template rebind< uintptr_t >::other | array_allocator_type

## Private Member Functions

void * | create_local () __TBB_override
void * | create_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 void * | create_local_by_copy (internal::ets_base< ETS_key_type > &base, void *p)
static void * | create_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.

: my_construct_callback(
internal::callback_leaf<T,internal::construct_by_default<T> >::make(/*dummy argument*/0)
){}
tbb::interface6::enumerable_thread_specific::my_construct_callback
internal::callback_base< T > * my_construct_callback
Definition: enumerable_thread_specific.h:823

## 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 | ) |

inline explicit

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

Definition at line 895 of file enumerable_thread_specific.h.

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

## 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 | ) |

inline explicit

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

Definition at line 900 of file enumerable_thread_specific.h.

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

## 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 | ) |

inline explicit

Definition at line 905 of file enumerable_thread_specific.h.

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

## 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.

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

## ~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.

{
if(my_construct_callback) my_construct_callback->destroy();
// Deallocate the hash table before overridden free_array() becomes inaccessible
this->internal::ets_base<ETS_key_type>::table_clear();
}

## 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.

: internal::ets_base<ETS_key_type>() /* prevents GCC warnings with -Wextra */
{
internal_copy(other);
}
tbb::interface6::enumerable_thread_specific::internal_copy
void internal_copy(const enumerable_thread_specific< T, A2, C2 > &other)
Definition: enumerable_thread_specific.h:972

## 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.

{
internal_copy(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 1024 of file enumerable_thread_specific.h.

: my_construct_callback()
{
internal_swap(other);
}
tbb::interface6::enumerable_thread_specific::internal_swap
void internal_swap(enumerable_thread_specific &other)
Definition: enumerable_thread_specific.h:984

## 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.

: my_construct_callback()
{
internal_move(std::move(other));
}
tbb::interface6::enumerable_thread_specific::internal_move
void internal_move(enumerable_thread_specific< T, A2, C2 > &&other)
Definition: enumerable_thread_specific.h:996

References tbb::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.

{ return iterator( my_locals, 0 ); }
tbb::interface6::enumerable_thread_specific::iterator
internal::enumerable_thread_specific_iterator< internal_collection_type, value_type > iterator
Definition: enumerable_thread_specific.h:877
tbb::interface6::enumerable_thread_specific::my_locals
internal_collection_type my_locals
Definition: enumerable_thread_specific.h:825

## 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.

{ return const_iterator(my_locals, 0); }
tbb::interface6::enumerable_thread_specific::const_iterator
internal::enumerable_thread_specific_iterator< internal_collection_type, const value_type > const_iterator
Definition: enumerable_thread_specific.h:878

## 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.

{
my_locals.clear();
this->table_clear();
// callback is not destroyed
}
tbb::concurrent_vector::clear
void clear()
Clear container while keeping memory allocated.
Definition: concurrent_vector.h:1018

References tbb::concurrent_vector< T, A >::clear().

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

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.

{
if(begin() == end()) {
internal::ets_element<T> location;
my_construct_callback->construct(location.value());
return *location.value_committed();
}
const_iterator ci = begin();
T my_result = *ci;
while(++ci != end())
my_result = f_combine( my_result, *ci );
return my_result;
}
tbb::interface6::enumerable_thread_specific::begin
iterator begin()
begin iterator
Definition: enumerable_thread_specific.h:946
tbb::interface6::enumerable_thread_specific::end
iterator end()
end iterator
Definition: enumerable_thread_specific.h:948

References begin, and end.

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

{
for(iterator ci = begin(); ci != end(); ++ci) {
f_combine( *ci );
}
}

References begin, and end.

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 | ) |

inline private

Definition at line 854 of file enumerable_thread_specific.h.

{
size_t nelements = (_size + sizeof(uintptr_t) -1) / sizeof(uintptr_t);
return array_allocator_type().allocate(nelements);
}
tbb::interface6::enumerable_thread_specific::array_allocator_type
Allocator::template rebind< uintptr_t >::other array_allocator_type
Definition: enumerable_thread_specific.h:851

## 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 | ( |  | ) |

inline private

Definition at line 829 of file enumerable_thread_specific.h.

{
padded_element& lref = *my_locals.grow_by(1);
my_construct_callback->construct(lref.value());
return lref.value_committed();
}
tbb::concurrent_vector::grow_by
iterator grow_by(size_type delta)
Grow by "delta" elements.
Definition: concurrent_vector.h:783
tbb::interface6::enumerable_thread_specific::padded_element
internal::padded< internal::ets_element< T > > padded_element
Definition: enumerable_thread_specific.h:803

References tbb::concurrent_vector< T, A >::grow_by().

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
| ) |  |

inline static private

Definition at line 835 of file enumerable_thread_specific.h.

{
enumerable_thread_specific& ets = static_cast<enumerable_thread_specific&>(base);
padded_element& lref = *ets.my_locals.grow_by(1);
new(lref.value()) T(*static_cast<T*>(p));
return lref.value_committed();
}
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91
tbb::interface6::enumerable_thread_specific::enumerable_thread_specific
friend class enumerable_thread_specific
Definition: enumerable_thread_specific.h:801

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

Here is the call 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
| ) |  |

inline static private

Definition at line 843 of file enumerable_thread_specific.h.

{
enumerable_thread_specific& ets = static_cast<enumerable_thread_specific&>(base);
padded_element& lref = *ets.my_locals.grow_by(1);
new(lref.value()) T(std::move(*static_cast<T*>(p)));
return lref.value_committed();
}

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

Here is the call 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.

{ return my_locals.empty(); }
tbb::concurrent_vector::empty
bool empty() const
Return false if vector is not empty or has elements under construction at least.
Definition: concurrent_vector.h:906

References tbb::concurrent_vector< T, A >::empty().

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.

{ return iterator(my_locals, my_locals.size() ); }
tbb::concurrent_vector::size
size_type size() const
Return size of vector. It may include elements under construction.
Definition: concurrent_vector.h:900

References tbb::concurrent_vector< T, A >::size().

Here is the call 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.

{ return const_iterator(my_locals, my_locals.size()); }

References 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
| ) |  |

inline private

Definition at line 859 of file enumerable_thread_specific.h.

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

## 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 | ) |

inline private

Definition at line 972 of file enumerable_thread_specific.h.

{
#if __TBB_ETS_USE_CPP11 && TBB_USE_ASSERT
// this tests is_compatible_ets
__TBB_STATIC_ASSERT( (internal::is_compatible_ets<T, typename internal::strip<decltype(other)>::type>::value), "is_compatible_ets fails" );
#endif
// Initialize my_construct_callback first, so that it is valid even if rest of this routine throws an exception.
my_construct_callback = other.my_construct_callback->clone();
__TBB_ASSERT(my_locals.size()==0,NULL);
my_locals.reserve(other.size());
this->table_elementwise_copy( other, create_local_by_copy );
}
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
__TBB_STATIC_ASSERT
#define __TBB_STATIC_ASSERT(condition, msg)
Definition: tbb_stddef.h:553
value
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
Definition: ittnotify_static.h:192
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 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
Definition: ittnotify_static.h:198
tbb::concurrent_vector::reserve
void reserve(size_type n)
Allocate enough space to grow to size n without having to allocate more memory later.
Definition: concurrent_vector.h:914
tbb::interface6::enumerable_thread_specific::create_local_by_copy
static void * create_local_by_copy(internal::ets_base< ETS_key_type > &base, void *p)
Definition: enumerable_thread_specific.h:835
tbb::internal::strip
Strips its template type argument from cv- and ref-qualifiers.
Definition: _template_helpers.h:38

References __TBB_ASSERT, __TBB_STATIC_ASSERT, tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::my_construct_callback, 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.

Here is the call 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 | ) |

inline private

Definition at line 996 of file enumerable_thread_specific.h.

{
#if TBB_USE_ASSERT
// this tests is_compatible_ets
__TBB_STATIC_ASSERT( (internal::is_compatible_ets<T, typename internal::strip<decltype(other)>::type>::value), "is_compatible_ets fails" );
#endif
my_construct_callback = other.my_construct_callback;
other.my_construct_callback = NULL;
__TBB_ASSERT(my_locals.size()==0,NULL);
my_locals.reserve(other.size());
this->table_elementwise_copy( other, create_local_by_move );
}
tbb::interface6::enumerable_thread_specific::create_local_by_move
static void * create_local_by_move(internal::ets_base< ETS_key_type > &base, void *p)
Definition: enumerable_thread_specific.h:843

References __TBB_ASSERT, __TBB_STATIC_ASSERT, tbb::concurrent_vector< T, A >::reserve(), tbb::concurrent_vector< T, A >::size(), type, and value.

Here is the call 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 | ) |

inline private

Definition at line 984 of file enumerable_thread_specific.h.

{
using std::swap;
__TBB_ASSERT( this!=&other, NULL );
swap(my_construct_callback, other.my_construct_callback);
// concurrent_vector::swap() preserves storage space,
// so addresses to the vector kept in ETS hash table remain valid.
swap(my_locals, other.my_locals);
this->internal::ets_base<ETS_key_type>::table_swap(other);
}
tbb::swap
void swap(concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)
Definition: concurrent_hash_map.h:1638
tbb::internal::swap
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, tbb::internal::swap(), and tbb::swap().

Here is the call 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.

{
bool exists;
return local(exists);
}
tbb::interface6::enumerable_thread_specific::local
reference local()
returns reference to local, discarding exists
Definition: enumerable_thread_specific.h:928

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

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

## 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.

{
if( this != &other ) {
this->clear();
my_construct_callback->destroy();
internal_copy( other );
}
return *this;
}
tbb::interface6::enumerable_thread_specific::clear
void clear()
Destroys local copies.
Definition: enumerable_thread_specific.h:963

## 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.

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

References __TBB_ASSERT.

## 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.

{
if( this != &other )
internal_swap(other);
return *this;
}

## 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.

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

References __TBB_ASSERT, and tbb::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.

{ return range_type( begin(), end(), grainsize ); }
tbb::interface6::enumerable_thread_specific::range_type
generic_range_type< iterator > range_type
Definition: enumerable_thread_specific.h:881

References begin, and end.

## 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.

{ return const_range_type( begin(), end(), grainsize ); }
tbb::interface6::enumerable_thread_specific::const_range_type
generic_range_type< const_iterator > const_range_type
Definition: enumerable_thread_specific.h:882

References begin, and end.

## 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.

{ return my_locals.size(); }

References 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

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

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

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

Referenced by tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local_by_copy(), tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::create_local_by_move(), and tbb::interface6::enumerable_thread_specific< T, Allocator, ETS_key_type >::internal_swap().

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

- enumerable_thread_specific.h

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.