29 #include "vtkCommonCoreModule.h"
32 #include "vtkSMPThreadLocal.h"
33 #include "vtkSMPToolsInternal.h"
35 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 class vtkSMPTools_Has_Initialize
46 typedef char (&no_type)[1];
47 typedef char (&yes_type)[2];
48 template <
typename U,
void (U::*)()>
53 static yes_type check(V<U, &U::Initialize>*);
55 static no_type check(...);
58 static bool const value =
sizeof(check<T>(
nullptr)) ==
sizeof(yes_type);
62 class vtkSMPTools_Has_Initialize_const
64 typedef char (&no_type)[1];
65 typedef char (&yes_type)[2];
66 template <
typename U,
void (U::*)() const>
71 static yes_type check(V<U, &U::Initialize>*);
73 static no_type check(...);
76 static bool const value =
sizeof(check<T>(0)) ==
sizeof(yes_type);
79 template <
typename Functor,
bool Init>
80 struct vtkSMPTools_FunctorInternal;
82 template <
typename Functor>
83 struct vtkSMPTools_FunctorInternal<Functor, false>
86 vtkSMPTools_FunctorInternal(Functor& f)
93 vtk::detail::smp::vtkSMPTools_Impl_For(first, last, grain, *
this);
95 vtkSMPTools_FunctorInternal<Functor, false>& operator=(
96 const vtkSMPTools_FunctorInternal<Functor, false>&);
97 vtkSMPTools_FunctorInternal<Functor, false>(
const vtkSMPTools_FunctorInternal<Functor, false>&);
100 template <
typename Functor>
101 struct vtkSMPTools_FunctorInternal<Functor, true>
104 vtkSMPThreadLocal<unsigned char> Initialized;
105 vtkSMPTools_FunctorInternal(Functor& f)
112 unsigned char& inited = this->Initialized.Local();
115 this->F.Initialize();
118 this->F(first, last);
122 vtk::detail::smp::vtkSMPTools_Impl_For(first, last, grain, *
this);
125 vtkSMPTools_FunctorInternal<Functor, true>& operator=(
126 const vtkSMPTools_FunctorInternal<Functor, true>&);
127 vtkSMPTools_FunctorInternal<Functor, true>(
const vtkSMPTools_FunctorInternal<Functor, true>&);
130 template <
typename Functor>
131 class vtkSMPTools_Lookup_For
136 typedef vtkSMPTools_FunctorInternal<Functor, init>
type;
139 template <
typename Functor>
140 class vtkSMPTools_Lookup_For<Functor const>
145 typedef vtkSMPTools_FunctorInternal<Functor const, init>
type;
166 template <
typename Functor>
170 fi.For(first, last, grain);
184 template <
typename Functor>
188 fi.For(first, last, grain);
201 template <
typename Functor>
216 template <
typename Functor>
247 template <
typename RandomAccessIterator>
248 static void Sort(RandomAccessIterator begin, RandomAccessIterator end)
250 vtk::detail::smp::vtkSMPTools_Impl_Sort(begin, end);
259 template <
typename RandomAccessIterator,
typename Compare>
260 static void Sort(RandomAccessIterator begin, RandomAccessIterator end, Compare comp)
262 vtk::detail::smp::vtkSMPTools_Impl_Sort(begin, end, comp);
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.