43 #ifndef QTCONCURRENT_RUN_H
44 #define QTCONCURRENT_RUN_H
48 #ifndef QT_NO_CONCURRENT
76 template <
typename T,
typename Param1,
typename Arg1>
79 return (
new StoredFunctorCall1<T, T (*)(Param1), Arg1>(functionPointer, arg1))->start();
81 template <
typename T,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2>
84 return (
new StoredFunctorCall2<T, T (*)(Param1, Param2), Arg1, Arg2>(functionPointer, arg1, arg2))->start();
86 template <
typename T,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3>
89 return (
new StoredFunctorCall3<T, T (*)(Param1, Param2, Param3), Arg1, Arg2, Arg3>(functionPointer, arg1, arg2, arg3))->start();
91 template <
typename T,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4>
92 QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4),
const Arg1 &
arg1,
const Arg2 &
arg2,
const Arg3 &
arg3,
const Arg4 &arg4)
94 return (
new StoredFunctorCall4<T, T (*)(Param1, Param2, Param3, Param4), Arg1, Arg2, Arg3, Arg4>(functionPointer, arg1, arg2, arg3, arg4))->start();
96 template <
typename T,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4,
typename Param5,
typename Arg5>
97 QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4, Param5),
const Arg1 &
arg1,
const Arg2 &
arg2,
const Arg3 &
arg3,
const Arg4 &arg4,
const Arg5 &arg5)
99 return (
new StoredFunctorCall5<T, T (*)(Param1, Param2, Param3, Param4, Param5), Arg1, Arg2, Arg3, Arg4, Arg5>(functionPointer, arg1, arg2, arg3, arg4, arg5))->start();
102 #if defined(Q_COMPILER_DECLTYPE) && defined(Q_COMPILER_AUTO_FUNCTION)
104 template <
typename Functor>
107 typedef decltype(functor()) result_type;
108 return (new StoredFunctorCall0<result_type, Functor>(functor))->
start();
111 template <typename Functor, typename Arg1>
112 auto
run(Functor functor, const Arg1 &
arg1)
115 typedef decltype(functor(
arg1)) result_type;
116 return (new StoredFunctorCall1<result_type, Functor, Arg1>(functor,
arg1))->start();
119 template <typename Functor, typename Arg1, typename Arg2>
120 auto
run(Functor functor, const Arg1 &
arg1, const Arg2 &
arg2)
123 typedef decltype(functor(arg1,
arg2)) result_type;
124 return (new StoredFunctorCall2<result_type, Functor, Arg1, Arg2>(functor, arg1,
arg2))->start();
127 template <typename Functor, typename Arg1, typename Arg2, typename Arg3>
128 auto
run(Functor functor, const Arg1 &arg1, const Arg2 &
arg2, const Arg3 &
arg3)
131 typedef decltype(functor(arg1, arg2,
arg3)) result_type;
132 return (new StoredFunctorCall3<result_type, Functor, Arg1, Arg2, Arg3>(functor, arg1, arg2,
arg3))->start();
135 template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
136 auto
run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &
arg3, const Arg4 &arg4)
137 -> typename
QtPrivate::QEnableIf<!
QtPrivate::HasResultType<Functor>::Value,
QFuture<decltype(functor(arg1, arg2, arg3, arg4))> >::Type
139 typedef decltype(functor(arg1, arg2, arg3, arg4)) result_type;
140 return (new StoredFunctorCall4<result_type, Functor, Arg1, Arg2, Arg3, Arg4>(functor, arg1, arg2, arg3, arg4))->start();
143 template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
144 auto
run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
145 -> typename
QtPrivate::QEnableIf<!
QtPrivate::HasResultType<Functor>::Value,
QFuture<decltype(functor(arg1, arg2, arg3, arg4, arg5))> >::Type
147 typedef decltype(functor(arg1, arg2, arg3, arg4, arg5)) result_type;
148 return (new StoredFunctorCall5<result_type, Functor, Arg1, Arg2, Arg3, Arg4, Arg5>(functor, arg1, arg2, arg3, arg4, arg5))->start();
153 template <
typename FunctionObject>
158 template <
typename FunctionObject,
typename Arg1>
163 template <
typename FunctionObject,
typename Arg1,
typename Arg2>
168 template <
typename FunctionObject,
typename Arg1,
typename Arg2,
typename Arg3>
173 template <
typename FunctionObject,
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
178 template <
typename FunctionObject,
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4,
typename Arg5>
181 return (
new StoredFunctorCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
184 template <
typename FunctionObject>
189 template <
typename FunctionObject,
typename Arg1>
194 template <
typename FunctionObject,
typename Arg1,
typename Arg2>
199 template <
typename FunctionObject,
typename Arg1,
typename Arg2,
typename Arg3>
204 template <
typename FunctionObject,
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
209 template <
typename FunctionObject,
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4,
typename Arg5>
212 return (
new QT_TYPENAME SelectStoredFunctorPointerCall5<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4, Arg5>::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start();
215 template <
typename T,
typename Class>
220 template <
typename T,
typename Class,
typename Param1,
typename Arg1>
221 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1),
const Arg1 &arg1)
225 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2>
226 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1, Param2),
const Arg1 &arg1,
const Arg2 &arg2)
230 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3>
231 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1, Param2, Param3),
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3)
233 return (
new QT_TYPENAME SelectStoredMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn,
object, arg1, arg2, arg3))->start();
235 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4>
236 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1, Param2, Param3, Param4),
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3,
const Arg4 &arg4)
238 return (
new QT_TYPENAME SelectStoredMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn,
object, arg1, arg2, arg3, arg4))->start();
240 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4,
typename Param5,
typename Arg5>
241 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5),
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3,
const Arg4 &arg4,
const Arg5 &arg5)
243 return (
new QT_TYPENAME SelectStoredMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn,
object, arg1, arg2, arg3, arg4, arg5))->start();
246 template <
typename T,
typename Class>
251 template <
typename T,
typename Class,
typename Param1,
typename Arg1>
252 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1)
const,
const Arg1 &arg1)
256 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2>
257 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1, Param2)
const,
const Arg1 &arg1,
const Arg2 &arg2)
261 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3>
262 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1, Param2, Param3)
const,
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3)
264 return (
new QT_TYPENAME SelectStoredConstMemberFunctionCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn,
object, arg1, arg2, arg3))->start();
266 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4>
267 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1, Param2, Param3, Param4)
const,
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3,
const Arg4 &arg4)
269 return (
new QT_TYPENAME SelectStoredConstMemberFunctionCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn,
object, arg1, arg2, arg3, arg4))->start();
271 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4,
typename Param5,
typename Arg5>
272 QFuture<T> run(
const Class &
object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)
const,
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3,
const Arg4 &arg4,
const Arg5 &arg5)
274 return (
new QT_TYPENAME SelectStoredConstMemberFunctionCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn,
object, arg1, arg2, arg3, arg4, arg5))->start();
277 template <
typename T,
typename Class>
282 template <
typename T,
typename Class,
typename Param1,
typename Arg1>
287 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2>
288 QFuture<T> run(Class *
object, T (Class::*fn)(Param1, Param2),
const Arg1 &arg1,
const Arg2 &arg2)
292 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3>
293 QFuture<T> run(Class *
object, T (Class::*fn)(Param1, Param2, Param3),
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3)
295 return (
new QT_TYPENAME SelectStoredMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn,
object, arg1, arg2, arg3))->start();
297 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4>
298 QFuture<T> run(Class *
object, T (Class::*fn)(Param1, Param2, Param3, Param4),
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3,
const Arg4 &arg4)
300 return (
new QT_TYPENAME SelectStoredMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn,
object, arg1, arg2, arg3, arg4))->start();
302 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4,
typename Param5,
typename Arg5>
303 QFuture<T> run(Class *
object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5),
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3,
const Arg4 &arg4,
const Arg5 &arg5)
305 return (
new QT_TYPENAME SelectStoredMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn,
object, arg1, arg2, arg3, arg4, arg5))->start();
308 template <
typename T,
typename Class>
313 template <
typename T,
typename Class,
typename Param1,
typename Arg1>
314 QFuture<T> run(
const Class *
object, T (Class::*fn)(Param1)
const,
const Arg1 &arg1)
318 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2>
319 QFuture<T> run(
const Class *
object, T (Class::*fn)(Param1, Param2)
const,
const Arg1 &arg1,
const Arg2 &arg2)
323 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3>
324 QFuture<T> run(
const Class *
object, T (Class::*fn)(Param1, Param2, Param3)
const,
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3)
326 return (
new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall3<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3>::type(fn,
object, arg1, arg2, arg3))->start();
328 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4>
329 QFuture<T> run(
const Class *
object, T (Class::*fn)(Param1, Param2, Param3, Param4)
const,
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3,
const Arg4 &arg4)
331 return (
new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall4<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4>::type(fn,
object, arg1, arg2, arg3, arg4))->start();
333 template <
typename T,
typename Class,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2,
typename Param3,
typename Arg3,
typename Param4,
typename Arg4,
typename Param5,
typename Arg5>
334 QFuture<T> run(
const Class *
object, T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)
const,
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &arg3,
const Arg4 &arg4,
const Arg5 &arg5)
336 return (
new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall5<T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5>::type(fn,
object, arg1, arg2, arg3, arg4, arg5))->start();
346 #endif // QT_NO_CONCURRENT
GLuint GLuint GLsizei GLenum type
SelectSpecialization< T >::template Type< StoredConstMemberFunctionPointerCall4< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4 >, VoidStoredConstMemberFunctionPointerCall4< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4 > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionCall4< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4 >, VoidStoredMemberFunctionCall4< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4 > >::type type
SelectSpecialization< T >::template Type< StoredConstMemberFunctionPointerCall5< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5 >, VoidStoredConstMemberFunctionPointerCall5< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5 > >::type type
SelectSpecialization< T >::template Type< StoredFunctorPointerCall1< T, FunctionPointer, Arg1 >, VoidStoredFunctorPointerCall1< T, FunctionPointer, Arg1 > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionPointerCall2< T, Class, Param1, Arg1, Param2, Arg2 >, VoidStoredMemberFunctionPointerCall2< T, Class, Param1, Arg1, Param2, Arg2 > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionCall5< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5 >, VoidStoredMemberFunctionCall5< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5 > >::type type
SelectSpecialization< T >::template Type< StoredConstMemberFunctionPointerCall1< T, Class, Param1, Arg1 >, VoidStoredConstMemberFunctionPointerCall1< T, Class, Param1, Arg1 > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionPointerCall3< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3 >, VoidStoredMemberFunctionPointerCall3< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3 > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionCall0< T, Class >, VoidStoredMemberFunctionCall0< T, Class > >::type type
SelectSpecialization< T >::template Type< StoredFunctorPointerCall2< T, FunctionPointer, Arg1, Arg2 >, VoidStoredFunctorPointerCall2< T, FunctionPointer, Arg1, Arg2 > >::type type
SelectSpecialization< T >::template Type< StoredFunctorPointerCall0< T, FunctionPointer >, VoidStoredFunctorPointerCall0< T, FunctionPointer > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionPointerCall1< T, Class, Param1, Arg1 >, VoidStoredMemberFunctionPointerCall1< T, Class, Param1, Arg1 > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionPointerCall0< T, Class >, VoidStoredMemberFunctionPointerCall0< T, Class > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionCall3< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3 >, VoidStoredMemberFunctionCall3< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3 > >::type type
#define QT_BEGIN_NAMESPACE
GLuint GLuint GLuint GLuint arg1
SelectSpecialization< T >::template Type< StoredConstMemberFunctionPointerCall2< T, Class, Param1, Arg1, Param2, Arg2 >, VoidStoredConstMemberFunctionPointerCall2< T, Class, Param1, Arg1, Param2, Arg2 > >::type type
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3
SelectSpecialization< T >::template Type< StoredMemberFunctionCall2< T, Class, Param1, Arg1, Param2, Arg2 >, VoidStoredMemberFunctionCall2< T, Class, Param1, Arg1, Param2, Arg2 > >::type type
SelectSpecialization< T >::template Type< StoredFunctorPointerCall3< T, FunctionPointer, Arg1, Arg2, Arg3 >, VoidStoredFunctorPointerCall3< T, FunctionPointer, Arg1, Arg2, Arg3 > >::type type
SelectSpecialization< T >::template Type< StoredConstMemberFunctionPointerCall3< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3 >, VoidStoredConstMemberFunctionPointerCall3< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3 > >::type type
SelectSpecialization< T >::template Type< StoredFunctorPointerCall5< T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5 >, VoidStoredFunctorPointerCall5< T, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5 > >::type type
SelectSpecialization< T >::template Type< StoredConstMemberFunctionPointerCall0< T, Class >, VoidStoredConstMemberFunctionPointerCall0< T, Class > >::type type
SelectSpecialization< T >::template Type< StoredFunctorPointerCall4< T, FunctionPointer, Arg1, Arg2, Arg3, Arg4 >, VoidStoredFunctorPointerCall4< T, FunctionPointer, Arg1, Arg2, Arg3, Arg4 > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionPointerCall4< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4 >, VoidStoredMemberFunctionPointerCall4< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4 > >::type type
QFuture< T > run(T(*functionPointer)())
SelectSpecialization< T >::template Type< StoredMemberFunctionCall1< T, Class, Param1, Arg1 >, VoidStoredMemberFunctionCall1< T, Class, Param1, Arg1 > >::type type
SelectSpecialization< T >::template Type< StoredMemberFunctionPointerCall5< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5 >, VoidStoredMemberFunctionPointerCall5< T, Class, Param1, Arg1, Param2, Arg2, Param3, Arg3, Param4, Arg4, Param5, Arg5 > >::type type
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2