rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t Class Reference

#include <remove_copy_if.h>

List of all members.

Public Types

typedef SliceIn::iterator iterator_t
typedef SliceOut::iterator result_type

Public Member Functions

 functor_t (RngIn &aRngIn, RngOut &aRngOut, Ftor &aFunc, bool mustLock)
result_type operator() (void)
RngOut::iterator terminate (const result_type &aRT)
 The parameter is const because no change is needed.
const SliceOutoutput_interval (void) const

Private Attributes

RngIn & _seqIn
RngOut & _seqOut
Ftor & _func
PairT _Pair


Detailed Description

template<class RngIn, class RngOut, class Ftor>
class rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t

This acts as a new functor, executed by a subthread instead of the original functor. We do not know the total number of input elements, so this reads, in a loop, slices of elements that are, at least, processed by the original functor, with the standard STL algorithm.

Ftor : A functor made from the original algorithm functor, with maybe the association of a tree of sub-threads.


Member Typedef Documentation

template<class RngIn, class RngOut, class Ftor>
typedef SliceIn::iterator rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::iterator_t

template<class RngIn, class RngOut, class Ftor>
typedef SliceOut::iterator rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::result_type


Constructor & Destructor Documentation

template<class RngIn, class RngOut, class Ftor>
rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::functor_t ( RngIn &  aRngIn,
RngOut &  aRngOut,
Ftor &  aFunc,
bool  mustLock 
) [inline]

As we are called in a sequential context, called by the main thread, it is a good opportunity to 'chop' a slice of elements without any mutex, because it is not needed.


Member Function Documentation

template<class RngIn, class RngOut, class Ftor>
result_type rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::operator() ( void   )  [inline]

Here, all operations on the input and output sequences must be protected by the mutex of 'range_step'.

The new interval cannot be stored in the sequence, because this sequence is shared by several threads. Therefore, we cannot check if there are available elements, then later pick them, because in the mean time another sub-threads may have 'chopped' them. End of sequence ?

This functor is sequentially run, then any input sequence is OK. It may be fine, if we have a real threads tree with several levels, to pass a whole threads sub-tree to the ftor. Not very urgent now. But theoretically, we should introduce a thrify (ou forkify).

Flushes the output buffers if there are some. Done by converting the result type of the cleaner into the original result type.

Gets a new pair of iterators. If buffer of a limited size, the 'dynamic' 'range_step' method is used, with a chunk size equal to the buffer's size, thanks to 'adjust'. TODO: WHY NO MUTEX IN INPUT ???

template<class RngIn, class RngOut, class Ftor>
const SliceOut& rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::output_interval ( void   )  const [inline]

template<class RngIn, class RngOut, class Ftor>
RngOut::iterator rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::terminate ( const result_type aRT  )  [inline]

The parameter is const because no change is needed.


Member Data Documentation

template<class RngIn, class RngOut, class Ftor>
Ftor& rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::_func [private]

template<class RngIn, class RngOut, class Ftor>
PairT rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::_Pair [private]

If there is a temporary buffer in the output slice, it will finally be flushed when the destructor of 'remove_copy_if_chop_step' will be called. Luckily, this destructor will be called by the main thread, which means that the flushes into the output container will finally be serialised.

template<class RngIn, class RngOut, class Ftor>
RngIn& rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::_seqIn [private]

template<class RngIn, class RngOut, class Ftor>
RngOut& rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::_seqOut [private]


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