#include <remove_copy_if.h>
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 SliceOut & | output_interval (void) const |
Private Attributes | |
RngIn & | _seqIn |
RngOut & | _seqOut |
Ftor & | _func |
PairT | _Pair |
Ftor : A functor made from the original algorithm functor, with maybe the association of a tree of sub-threads.
typedef SliceIn::iterator rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::iterator_t |
typedef SliceOut::iterator rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::result_type |
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.
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 ???
const SliceOut& rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::output_interval | ( | void | ) | const [inline] |
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.
Ftor& rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::_func [private] |
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.
RngIn& rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::_seqIn [private] |
RngOut& rpa::remove_copy_if_seq_step< RngIn, RngOut, Ftor >::functor_t::_seqOut [private] |