43 #ifndef QTCONCURRENT_RUN_H 44 #define QTCONCURRENT_RUN_H 46 #include <QtCore/qglobal.h> 48 #ifndef QT_NO_CONCURRENT 50 #include <QtCore/qtconcurrentrunbase.h> 51 #include <QtCore/qtconcurrentstoredfunctioncall.h> 74 return (
new StoredFunctorCall0<T, T (*)()>(functionPointer))->start();
76 template <
typename T,
typename Param1,
typename Arg1>
77 QFuture<T> run(T (*functionPointer)(Param1),
const Arg1 &arg1)
79 return (
new StoredFunctorCall1<T, T (*)(Param1), Arg1>(functionPointer, arg1))->start();
81 template <
typename T,
typename Param1,
typename Arg1,
typename Param2,
typename Arg2>
82 QFuture<T> run(T (*functionPointer)(Param1, Param2),
const Arg1 &arg1,
const Arg2 &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>
87 QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3),
const Arg1 &arg1,
const Arg2 &arg2,
const Arg3 &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>
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)
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)
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>
156 return (
new StoredFunctorCall0<QT_TYPENAME FunctionObject::result_type, FunctionObject>(functionObject))->start();
158 template <
typename FunctionObject,
typename Arg1>
161 return (
new StoredFunctorCall1<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1>(functionObject, arg1))->start();
163 template <
typename FunctionObject,
typename Arg1,
typename Arg2>
166 return (
new StoredFunctorCall2<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2>(functionObject, arg1, arg2))->start();
168 template <
typename FunctionObject,
typename Arg1,
typename Arg2,
typename Arg3>
171 return (
new StoredFunctorCall3<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3>(functionObject, arg1, arg2, arg3))->start();
173 template <
typename FunctionObject,
typename Arg1,
typename Arg2,
typename Arg3,
typename Arg4>
176 return (
new StoredFunctorCall4<QT_TYPENAME FunctionObject::result_type, FunctionObject, Arg1, Arg2, Arg3, Arg4>(functionObject, arg1, arg2, arg3, arg4))->start();
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>
283 QFuture<T> run(Class *
object, T (Class::*fn)(Param1),
const Arg1 &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
#define QT_END_NAMESPACE
This macro expands to.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QFuture class represents the result of an asynchronous computation.
The QtConcurrent namespace provides high-level APIs that make it possible to write multi-threaded pro...
QFuture< T > run(Function function,...)
static Bool functor(Display *display, XEvent *event, XPointer arg)
return(isPopup||isToolTip)