File indexing completed on 2025-01-18 10:12:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __TBB_combinable_H
0018 #define __TBB_combinable_H
0019
0020 #define __TBB_combinable_H_include_area
0021 #include "internal/_warning_suppress_enable_notice.h"
0022
0023 #include "enumerable_thread_specific.h"
0024 #include "cache_aligned_allocator.h"
0025
0026 namespace tbb {
0027
0028
0029
0030
0031
0032 template <typename T>
0033 class combinable {
0034
0035 private:
0036 typedef typename tbb::cache_aligned_allocator<T> my_alloc;
0037 typedef typename tbb::enumerable_thread_specific<T, my_alloc, ets_no_key> my_ets_type;
0038 my_ets_type my_ets;
0039
0040 public:
0041
0042 combinable() { }
0043
0044 template <typename finit>
0045 explicit combinable( finit _finit) : my_ets(_finit) { }
0046
0047
0048 ~combinable() { }
0049
0050 combinable( const combinable& other) : my_ets(other.my_ets) { }
0051
0052 #if __TBB_ETS_USE_CPP11
0053 combinable( combinable&& other) : my_ets( std::move(other.my_ets)) { }
0054 #endif
0055
0056 combinable & operator=( const combinable & other) {
0057 my_ets = other.my_ets;
0058 return *this;
0059 }
0060
0061 #if __TBB_ETS_USE_CPP11
0062 combinable & operator=( combinable && other) {
0063 my_ets=std::move(other.my_ets);
0064 return *this;
0065 }
0066 #endif
0067
0068 void clear() { my_ets.clear(); }
0069
0070 T& local() { return my_ets.local(); }
0071
0072 T& local(bool & exists) { return my_ets.local(exists); }
0073
0074
0075 template <typename combine_func_t>
0076 T combine(combine_func_t f_combine) { return my_ets.combine(f_combine); }
0077
0078
0079 template <typename combine_func_t>
0080 void combine_each(combine_func_t f_combine) { my_ets.combine_each(f_combine); }
0081
0082 };
0083 }
0084
0085 #include "internal/_warning_suppress_disable_notice.h"
0086 #undef __TBB_combinable_H_include_area
0087
0088 #endif