#include <accumulate.h>
Inheritance diagram for rpa::accumulate_t< Range, Type, BinOp >:
Public Types | |
typedef Range | RngIn |
typedef Type | result_type |
typedef functor_traits< BinOp >::functor_type | functor_type |
typedef accumulate_args< RngIn, result_type, functor_type > | args_t |
Public Member Functions | |
accumulate_t (Range aRng, Type aInit, functor_type aFunc) | |
accumulate_t (Range aRng, Type aInit) | |
const Type & | operator() (void) |
const Type & | operator() (thread_tree< void, void >) |
template<class ThrIter> | |
const result_type & | operator() (thread_tree< ThrIter, void > aThrTree) |
template<class ThrIter, class ThrMain> | |
present< thread_tree< ThrIter, ThrMain >, accumulate_t > | operator() (thread_tree< ThrIter, ThrMain > aThrTree) |
typedef accumulate_args< RngIn, result_type, functor_type > rpa::accumulate_t< Range, Type, BinOp >::args_t |
Not very clean because some debugging functions access directly the member '_args'. Not critical at all.
typedef functor_traits< BinOp >::functor_type rpa::accumulate_t< Range, Type, BinOp >::functor_type |
typedef Type rpa::accumulate_t< Range, Type, BinOp >::result_type |
Reimplemented from rpa::accumulate_args< RngIn, RetType, BinOp >.
typedef Range rpa::accumulate_t< Range, Type, BinOp >::RngIn |
rpa::accumulate_t< Range, Type, BinOp >::accumulate_t | ( | Range | aRng, | |
Type | aInit, | |||
functor_type | aFunc | |||
) | [inline] |
rpa::accumulate_t< Range, Type, BinOp >::accumulate_t | ( | Range | aRng, | |
Type | aInit | |||
) | [inline] |
Necessary if the calling program does not use the helper function 'make_accumulate'.
present< thread_tree< ThrIter, ThrMain >, accumulate_t > rpa::accumulate_t< Range, Type, BinOp >::operator() | ( | thread_tree< ThrIter, ThrMain > | aThrTree | ) | [inline] |
We should FORBID to call 'result' while the thread is running. The returned object stores all the variables that the 'future' needs, because it holds reference on the functor and the thread.
const result_type& rpa::accumulate_t< Range, Type, BinOp >::operator() | ( | thread_tree< ThrIter, void > | aThrTree | ) | [inline] |
Operator for parallel execution, which receives several threads grouped in a sequence (Which can be a sequence of sequences, hence a tree). It can be called only once, because internal data are changed (Ranges). We pass the thread tree by reference because it can return information. The thread tree can encapsulate a thread pool, and have any structure as long as we get an iterator.
Trivial case of no threads.
Tasks can be executed only once.
Now that the actual number of threads to use is known, maybe calculate immediately.
We do not use directly ThrIter because it could be a static array.
const Type& rpa::accumulate_t< Range, Type, BinOp >::operator() | ( | thread_tree< void, void > | ) | [inline] |
Identical to the sequential execution operator()(void) : A non-void datatype is simply needed.
const Type& rpa::accumulate_t< Range, Type, BinOp >::operator() | ( | void | ) | [inline] |
Operator for sequential execution, returning exactly the same result as the classical algorithm.