template<class
F, class T = void, class
R = void>
class TMPWorkerExecutor< F, T, R >
This class works together with TProcessExecutor to allow the execution of functions in server processes.
Depending on the exact task that the worker is required to execute, a different version of the class can be called.
TMPWorkerExecutor<F, T, R>
The most general case, used by TProcessExecutor::MapReduce(F func, T& args, R redfunc). This worker is build with:
- a function of signature F (the one to be executed)
- a collection of arguments of type T on which to apply the function
- a reduce function with signature R to be used to squash many returned values together.
Partial specializations
A few partial specializations are provided for less general cases:
- TMPWorkerExecutor<F, T, void> handles the case of a function that takes one argument and does not perform reduce operations (TProcessExecutor::Map(F func, T& args)).
- TMPWorkerExecutor<F, void, R> handles the case of a function that takes no arguments, to be executed a specified amount of times, which returned values are squashed together (reduced) (TProcessExecutor::Map(F func, unsigned nTimes, R redfunc))
- TMPWorkerExecutor<F, void, void> handles the case of a function that takes no arguments and whose arguments are not "reduced" (TProcessExecutor::Map(F func, unsigned nTimes))
Since all the important data are passed to TMPWorkerExecutor at construction time, the kind of messages that client and workers have to exchange are usually very simple.
Definition at line 77 of file TMPWorkerExecutor.h.