- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions

# MappedReducedKernel< ReducedResultType, Iterator, MapFunctor, ReduceFunctor, Reducer > Class Template Reference

Search for all occurrences

## Detailed Description

### template<typename ReducedResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor, typename Reducer = ReduceKernel<ReduceFunctor, ReducedResultType, typename MapFunctor::result_type>>
class QtConcurrent::MappedReducedKernel< ReducedResultType, Iterator, MapFunctor, ReduceFunctor, Reducer >

Definition at line 97 of file qtconcurrentmapkernel.h.

`#include <qtconcurrentmapkernel.h>`

Inheritance diagram for MappedReducedKernel< ReducedResultType, Iterator, MapFunctor, ReduceFunctor, Reducer >:
[legend]

List of all members.

## Public Types
typedef ReducedResultType | ReturnType
typedef ReducedResultType | ResultType
## Public Member Functions
| MappedReducedKernel (Iterator begin, Iterator end, MapFunctor _map, ReduceFunctor _reduce, ReduceOptions reduceOptions)
| MappedReducedKernel (ReducedResultType initialValue, MapFunctor _map, ReduceFunctor _reduce)
bool | runIteration (Iterator it, int index, ReducedResultType *)
bool | runIterations (Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *)
void | finish ()
bool | shouldThrottleThread ()
bool | shouldStartThread ()
ReducedResultType * | result ()

## Member Typedef Documentation

typedef ReducedResultType ReturnType

Search for all occurrences

Definition at line 104 of file qtconcurrentmapkernel.h.

typedef ReducedResultType ResultType

Search for all occurrences

Reimplemented from IterateKernel< Iterator, ReducedResultType >.

Definition at line 159 of file qtconcurrentmapkernel.h.

## Constructor & Destructor Documentation

MappedReducedKernel | ( | Iterator | begin,
|  | Iterator | end,
|  | MapFunctor | _map,
|  | ReduceFunctor | _reduce,
|  | ReduceOptions | reduceOptions
| ) |  | `[inline]`

Definition at line 105 of file qtconcurrentmapkernel.h.

            : IterateKernel<Iterator, ReducedResultType>(begin, end), reducedResult(), map(_map), reduce(_reduce), reducer(reduceOptions)
        { }

MappedReducedKernel | ( | ReducedResultType | initialValue,
|  | MapFunctor | _map,
|  | ReduceFunctor | _reduce
| ) |  | `[inline]`

Definition at line 109 of file qtconcurrentmapkernel.h.

            : reducedResult(initialValue), map(_map), reduce(_reduce)
        { }

## Member Function Documentation

bool runIteration | ( | Iterator | it,
|  | int | index,
|  | ReducedResultType * |
| ) |  | `[inline, virtual]`

Search for all occurrences

Reimplemented from IterateKernel< Iterator, ReducedResultType >.

Definition at line 115 of file qtconcurrentmapkernel.h.

        {
            IntermediateResults<typename MapFunctor::result_type> results;
            results.begin = index;
            results.end = index + 1;

            results.vector.append(map(*it));
            reducer.runReduce(reduce, reducedResult, results);
            return false;
        }

bool runIterations | ( | Iterator | sequenceBeginIterator,
|  | int | begin,
|  | int | end,
|  | ReducedResultType * |
| ) |  | `[inline, virtual]`

Search for all occurrences

Reimplemented from IterateKernel< Iterator, ReducedResultType >.

Definition at line 126 of file qtconcurrentmapkernel.h.

        {
            IntermediateResults<typename MapFunctor::result_type> results;
            results.begin = begin;
            results.end = end;
            results.vector.reserve(end - begin);

            Iterator it = sequenceBeginIterator;
            advance(it, begin);
            for (int i = begin; i < end; ++i) {
                results.vector.append(map(*(it)));
                advance(it, 1);
            }

            reducer.runReduce(reduce, reducedResult, results);
            return false;
        }

void finish | ( |  | ) | `[inline, virtual]`

Search for all occurrences

Reimplemented from ThreadEngineBase.

Definition at line 144 of file qtconcurrentmapkernel.h.

        {
            reducer.finish(reduce, reducedResult);
        }

bool shouldThrottleThread | ( |  | ) | `[inline, virtual]`

Search for all occurrences

Reimplemented from ThreadEngineBase.

Definition at line 149 of file qtconcurrentmapkernel.h.

        {
            return IterateKernel<Iterator, ReducedResultType>::shouldThrottleThread() || reducer.shouldThrottle();
        }

bool shouldStartThread | ( |  | ) | `[inline, virtual]`

Search for all occurrences

Reimplemented from IterateKernel< Iterator, ReducedResultType >.

Definition at line 154 of file qtconcurrentmapkernel.h.

        {
            return IterateKernel<Iterator, ReducedResultType>::shouldStartThread() && reducer.shouldStartThread();
        }

ReducedResultType* result | ( |  | ) | `[inline, virtual]`

Search for all occurrences

Reimplemented from ThreadEngine< ReducedResultType >.

Definition at line 160 of file qtconcurrentmapkernel.h.

        {
            return &reducedResult;
        }

The documentation for this class was generated from the following file:

- QtCore/qtconcurrentmapkernel.h