diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp index d4e4656127..c0cbbd3f3d 100644 --- a/src/concurrent/qtconcurrentfilter.cpp +++ b/src/concurrent/qtconcurrentfilter.cpp @@ -175,7 +175,49 @@ */ /*! - \fn QFuture QtConcurrent::filter(Sequence &sequence, FilterFunction filterFunction) + \class QtConcurrent::qValueType + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::qValueType + \inmodule QtConcurrent + \internal +*/ + + +/*! + \class QtConcurrent::qValueType + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::FilterKernel + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::FilteredReducedKernel + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::FilteredEachKernel + \inmodule QtConcurrent + \internal +*/ + +/*! + \fn [QtConcurrent-1] template ThreadEngineStarter QtConcurrent::filterInternal(Sequence &sequence, KeepFunctor keep, ReduceFunctor reduce) + \internal +*/ + +/*! + \fn template QFuture QtConcurrent::filter(Sequence &sequence, KeepFunctor filterFunction) Calls \a filterFunction once for each item in \a sequence. If \a filterFunction returns \c true, the item is kept in \a sequence; @@ -185,7 +227,7 @@ */ /*! - \fn QFuture QtConcurrent::filtered(const Sequence &sequence, FilterFunction filterFunction) + \fn template QFuture QtConcurrent::filtered(const Sequence &sequence, KeepFunctor filterFunction) Calls \a filterFunction once for each item in \a sequence and returns a new Sequence of kept items. If \a filterFunction returns \c true, a copy of @@ -196,7 +238,7 @@ */ /*! - \fn QFuture QtConcurrent::filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction) + \fn template QFuture::value_type> QtConcurrent::filtered(Iterator begin, Iterator end, KeepFunctor filterFunction) Calls \a filterFunction once for each item from \a begin to \a end and returns a new Sequence of kept items. If \a filterFunction returns \c true, a @@ -207,7 +249,7 @@ */ /*! - \fn QFuture QtConcurrent::filteredReduced(const Sequence &sequence, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) + \fn template QFuture QtConcurrent::filteredReduced(const Sequence &sequence, KeepFunctor filterFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions) Calls \a filterFunction once for each item in \a sequence. If \a filterFunction returns \c true for an item, that item is then passed to @@ -225,7 +267,7 @@ */ /*! - \fn QFuture QtConcurrent::filteredReduced(ConstIterator begin, ConstIterator end, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) + \fn template QFuture QtConcurrent::filteredReduced(Iterator begin, Iterator end, KeepFunctor filterFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions) Calls \a filterFunction once for each item from \a begin to \a end. If \a filterFunction returns \c true for an item, that item is then passed to @@ -243,7 +285,7 @@ */ /*! - \fn void QtConcurrent::blockingFilter(Sequence &sequence, FilterFunction filterFunction) + \fn template void QtConcurrent::blockingFilter(Sequence &sequence, KeepFunctor filterFunction) Calls \a filterFunction once for each item in \a sequence. If \a filterFunction returns \c true, the item is kept in \a sequence; @@ -255,7 +297,7 @@ */ /*! - \fn Sequence QtConcurrent::blockingFiltered(const Sequence &sequence, FilterFunction filterFunction) + \fn template Sequence QtConcurrent::blockingFiltered(const Sequence &sequence, KeepFunctor filterFunction) Calls \a filterFunction once for each item in \a sequence and returns a new Sequence of kept items. If \a filterFunction returns \c true, a copy of @@ -268,7 +310,7 @@ */ /*! - \fn Sequence QtConcurrent::blockingFiltered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction) + \fn template OutputSequence QtConcurrent::blockingFiltered(Iterator begin, Iterator end, KeepFunctor filterFunction) Calls \a filterFunction once for each item from \a begin to \a end and returns a new Sequence of kept items. If \a filterFunction returns \c true, a @@ -282,7 +324,7 @@ */ /*! - \fn T QtConcurrent::blockingFilteredReduced(const Sequence &sequence, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) + \fn template ResultType QtConcurrent::blockingFilteredReduced(const Sequence &sequence, KeepFunctor filterFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions) Calls \a filterFunction once for each item in \a sequence. If \a filterFunction returns \c true for an item, that item is then passed to @@ -302,7 +344,7 @@ */ /*! - \fn T QtConcurrent::blockingFilteredReduced(ConstIterator begin, ConstIterator end, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) + \fn template ResultType QtConcurrent::blockingFilteredReduced(Iterator begin, Iterator end, KeepFunctor filterFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions) Calls \a filterFunction once for each item from \a begin to \a end. If \a filterFunction returns \c true for an item, that item is then passed to @@ -321,3 +363,24 @@ \sa filteredReduced(), {Concurrent Filter and Filter-Reduce} */ + +/*! + \fn [QtConcurrent-2] ThreadEngineStarter::value_type> QtConcurrent::startFiltered(Iterator begin, Iterator end, KeepFunctor functor) + \internal +*/ + +/*! + \fn [QtConcurrent-3] ThreadEngineStarter QtConcurrent::startFiltered(const Sequence &sequence, KeepFunctor functor) + \internal +*/ + +/*! + \fn [QtConcurrent-4] ThreadEngineStarter QtConcurrent::startFilteredReduced(const Sequence & sequence, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, ReduceOptions options) + \internal +*/ + +/*! + \fn [QtConcurrent-5] ThreadEngineStarter QtConcurrent::startFilteredReduced(Iterator begin, Iterator end, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, ReduceOptions options) + \internal +*/ + diff --git a/src/concurrent/qtconcurrentfilter.h b/src/concurrent/qtconcurrentfilter.h index e09f3b4abc..5f4148091e 100644 --- a/src/concurrent/qtconcurrentfilter.h +++ b/src/concurrent/qtconcurrentfilter.h @@ -98,6 +98,7 @@ namespace QtConcurrent { namespace QtConcurrent { +//! [QtConcurrent-1] template ThreadEngineStarter filterInternal(Sequence &sequence, KeepFunctor keep, ReduceFunctor reduce) { diff --git a/src/concurrent/qtconcurrentfilterkernel.h b/src/concurrent/qtconcurrentfilterkernel.h index bd474fc0c9..4500bd4f8a 100644 --- a/src/concurrent/qtconcurrentfilterkernel.h +++ b/src/concurrent/qtconcurrentfilterkernel.h @@ -292,6 +292,7 @@ public: } }; +//! [QtConcurrent-2] template inline ThreadEngineStarter::value_type> @@ -300,6 +301,7 @@ startFiltered(Iterator begin, Iterator end, KeepFunctor functor) return startThreadEngine(new FilteredEachKernel(begin, end, functor)); } +//! [QtConcurrent-3] template inline ThreadEngineStarter startFiltered(const Sequence &sequence, KeepFunctor functor) @@ -311,6 +313,7 @@ startFiltered(const Sequence &sequence, KeepFunctor functor) return startThreadEngine(new SequenceHolderType(sequence, functor)); } +//! [QtConcurrent-4] template inline ThreadEngineStarter startFilteredReduced(const Sequence & sequence, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, @@ -324,6 +327,7 @@ inline ThreadEngineStarter startFilteredReduced(const Sequence & seq } +//! [QtConcurrent-5] template inline ThreadEngineStarter startFilteredReduced(Iterator begin, Iterator end, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index 1ba5de355b..9c01b65611 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -52,6 +52,72 @@ \ingroup thread */ +/*! + \enum QtConcurrent::ReduceQueueLimits + \internal + */ + +/*! + \class QtConcurrent::ReduceKernel + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::SequenceHolder2 + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::MapKernel + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::MappedReducedKernel + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::MappedEachKernel + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::SequenceHolder1 + \inmodule QtConcurrent + \internal +*/ + +/*! + \fn [qtconcurrentmapkernel-1] ThreadEngineStarter QtConcurrent::startMap(Iterator begin, Iterator end, Functor functor) + \internal +*/ + +/*! + \fn [qtconcurrentmapkernel-2] ThreadEngineStarter QtConcurrent::startMapped(Iterator begin, Iterator end, Functor functor) + \internal +*/ + +/*! + \fn [qtconcurrentmapkernel-3] ThreadEngineStarter QtConcurrent::startMapped(const Sequence &sequence, Functor functor) + \internal +*/ + +/*! + \fn [qtconcurrentmapkernel-4] ThreadEngineStarter QtConcurrent::startMappedReduced(const Sequence & sequence, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, ReduceOptions options) + \internal +*/ + +/*! + \fn [qtconcurrentmapkernel-5] ThreadEngineStarter QtConcurrent::startMappedReduced(Iterator begin, Iterator end, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, ReduceOptions options) + \internal +*/ + /*! \enum QtConcurrent::ReduceOption This enum specifies the order of which results from the map or filter @@ -225,7 +291,7 @@ */ /*! - \fn QFuture QtConcurrent::map(Sequence &sequence, MapFunction function) + \fn template QFuture QtConcurrent::map(Sequence &sequence, MapFunctor function) Calls \a function once for each item in \a sequence. The \a function is passed a reference to the item, so that any modifications done to the item @@ -235,7 +301,7 @@ */ /*! - \fn QFuture QtConcurrent::map(Iterator begin, Iterator end, MapFunction function) + \fn template QFuture QtConcurrent::map(Iterator begin, Iterator end, MapFunctor function) Calls \a function once for each item from \a begin to \a end. The \a function is passed a reference to the item, so that any modifications @@ -245,7 +311,7 @@ */ /*! - \fn QFuture QtConcurrent::mapped(const Sequence &sequence, MapFunction function) + \fn template QFuture::ResultType> QtConcurrent::mapped(const Sequence &sequence, MapFunctor function) Calls \a function once for each item in \a sequence and returns a future with each mapped item as a result. You can use QFuture::const_iterator or @@ -255,7 +321,7 @@ */ /*! - \fn QFuture QtConcurrent::mapped(ConstIterator begin, ConstIterator end, MapFunction function) + \fn template QFuture::ResultType> QtConcurrent::mapped(Iterator begin, Iterator end, MapFunctor function) Calls \a function once for each item from \a begin to \a end and returns a future with each mapped item as a result. You can use @@ -265,9 +331,7 @@ */ /*! - \fn QFuture QtConcurrent::mappedReduced(const Sequence &sequence, - MapFunction mapFunction, ReduceFunction reduceFunction, - QtConcurrent::ReduceOptions reduceOptions) + \fn template QFuture QtConcurrent::mappedReduced(const Sequence &sequence, MapFunctor mapFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions) Calls \a mapFunction once for each item in \a sequence. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -280,9 +344,7 @@ */ /*! - \fn QFuture QtConcurrent::mappedReduced(ConstIterator begin, - ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, - QtConcurrent::ReduceOptions reduceOptions) + \fn template QFuture QtConcurrent::mappedReduced(Iterator begin, Iterator end, MapFunctor mapFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions) Calls \a mapFunction once for each item from \a begin to \a end. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -297,7 +359,7 @@ */ /*! - \fn void QtConcurrent::blockingMap(Sequence &sequence, MapFunction function) + \fn template void QtConcurrent::blockingMap(Sequence &sequence, MapFunctor function) Calls \a function once for each item in \a sequence. The \a function is passed a reference to the item, so that any modifications done to the item @@ -309,7 +371,7 @@ */ /*! - \fn void QtConcurrent::blockingMap(Iterator begin, Iterator end, MapFunction function) + \fn template void QtConcurrent::blockingMap(Iterator begin, Iterator end, MapFunctor function) Calls \a function once for each item from \a begin to \a end. The \a function is passed a reference to the item, so that any modifications @@ -322,7 +384,7 @@ */ /*! - \fn T QtConcurrent::blockingMapped(const Sequence &sequence, MapFunction function) + \fn template OutputSequence QtConcurrent::blockingMapped(const InputSequence &sequence, MapFunctor function) Calls \a function once for each item in \a sequence and returns a Sequence containing the results. The type of the results will match the type returned my the MapFunction. @@ -333,7 +395,7 @@ */ /*! - \fn T QtConcurrent::blockingMapped(ConstIterator begin, ConstIterator end, MapFunction function) + \fn template Sequence QtConcurrent::blockingMapped(Iterator begin, Iterator end, MapFunctor function) Calls \a function once for each item from \a begin to \a end and returns a container with the results. Specify the type of container as the a template @@ -350,7 +412,7 @@ */ /*! - \fn T QtConcurrent::blockingMappedReduced(const Sequence &sequence, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) + \fn template ResultType QtConcurrent::blockingMappedReduced(const Sequence &sequence, MapFunctor mapFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions) Calls \a mapFunction once for each item in \a sequence. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -365,7 +427,7 @@ */ /*! - \fn T QtConcurrent::blockingMappedReduced(ConstIterator begin, ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) + \fn template ResultType QtConcurrent::blockingMappedReduced(Iterator begin, Iterator end, MapFunctor mapFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions) Calls \a mapFunction once for each item from \a begin to \a end. The return value of each \a mapFunction is passed to \a reduceFunction. diff --git a/src/concurrent/qtconcurrentmapkernel.h b/src/concurrent/qtconcurrentmapkernel.h index fa162f7c34..26e755c819 100644 --- a/src/concurrent/qtconcurrentmapkernel.h +++ b/src/concurrent/qtconcurrentmapkernel.h @@ -191,12 +191,14 @@ public: } }; +//! [qtconcurrentmapkernel-1] template inline ThreadEngineStarter startMap(Iterator begin, Iterator end, Functor functor) { return startThreadEngine(new MapKernel(begin, end, functor)); } +//! [qtconcurrentmapkernel-2] template inline ThreadEngineStarter startMapped(Iterator begin, Iterator end, Functor functor) { @@ -225,6 +227,7 @@ struct SequenceHolder1 : public Base } }; +//! [qtconcurrentmapkernel-3] template inline ThreadEngineStarter startMapped(const Sequence &sequence, Functor functor) { @@ -235,6 +238,7 @@ inline ThreadEngineStarter startMapped(const Sequence &sequence, Functor func return startThreadEngine(new SequenceHolderType(sequence, functor)); } +//! [qtconcurrentmapkernel-4] template inline ThreadEngineStarter startMappedReduced(const Sequence & sequence, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, @@ -247,6 +251,7 @@ inline ThreadEngineStarter startMappedReduced(const Sequence & seque return startThreadEngine(new SequenceHolderType(sequence, mapFunctor, reduceFunctor, options)); } +//! [qtconcurrentmapkernel-5] template inline ThreadEngineStarter startMappedReduced(Iterator begin, Iterator end, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp index c7791f8571..2e27e0e83c 100644 --- a/src/concurrent/qtconcurrentthreadengine.cpp +++ b/src/concurrent/qtconcurrentthreadengine.cpp @@ -45,6 +45,46 @@ QT_BEGIN_NAMESPACE namespace QtConcurrent { +/*! + \class QtConcurrent::ThreadEngineBarrier + \inmodule QtConcurrent + \internal +*/ + +/*! + \enum QtConcurrent::ThreadFunctionResult + \internal +*/ + +/*! + \class QtConcurrent::ThreadEngineBase + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::ThreadEngine + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::ThreadEngineStarterBase + \inmodule QtConcurrent + \internal +*/ + +/*! + \class QtConcurrent::ThreadEngineStarter + \inmodule QtConcurrent + \internal +*/ + +/*! + \fn [qtconcurrentthreadengine-1] template ThreadEngineStarter QtConcurrent::startThreadEngine(ThreadEngine *threadEngine) + \internal +*/ + ThreadEngineBarrier::ThreadEngineBarrier() :count(0) { } diff --git a/src/concurrent/qtconcurrentthreadengine.h b/src/concurrent/qtconcurrentthreadengine.h index 450e7b8d50..0941f559f2 100644 --- a/src/concurrent/qtconcurrentthreadengine.h +++ b/src/concurrent/qtconcurrentthreadengine.h @@ -259,6 +259,7 @@ public: } }; +//! [qtconcurrentthreadengine-1] template inline ThreadEngineStarter startThreadEngine(ThreadEngine *threadEngine) {