42 #ifndef QTCONCURRENT_MAP_H 43 #define QTCONCURRENT_MAP_H 45 #include <QtCore/qglobal.h> 47 #ifndef QT_NO_CONCURRENT 49 #include <QtCore/qtconcurrentmapkernel.h> 50 #include <QtCore/qtconcurrentreducekernel.h> 51 #include <QtCore/qtconcurrentfunctionwrappers.h> 52 #include <QtCore/qstringlist.h> 74 ReduceFunction
function,
80 ReduceFunction
function,
83 void blockingMap(Sequence &sequence, MapFunction
function);
84 void blockingMap(Iterator begin, Iterator
end, MapFunction
function);
94 ReduceFunction
function,
100 ReduceFunction
function,
110 template <
typename Sequence,
typename MapFunctor>
113 return startMap(sequence.begin(), sequence.end(), QtPrivate::createFunctionWrapper(map));
117 template <
typename Iterator,
typename MapFunctor>
120 return startMap(begin, end, QtPrivate::createFunctionWrapper(map));
124 template <
typename ResultType,
typename Sequence,
typename MapFunctor,
typename ReduceFunctor>
127 ReduceFunctor reduce,
130 return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
132 QtPrivate::createFunctionWrapper(map),
133 QtPrivate::createFunctionWrapper(reduce),
137 template <
typename Sequence,
typename MapFunctor,
typename ReduceFunctor>
140 ReduceFunctor reduce,
143 return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType,
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
145 QtPrivate::createFunctionWrapper(map),
146 QtPrivate::createFunctionWrapper(reduce),
151 template <
typename ResultType,
typename Iterator,
typename MapFunctor,
typename ReduceFunctor>
155 ReduceFunctor reduce,
158 return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
160 QtPrivate::createFunctionWrapper(map),
161 QtPrivate::createFunctionWrapper(reduce),
165 template <
typename Iterator,
typename MapFunctor,
typename ReduceFunctor>
169 ReduceFunctor reduce,
172 return startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType,
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
174 QtPrivate::createFunctionWrapper(map),
175 QtPrivate::createFunctionWrapper(reduce),
180 template <
typename Sequence,
typename MapFunctor>
183 return startMapped<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType>(sequence, QtPrivate::createFunctionWrapper(map));
187 template <
typename Iterator,
typename MapFunctor>
190 return startMapped<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType>(begin,
end, QtPrivate::createFunctionWrapper(map));
194 template <
typename Sequence,
typename MapFunctor>
195 void blockingMap(Sequence &sequence, MapFunctor map)
197 startMap(sequence.begin(), sequence.end(), QtPrivate::createFunctionWrapper(map)).startBlocking();
201 template <
typename Iterator,
typename MapFunctor>
202 void blockingMap(Iterator begin, Iterator end, MapFunctor map)
204 startMap(begin, end, QtPrivate::createFunctionWrapper(map)).startBlocking();
208 template <
typename ResultType,
typename Sequence,
typename MapFunctor,
typename ReduceFunctor>
211 ReduceFunctor reduce,
214 return QtConcurrent::startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
216 QtPrivate::createFunctionWrapper(map),
217 QtPrivate::createFunctionWrapper(reduce),
222 template <
typename MapFunctor,
typename ReduceFunctor,
typename Sequence>
223 typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType
blockingMappedReduced(
const Sequence &sequence,
225 ReduceFunctor reduce,
228 return QtConcurrent::startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType,
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
230 QtPrivate::createFunctionWrapper(map),
231 QtPrivate::createFunctionWrapper(reduce),
237 template <
typename ResultType,
typename Iterator,
typename MapFunctor,
typename ReduceFunctor>
241 ReduceFunctor reduce,
244 return QtConcurrent::startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType, ResultType>
246 QtPrivate::createFunctionWrapper(map),
247 QtPrivate::createFunctionWrapper(reduce),
252 template <
typename Iterator,
typename MapFunctor,
typename ReduceFunctor>
253 typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType
blockingMappedReduced(Iterator begin,
256 ReduceFunctor reduce,
259 return QtConcurrent::startMappedReduced<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType,
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType>
261 QtPrivate::createFunctionWrapper(map),
262 QtPrivate::createFunctionWrapper(reduce),
268 template <
typename OutputSequence,
typename InputSequence,
typename MapFunctor>
269 OutputSequence
blockingMapped(
const InputSequence &sequence, MapFunctor map)
271 return blockingMappedReduced<OutputSequence>
273 QtPrivate::createFunctionWrapper(map),
274 QtPrivate::PushBackWrapper(),
278 template <
typename MapFunctor,
typename InputSequence>
279 typename QtPrivate::MapResultType<InputSequence, MapFunctor>::ResultType
blockingMapped(
const InputSequence &sequence, MapFunctor map)
281 typedef typename QtPrivate::MapResultType<InputSequence, MapFunctor>::ResultType OutputSequence;
282 return blockingMappedReduced<OutputSequence>
284 QtPrivate::createFunctionWrapper(map),
285 QtPrivate::PushBackWrapper(),
290 template <
typename Sequence,
typename Iterator,
typename MapFunctor>
291 Sequence
blockingMapped(Iterator begin, Iterator end, MapFunctor map)
293 return blockingMappedReduced<Sequence>
295 QtPrivate::createFunctionWrapper(map),
296 QtPrivate::PushBackWrapper(),
300 template <
typename Iterator,
typename MapFunctor>
301 typename QtPrivate::MapResultType<Iterator, MapFunctor>::ResultType
blockingMapped(Iterator begin, Iterator end, MapFunctor map)
303 typedef typename QtPrivate::MapResultType<Iterator, MapFunctor>::ResultType OutputSequence;
304 return blockingMappedReduced<OutputSequence>
306 QtPrivate::createFunctionWrapper(map),
307 QtPrivate::PushBackWrapper(),
318 #endif // QT_NO_CONCURRENT #define QT_END_NAMESPACE
This macro expands to.
T blockingMapped(const Sequence &sequence, MapFunction function)
Calls function once for each item in sequence and returns a Sequence containing the results...
QFuture< T > mapped(const Sequence &sequence, MapFunction function)
QFuture< void > map(Sequence &sequence, MapFunction function)
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QFuture class represents the result of an asynchronous computation.
void blockingMap(Sequence &sequence, MapFunction function)
Calls function once for each item in sequence.
The QtConcurrent namespace provides high-level APIs that make it possible to write multi-threaded pro...
static const KeyPair *const end
T blockingMappedReduced(const Sequence &sequence, MapFunction function, ReduceFunction function, QtConcurrent::ReduceOptions options=UnorderedReduce|SequentialReduce)
QFuture< T > mappedReduced(const Sequence &sequence, MapFunction function, ReduceFunction function, QtConcurrent::ReduceOptions options=UnorderedReduce|SequentialReduce)