FilteredEachKernel< Iterator, KeepFunctor > Class Template Reference


Detailed Description

template<typename Iterator, typename KeepFunctor>
class QtConcurrent::FilteredEachKernel< Iterator, KeepFunctor >

Definition at line 247 of file qtconcurrentfilterkernel.h.

#include <qtconcurrentfilterkernel.h>

Inheritance diagram for FilteredEachKernel< Iterator, KeepFunctor >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef T  ReturnType
typedef T  ResultType

Public Member Functions

  FilteredEachKernel (Iterator begin, Iterator end, KeepFunctor _keep)
void  start ()
bool  runIteration (Iterator it, int index, T *)
bool  runIterations (Iterator sequenceBeginIterator, int begin, int end, T *)

Member Typedef Documentation


Constructor & Destructor Documentation

FilteredEachKernel ( Iterator  begin,
Iterator  end,
KeepFunctor  _keep 
) [inline]

Definition at line 258 of file qtconcurrentfilterkernel.h.

        : IterateKernelType(begin, end), keep(_keep)
    { }

Member Function Documentation

bool runIteration ( Iterator  it,
int  index,
T *   
) [inline]

Definition at line 269 of file qtconcurrentfilterkernel.h.

    {
        if (keep(*it))
            this->reportResult(&(*it), index);
        else
            this->reportResult(0, index);
        return false;
    }
bool runIterations ( Iterator  sequenceBeginIterator,
int  begin,
int  end,
T *   
) [inline]

Definition at line 278 of file qtconcurrentfilterkernel.h.

    {
        const int count = end - begin;
        IntermediateResults<typename qValueType<Iterator>::value_type> results;
        results.begin = begin;
        results.end = end;
        results.vector.reserve(count);

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

        this->reportResults(results.vector, begin, count);
        return false;
    }

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