FilteredReducedKernel< ReducedResultType, Iterator, KeepFunctor, ReduceFunctor, Reducer > Class Template Reference

FilteredReducedKernel< ReducedResultType, Iterator, KeepFunctor, ReduceFunctor, Reducer > Class Template Reference

#include <qtconcurrentfilterkernel.h>

Class Description

template<typename ReducedResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor, typename Reducer = ReduceKernel<ReduceFunctor, ReducedResultType, typename qValueType<Iterator>::value_type>>
class QtConcurrent::FilteredReducedKernel< ReducedResultType, Iterator, KeepFunctor, ReduceFunctor, Reducer >

Definition at line 164 of file qtconcurrentfilterkernel.h.

+ Inheritance diagram for FilteredReducedKernel< ReducedResultType, Iterator, KeepFunctor, ReduceFunctor, Reducer >:

Public Types

typedef ReducedResultType ReturnType
 
typedef ReducedResultType ResultType
 
- Public Types inherited from IterateKernel< Iterator, ReducedResultType >
typedef ReducedResultType ResultType
 
- Public Types inherited from ThreadEngine< ReducedResultType >
typedef ReducedResultType ResultType
 

Public Member Functions

 FilteredReducedKernel (Iterator begin, Iterator end, KeepFunctor _keep, ReduceFunctor _reduce, ReduceOptions reduceOption)
 
bool runIteration (Iterator it, int index, ReducedResultType *)
 
bool runIterations (Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *)
 
void finish ()
 
bool shouldThrottleThread ()
 
bool shouldStartThread ()
 
ReducedResultType * result ()
 
- Public Member Functions inherited from IterateKernel< Iterator, ReducedResultType >
 IterateKernel (Iterator _begin, Iterator _end)
 
virtual ~IterateKernel ()
 
void start ()
 
bool shouldStartThread ()
 
ThreadFunctionResult threadFunction ()
 
ThreadFunctionResult forThreadFunction ()
 
ThreadFunctionResult whileThreadFunction ()
 
- Public Member Functions inherited from ThreadEngine< ReducedResultType >
QFutureInterface< ReducedResultType > * futureInterfaceTyped ()
 
ReducedResultType * startSingleThreaded ()
 
ReducedResultType * startBlocking ()
 
QFuture< ReducedResultType > startAsynchronously ()
 
void asynchronousFinish ()
 
void reportResult (const ReducedResultType *_result, int index=-1)
 
void reportResults (const QVector< ReducedResultType > &_result, int index=-1, int count=-1)
 
- Public Member Functions inherited from ThreadEngineBase
 ThreadEngineBase ()
 
virtual ~ThreadEngineBase ()
 
void startSingleThreaded ()
 
void startBlocking ()
 
void startThread ()
 
bool isCanceled ()
 
void waitForResume ()
 
bool isProgressReportingEnabled ()
 
void setProgressValue (int progress)
 
void setProgressRange (int minimum, int maximum)
 
void acquireBarrierSemaphore ()
 
- Public Member Functions inherited from QRunnable
 QRunnable ()
 
virtual ~QRunnable ()
 
bool autoDelete () const
 
void setAutoDelete (bool _autoDelete)
 

Additional Inherited Members

- Public Attributes inherited from IterateKernel< Iterator, ReducedResultType >
const Iterator begin
 
const Iterator end
 
Iterator current
 
QAtomicInt currentIndex
 
bool forIteration
 
QAtomicInt iteratorThreads
 
int iterationCount
 
bool progressReportingEnabled
 
QAtomicInt completed
 
- Protected Attributes inherited from ThreadEngineBase
QFutureInterfaceBasefutureInterface
 
QThreadPoolthreadPool
 
ThreadEngineBarrier barrier
 
QtConcurrent::internal::ExceptionStore exceptionStore
 

Member Typedef Documentation

typedef ReducedResultType ReturnType

Definition at line 237 of file qtconcurrentfilterkernel.h.

typedef ReducedResultType ResultType

Definition at line 238 of file qtconcurrentfilterkernel.h.

Constructor & Destructor Documentation

FilteredReducedKernel ( Iterator  begin,
Iterator  end,
KeepFunctor  _keep,
ReduceFunctor  _reduce,
ReduceOptions  reduceOption 
)
inline

Definition at line 173 of file qtconcurrentfilterkernel.h.

178  : IterateKernelType(begin, end), reducedResult(), keep(_keep), reduce(_reduce), reducer(reduceOption)
179  { }
GLuint GLuint end
Definition: GLee.h:872

Member Function Documentation

bool runIteration ( Iterator  it,
int  index,
ReducedResultType *   
)
inlinevirtual

Reimplemented from IterateKernel< Iterator, ReducedResultType >.

Definition at line 190 of file qtconcurrentfilterkernel.h.

191  {
192  IntermediateResults<typename qValueType<Iterator>::value_type> results;
193  results.begin = index;
194  results.end = index + 1;
195 
196  if (keep(*it))
197  results.vector.append(*it);
198 
199  reducer.runReduce(reduce, reducedResult, results);
200  return false;
201  }
GLuint index
Definition: GLee.h:1704
bool runIterations ( Iterator  sequenceBeginIterator,
int  begin,
int  end,
ReducedResultType *   
)
inlinevirtual

Reimplemented from IterateKernel< Iterator, ReducedResultType >.

Definition at line 203 of file qtconcurrentfilterkernel.h.

204  {
205  IntermediateResults<typename qValueType<Iterator>::value_type> results;
206  results.begin = begin;
207  results.end = end;
208  results.vector.reserve(end - begin);
209 
210  Iterator it = sequenceBeginIterator;
211  advance(it, begin);
212  for (int i = begin; i < end; ++i) {
213  if (keep(*it))
214  results.vector.append(*it);
215  advance(it, 1);
216  }
217 
218  reducer.runReduce(reduce, reducedResult, results);
219  return false;
220  }
GLuint GLuint end
Definition: GLee.h:872
void finish ( )
inlinevirtual

Reimplemented from ThreadEngineBase.

Definition at line 222 of file qtconcurrentfilterkernel.h.

223  {
224  reducer.finish(reduce, reducedResult);
225  }
bool shouldThrottleThread ( )
inlinevirtual

Reimplemented from ThreadEngineBase.

Definition at line 227 of file qtconcurrentfilterkernel.h.

228  {
229  return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle();
230  }
bool shouldStartThread ( )
inlinevirtual

Reimplemented from ThreadEngineBase.

Definition at line 232 of file qtconcurrentfilterkernel.h.

233  {
234  return IterateKernelType::shouldStartThread() && reducer.shouldStartThread();
235  }
ReducedResultType* result ( )
inlinevirtual

Reimplemented from ThreadEngine< ReducedResultType >.

Definition at line 239 of file qtconcurrentfilterkernel.h.

240  {
241  return &reducedResult;
242  }

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