Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
combinable.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2005-2020 Intel Corporation
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 #ifndef __TBB_combinable_H
18 #define __TBB_combinable_H
19 
20 #define __TBB_combinable_H_include_area
22 
25 
26 namespace tbb {
30 
32  template <typename T>
33  class combinable {
34 
35  private:
39 
40  public:
41 
42  combinable() { }
43 
44  template <typename finit>
45  explicit combinable( finit _finit) : my_ets(_finit) { }
46 
49 
50  combinable( const combinable& other) : my_ets(other.my_ets) { }
51 
52 #if __TBB_ETS_USE_CPP11
53  combinable( combinable&& other) : my_ets( std::move(other.my_ets)) { }
54 #endif
55 
56  combinable & operator=( const combinable & other) {
57  my_ets = other.my_ets;
58  return *this;
59  }
60 
61 #if __TBB_ETS_USE_CPP11
62  combinable & operator=( combinable && other) {
63  my_ets=std::move(other.my_ets);
64  return *this;
65  }
66 #endif
67 
68  void clear() { my_ets.clear(); }
69 
70  T& local() { return my_ets.local(); }
71 
72  T& local(bool & exists) { return my_ets.local(exists); }
73 
74  // combine_func_t has signature T(T,T) or T(const T&, const T&)
75  template <typename combine_func_t>
76  T combine(combine_func_t f_combine) { return my_ets.combine(f_combine); }
77 
78  // combine_func_t has signature void(T) or void(const T&)
79  template <typename combine_func_t>
80  void combine_each(combine_func_t f_combine) { my_ets.combine_each(f_combine); }
81 
82  };
83 } // namespace tbb
84 
86 #undef __TBB_combinable_H_include_area
87 
88 #endif /* __TBB_combinable_H */
tbb::combinable::combinable
combinable(finit _finit)
Definition: combinable.h:45
tbb::interface6::enumerable_thread_specific::local
reference local()
returns reference to local, discarding exists
Definition: enumerable_thread_specific.h:928
tbb::interface6::enumerable_thread_specific::combine
T combine(combine_func_t f_combine)
Definition: enumerable_thread_specific.h:1077
tbb::combinable::combinable
combinable(const combinable &other)
Definition: combinable.h:50
cache_aligned_allocator.h
tbb
The graph class.
Definition: serial/tbb/parallel_for.h:46
tbb::cache_aligned_allocator
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Definition: cache_aligned_allocator.h:60
tbb::combinable::local
T & local(bool &exists)
Definition: combinable.h:72
tbb::interface6::enumerable_thread_specific
The enumerable_thread_specific container.
Definition: enumerable_thread_specific.h:63
tbb::combinable::combine_each
void combine_each(combine_func_t f_combine)
Definition: combinable.h:80
tbb::combinable::~combinable
~combinable()
destructor
Definition: combinable.h:48
tbb::combinable::local
T & local()
Definition: combinable.h:70
tbb::combinable::combine
T combine(combine_func_t f_combine)
Definition: combinable.h:76
tbb::move
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
enumerable_thread_specific.h
tbb::combinable
Thread-local storage with optional reduction.
Definition: combinable.h:33
tbb::combinable::combinable
combinable()
Definition: combinable.h:42
tbb::interface6::enumerable_thread_specific::combine_each
void combine_each(combine_func_t f_combine)
Definition: enumerable_thread_specific.h:1092
tbb::combinable::my_alloc
tbb::cache_aligned_allocator< T > my_alloc
Definition: combinable.h:36
_warning_suppress_disable_notice.h
tbb::interface6::enumerable_thread_specific::clear
void clear()
Destroys local copies.
Definition: enumerable_thread_specific.h:963
tbb::combinable::clear
void clear()
Definition: combinable.h:68
tbb::combinable::operator=
combinable & operator=(const combinable &other)
Definition: combinable.h:56
tbb::combinable::my_ets
my_ets_type my_ets
Definition: combinable.h:38
_warning_suppress_enable_notice.h
tbb::combinable::my_ets_type
tbb::enumerable_thread_specific< T, my_alloc, ets_no_key > my_ets_type
Definition: combinable.h:37

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.