From 96501b0a18f4f70048403dccc4cb42dd71db8f9d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 3 Feb 2012 14:17:26 +0100 Subject: Move QtConcurrent into its own module Task-number: QTBUG-20892 Change-Id: I614500aafb6428915509983608bbb0ade4e4f016 Reviewed-by: Thiago Macieira --- src/concurrent/qtconcurrentrun.h | 347 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 347 insertions(+) create mode 100644 src/concurrent/qtconcurrentrun.h (limited to 'src/concurrent/qtconcurrentrun.h') diff --git a/src/concurrent/qtconcurrentrun.h b/src/concurrent/qtconcurrentrun.h new file mode 100644 index 00000000000..d7285388da6 --- /dev/null +++ b/src/concurrent/qtconcurrentrun.h @@ -0,0 +1,347 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Generated code, do not edit! Use generator at tools/qtconcurrent/generaterun/ +#ifndef QTCONCURRENT_RUN_H +#define QTCONCURRENT_RUN_H + +#include + +#ifndef QT_NO_CONCURRENT + +#include +#include + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + + +#ifdef qdoc + +namespace QtConcurrent { + + template + QFuture run(Function function, ...); + +} // namespace QtConcurrent + +#else + +namespace QtConcurrent { + +template +QFuture run(T (*functionPointer)()) +{ + return (new StoredFunctorCall0(functionPointer))->start(); +} +template +QFuture run(T (*functionPointer)(Param1), const Arg1 &arg1) +{ + return (new StoredFunctorCall1(functionPointer, arg1))->start(); +} +template +QFuture run(T (*functionPointer)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2) +{ + return (new StoredFunctorCall2(functionPointer, arg1, arg2))->start(); +} +template +QFuture run(T (*functionPointer)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new StoredFunctorCall3(functionPointer, arg1, arg2, arg3))->start(); +} +template +QFuture run(T (*functionPointer)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new StoredFunctorCall4(functionPointer, arg1, arg2, arg3, arg4))->start(); +} +template +QFuture run(T (*functionPointer)(Param1, Param2, Param3, Param4, Param5), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new StoredFunctorCall5(functionPointer, arg1, arg2, arg3, arg4, arg5))->start(); +} + +#ifdef Q_COMPILER_DECLTYPE + +template +auto run(Functor functor) -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor()) result_type; + return (new StoredFunctorCall0(functor))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1)) result_type; + return (new StoredFunctorCall1(functor, arg1))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1, arg2)) result_type; + return (new StoredFunctorCall2(functor, arg1, arg2))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1, arg2, arg3)) result_type; + return (new StoredFunctorCall3(functor, arg1, arg2, arg3))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1, arg2, arg3, arg4)) result_type; + return (new StoredFunctorCall4(functor, arg1, arg2, arg3, arg4))->start(); +} + +template +auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) + -> typename QtPrivate::QEnableIf::Value, QFuture >::Type +{ + typedef decltype(functor(arg1, arg2, arg3, arg4, arg5)) result_type; + return (new StoredFunctorCall5(functor, arg1, arg2, arg3, arg4, arg5))->start(); +} + +#endif + +template +QFuture run(FunctionObject functionObject) +{ + return (new StoredFunctorCall0(functionObject))->start(); +} +template +QFuture run(FunctionObject functionObject, const Arg1 &arg1) +{ + return (new StoredFunctorCall1(functionObject, arg1))->start(); +} +template +QFuture run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new StoredFunctorCall2(functionObject, arg1, arg2))->start(); +} +template +QFuture run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new StoredFunctorCall3(functionObject, arg1, arg2, arg3))->start(); +} +template +QFuture run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new StoredFunctorCall4(functionObject, arg1, arg2, arg3, arg4))->start(); +} +template +QFuture run(FunctionObject functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new StoredFunctorCall5(functionObject, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template +QFuture run(FunctionObject *functionObject) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall0::type(functionObject))->start(); +} +template +QFuture run(FunctionObject *functionObject, const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall1::type(functionObject, arg1))->start(); +} +template +QFuture run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall2::type(functionObject, arg1, arg2))->start(); +} +template +QFuture run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall3::type(functionObject, arg1, arg2, arg3))->start(); +} +template +QFuture run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall4::type(functionObject, arg1, arg2, arg3, arg4))->start(); +} +template +QFuture run(FunctionObject *functionObject, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) +{ + return (new QT_TYPENAME SelectStoredFunctorPointerCall5::type(functionObject, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template +QFuture run(const Class &object, T (Class::*fn)()) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall0::type(fn, object))->start(); +} +template +QFuture run(const Class &object, T (Class::*fn)(Param1), const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall1::type(fn, object, arg1))->start(); +} +template +QFuture run(const Class &object, T (Class::*fn)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall2::type(fn, object, arg1, arg2))->start(); +} +template +QFuture run(const Class &object, T (Class::*fn)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall3::type(fn, object, arg1, arg2, arg3))->start(); +} +template +QFuture run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall4::type(fn, object, arg1, arg2, arg3, arg4))->start(); +} +template +QFuture 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) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionCall5::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template +QFuture run(const Class &object, T (Class::*fn)() const) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall0::type(fn, object))->start(); +} +template +QFuture run(const Class &object, T (Class::*fn)(Param1) const, const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall1::type(fn, object, arg1))->start(); +} +template +QFuture run(const Class &object, T (Class::*fn)(Param1, Param2) const, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall2::type(fn, object, arg1, arg2))->start(); +} +template +QFuture run(const Class &object, T (Class::*fn)(Param1, Param2, Param3) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall3::type(fn, object, arg1, arg2, arg3))->start(); +} +template +QFuture run(const Class &object, T (Class::*fn)(Param1, Param2, Param3, Param4) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall4::type(fn, object, arg1, arg2, arg3, arg4))->start(); +} +template +QFuture 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) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionCall5::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template +QFuture run(Class *object, T (Class::*fn)()) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall0::type(fn, object))->start(); +} +template +QFuture run(Class *object, T (Class::*fn)(Param1), const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall1::type(fn, object, arg1))->start(); +} +template +QFuture run(Class *object, T (Class::*fn)(Param1, Param2), const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall2::type(fn, object, arg1, arg2))->start(); +} +template +QFuture run(Class *object, T (Class::*fn)(Param1, Param2, Param3), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall3::type(fn, object, arg1, arg2, arg3))->start(); +} +template +QFuture run(Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4), const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall4::type(fn, object, arg1, arg2, arg3, arg4))->start(); +} +template +QFuture 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) +{ + return (new QT_TYPENAME SelectStoredMemberFunctionPointerCall5::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} + +template +QFuture run(const Class *object, T (Class::*fn)() const) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall0::type(fn, object))->start(); +} +template +QFuture run(const Class *object, T (Class::*fn)(Param1) const, const Arg1 &arg1) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall1::type(fn, object, arg1))->start(); +} +template +QFuture run(const Class *object, T (Class::*fn)(Param1, Param2) const, const Arg1 &arg1, const Arg2 &arg2) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall2::type(fn, object, arg1, arg2))->start(); +} +template +QFuture run(const Class *object, T (Class::*fn)(Param1, Param2, Param3) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall3::type(fn, object, arg1, arg2, arg3))->start(); +} +template +QFuture run(const Class *object, T (Class::*fn)(Param1, Param2, Param3, Param4) const, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall4::type(fn, object, arg1, arg2, arg3, arg4))->start(); +} +template +QFuture 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) +{ + return (new QT_TYPENAME SelectStoredConstMemberFunctionPointerCall5::type(fn, object, arg1, arg2, arg3, arg4, arg5))->start(); +} + +} //namespace QtConcurrent + +#endif // qdoc + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QT_NO_CONCURRENT + +#endif -- cgit v1.2.3