rpa::coroutine_step< AccumulateVec, Ftor > Struct Template Reference

Used only in the specialisation of accumulate_vec for range_step. More...

#include <accumulate.h>

List of all members.

Public Types

typedef AccumulateVec::RngIn RngIn
typedef RngIn::slice::iterator iterator_t
typedef RngIn::slice SliceIn
typedef AccumulateVec::result_type result_type

Public Member Functions

 coroutine_step (RngIn &aRngIn, bool mustLock, Ftor &aFunc)
bool empty_slice (void) const
 To check whether it is worth to run the functor after its creation.
result_type operator() (void)
 Must be called the same number of times as a sequential algorithm.

Public Attributes

RngIn_seqIn
Ftor & _func

Private Attributes

SliceIn _sliceIn


Detailed Description

template<class AccumulateVec, class Ftor>
struct rpa::coroutine_step< AccumulateVec, Ftor >

Used only in the specialisation of accumulate_vec for range_step.

This class is put outside the definition of accumulate_vec because of compile problems due to template specialisations inside template specialisation. This functor is executed instead of the original one.


Member Typedef Documentation

template<class AccumulateVec, class Ftor>
typedef RngIn::slice::iterator rpa::coroutine_step< AccumulateVec, Ftor >::iterator_t

template<class AccumulateVec, class Ftor>
typedef AccumulateVec::result_type rpa::coroutine_step< AccumulateVec, Ftor >::result_type

template<class AccumulateVec, class Ftor>
typedef AccumulateVec::RngIn rpa::coroutine_step< AccumulateVec, Ftor >::RngIn

template<class AccumulateVec, class Ftor>
typedef RngIn::slice rpa::coroutine_step< AccumulateVec, Ftor >::SliceIn


Constructor & Destructor Documentation

template<class AccumulateVec, class Ftor>
rpa::coroutine_step< AccumulateVec, Ftor >::coroutine_step ( RngIn aRngIn,
bool  mustLock,
Ftor &  aFunc 
) [inline]


Member Function Documentation

template<class AccumulateVec, class Ftor>
bool rpa::coroutine_step< AccumulateVec, Ftor >::empty_slice ( void   )  const [inline]

To check whether it is worth to run the functor after its creation.

template<class AccumulateVec, class Ftor>
result_type rpa::coroutine_step< AccumulateVec, Ftor >::operator() ( void   )  [inline]

Must be called the same number of times as a sequential algorithm.

Necessary otherwise we would have to return a default value if the slice is empty, which makes no sense in the general case.

This debugging statement is bit dangerous because not thread-safe, but this does not really matters because it is for displaying only.

In general, we do not know this functor's neutral element. For 'int' and 'float', it is zero, but otherwise ... Moreover, we want to have the same number of functor calls, whether the algorithm execution is sequential or parallel, and whatever the number of threads is. So, the 'init value' of this algorithm is the value pointed to by the 'begin' of this sequence.

Is this the end of the sequence ? Using 'chop_again' is faster than 'chop' because it is not necessary to call the ctor/dtor of the slice.

Unsetting this flag will force the addition to be made by small pieces which is extremely profitable for strings, because there are less copies for reallocations. But this problem cannot be generalised at the moment.


Member Data Documentation

template<class AccumulateVec, class Ftor>
Ftor& rpa::coroutine_step< AccumulateVec, Ftor >::_func

template<class AccumulateVec, class Ftor>
RngIn& rpa::coroutine_step< AccumulateVec, Ftor >::_seqIn

template<class AccumulateVec, class Ftor>
SliceIn rpa::coroutine_step< AccumulateVec, Ftor >::_sliceIn [private]


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