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

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions

# FilterKernel< Sequence, KeepFunctor, ReduceFunctor > Class Template Reference

Search for all occurrences

## Detailed Description

### template<typename Sequence, typename KeepFunctor, typename ReduceFunctor>
class QtConcurrent::FilterKernel< Sequence, KeepFunctor, ReduceFunctor >

Definition at line 82 of file qtconcurrentfilterkernel.h.

`#include <qtconcurrentfilterkernel.h>`

Inheritance diagram for FilterKernel< Sequence, KeepFunctor, ReduceFunctor >:
[legend]

List of all members.

## Public Types
typedef void | ReturnType
typedef void | ResultType
## Public Member Functions
| FilterKernel (Sequence &_sequence, KeepFunctor _keep, ReduceFunctor _reduce)
bool | runIteration (typename Sequence::const_iterator it, int index, T *)
bool | runIterations (typename Sequence::const_iterator sequenceBeginIterator, int begin, int end, T *)
void | finish ()
bool | shouldThrottleThread ()
bool | shouldStartThread ()

## Member Typedef Documentation

typedef void ReturnType

Search for all occurrences

Definition at line 152 of file qtconcurrentfilterkernel.h.

typedef void ResultType

Search for all occurrences

Reimplemented from IterateKernel< Sequence::const_iterator, void >.

Definition at line 153 of file qtconcurrentfilterkernel.h.

## Constructor & Destructor Documentation

FilterKernel | ( | Sequence & | _sequence,
|  | KeepFunctor | _keep,
|  | ReduceFunctor | _reduce
| ) |  | `[inline]`

Definition at line 95 of file qtconcurrentfilterkernel.h.

            : IterateKernelType(const_cast<const Sequence &>(_sequence).begin(), const_cast<const Sequence &>(_sequence).end()), reducedResult(),
              sequence(_sequence),
              keep(_keep),
              reduce(_reduce),
              reducer(OrderedReduce)
        { }

## Member Function Documentation

bool runIteration | ( | typename Sequence::const_iterator | it,
|  | int | index,
|  | T * |
| ) |  | `[inline]`

Search for all occurrences

Definition at line 103 of file qtconcurrentfilterkernel.h.

        {
            IntermediateResults<typename Sequence::value_type> results;
            results.begin = index;
            results.end = index + 1;

                if (keep(*it))
                    results.vector.append(*it);

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

bool runIterations | ( | typename Sequence::const_iterator | sequenceBeginIterator,
|  | int | begin,
|  | int | end,
|  | T * |
| ) |  | `[inline]`

Search for all occurrences

Definition at line 116 of file qtconcurrentfilterkernel.h.

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

            typename Sequence::const_iterator it = sequenceBeginIterator;
            advance(it, begin);
            for (int i = begin; i < end; ++i) {
                if (keep(*it))
                    results.vector.append(*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 136 of file qtconcurrentfilterkernel.h.

        {
            reducer.finish(reduce, reducedResult);
            sequence = reducedResult;
        }

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

Search for all occurrences

Reimplemented from ThreadEngineBase.

Definition at line 142 of file qtconcurrentfilterkernel.h.

        {
            return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle();
        }

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

Search for all occurrences

Reimplemented from IterateKernel< Sequence::const_iterator, void >.

Definition at line 147 of file qtconcurrentfilterkernel.h.

        {
            return IterateKernelType::shouldStartThread() && reducer.shouldStartThread();
        }

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

- QtCore/qtconcurrentfilterkernel.h