rpa::accumulate_t< Range, Type, BinOp > Struct Template Reference

#include <accumulate.h>

Inheritance diagram for rpa::accumulate_t< Range, Type, BinOp >:

rpa::accumulate_args< RngIn, RetType, BinOp > List of all members.

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_typeoperator() (thread_tree< ThrIter, void > aThrTree)
template<class ThrIter, class ThrMain>
present< thread_tree< ThrIter,
ThrMain >, accumulate_t
operator() (thread_tree< ThrIter, ThrMain > aThrTree)

Detailed Description

template<class Range, class Type, class BinOp>
struct rpa::accumulate_t< Range, Type, BinOp >

The data structure associated to the algorithm 'accumulate'. It has several methods of execution : The sequential one, which matches exactly the standard algorithm, and a parallel one, configurable for the type and number of threads, the scheduling mechanism (Static, dynamic or interleaved), various run-time parameters (Chunks), buffering (Type and size of output buffers), locking policy (Type of locks controlling shared resources such as output iterator)...


Member Typedef Documentation

template<class Range, class Type, class BinOp>
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.

template<class Range, class Type, class BinOp>
typedef functor_traits< BinOp >::functor_type rpa::accumulate_t< Range, Type, BinOp >::functor_type

template<class Range, class Type, class BinOp>
typedef Type rpa::accumulate_t< Range, Type, BinOp >::result_type

Reimplemented from rpa::accumulate_args< RngIn, RetType, BinOp >.

template<class Range, class Type, class BinOp>
typedef Range rpa::accumulate_t< Range, Type, BinOp >::RngIn


Constructor & Destructor Documentation

template<class Range, class Type, class BinOp>
rpa::accumulate_t< Range, Type, BinOp >::accumulate_t ( Range  aRng,
Type  aInit,
functor_type  aFunc 
) [inline]

template<class Range, class Type, class BinOp>
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'.


Member Function Documentation

template<class Range, class Type, class BinOp>
template<class ThrIter, class ThrMain>
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.

template<class Range, class Type, class BinOp>
template<class ThrIter>
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.

template<class Range, class Type, class BinOp>
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.

template<class Range, class Type, class BinOp>
const Type& rpa::accumulate_t< Range, Type, BinOp >::operator() ( void   )  [inline]

Operator for sequential execution, returning exactly the same result as the classical algorithm.


The documentation for this struct was generated from the following file:
Generated on Tue Sep 25 10:20:32 2007 for rpa by  doxygen 1.4.7