rpa::transform_loop_thr< Args, Task, Thread > Class Template Reference

#include <transform.h>

Inheritance diagram for rpa::transform_loop_thr< Args, Task, Thread >:

rpa::thread_stack< Task, Thread > List of all members.

Public Types

typedef tuple2< typename Args::range_in_t::slice,
typename Args::range_out_t::slice > 
PairT
typedef Args::result_type result_type

Public Member Functions

const result_typereduction (Args *ptrArgs)

Private Types

typedef thread_stack< Task,
Thread > 
ThrStack

Detailed Description

template<class Args, class Task, class Thread>
class rpa::transform_loop_thr< Args, Task, Thread >

Each specialization of the template class 'transform_vec' contains a class named 'loop_t', which is a derived class of 'transform_loop_thr'. All these classes 'transform_vec< Xyz >loop_t are used for building objects, one per sub thread, stored on the main thread stack, and which are linked together thanks to the base class 'ThrStack'. These objects - one per sub-thread - are called 'forkify'. 'Chainer' contains pointers to the first and the last 'forkify' objects.


Member Typedef Documentation

template<class Args, class Task, class Thread>
typedef tuple2< typename Args::range_in_t::slice, typename Args::range_out_t::slice > rpa::transform_loop_thr< Args, Task, Thread >::PairT

template<class Args, class Task, class Thread>
typedef Args::result_type rpa::transform_loop_thr< Args, Task, Thread >::result_type

Reimplemented from rpa::thread_stack< Task, Thread >.

template<class Args, class Task, class Thread>
typedef thread_stack< Task, Thread > rpa::transform_loop_thr< Args, Task, Thread >::ThrStack [private]


Member Function Documentation

template<class Args, class Task, class Thread>
const result_type& rpa::transform_loop_thr< Args, Task, Thread >::reduction ( Args *  ptrArgs  )  [inline]

Called only after all sub-threads are started. Waits with a join, each sub-thread, one after the other, in the order they were started. Do some cleanup as well, in the order these sub-threads were started, potentially for flushing into the output iterator.

We iterate in the object 'ThrStack', in the order with which the threads were started. For this algorithm, the intermediary results are unneeded. But we must wait for each thread before unstacking.

The method operator()(void) makes a join for the thread, and return the result of the functor - which may be different from our return type. Therefore, there is a conversion operator, whose role is, typically, to flush buffers of the output iterator. The role of 'reduce' is to do nothing for plain output iterators. But it flushes obuf_iterator. Returns a value (Not needed here). NOTE: We do not store the result of 'Forkifyoperator()' in a temporary variable because it breaks some run-time checks and asserts.

We have to return the content of 'Args' because the datatype of the sequence output iterator, is different from the datatype of the slices output iterators, in general.


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