rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators > Class Template Reference

#include <pipeline.h>

Inheritance diagram for rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >:

rpa::range_step_aux< It > rpa::range_step_base< It > rpa::range_step< pipe_archiver< Container, CondVar >, pipe_archiver< Container, CondVar > > List of all members.

Public Types

typedef container_traits<
Container >::iterator 
iterator
typedef CondVar::mutex_type mutex_type
typedef piplin_t::sync_iter sync_iter

Public Member Functions

 range_step_archiver (piplin_t *aPipe, size_t aStep, chunk_t minChkSz=chunk_t())
sync_iter begin (void) const
sync_iter end (void) const
bool empty (void) const
slice chop (void)
 This 'chop' will change only the local value of 'begin'.
template<class Rng2>
tuple2< slice, typename Rng2::slice > chop_init_lock_cond (Rng2 &aSq2, bool)
template<class Rng2>
size_t chop_again (tuple2< slice, typename Rng2::slice > &refPair, Rng2 &aSq2)

Private Types

typedef pipe_arc_aux< Container,
CondVar, insertInvalidatesIterators > 
piplin_t
typedef range_step_aux< iteratorrsa_base

Private Member Functions

void rng_refresh_archiver (void)

Private Attributes

piplin_t_pipe

Classes

class  slice

Detailed Description

template<class Container, class CondVar, bool insertInvalidatesIterators>
class rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >

It is not possible to derive from the usual 'range_step', because the begin and end of the range will always change. It must not be imbricated in a class, otherwise it would not be a specialization. This range is used when the container does not invalidate iterators after an insertion, such as a std::list.


Member Typedef Documentation

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef container_traits< Container >::iterator rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::iterator

Reimplemented from rpa::range_step_aux< It >.

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef CondVar::mutex_type rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::mutex_type

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef pipe_arc_aux< Container, CondVar, insertInvalidatesIterators > rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::piplin_t [private]

Reimplemented in rpa::range_step< pipe_archiver< Container, CondVar >, pipe_archiver< Container, CondVar > >.

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef range_step_aux< iterator > rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::rsa_base [private]

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef piplin_t::sync_iter rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::sync_iter


Constructor & Destructor Documentation

template<class Container, class CondVar, bool insertInvalidatesIterators>
rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::range_step_archiver ( piplin_t aPipe,
size_t  aStep,
chunk_t  minChkSz = chunk_t() 
) [inline]

If the useful part of the buffer (That is, the interval of values available for reading) is wrapped from the end of the buffer to its beginning, this is shown with this flag.


Member Function Documentation

template<class Container, class CondVar, bool insertInvalidatesIterators>
sync_iter rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::begin ( void   )  const [inline]

In sequential mode, use another type of iterator to allow refreshing. Each value can be read only once. This overrides the same method of range_step_aux.

Reimplemented from rpa::range_step_aux< It >.

template<class Container, class CondVar, bool insertInvalidatesIterators>
slice rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::chop ( void   )  [inline]

This 'chop' will change only the local value of 'begin'.

The pipe_archiver buffer cannot overwrite the value which are in the interval of the range.

Reimplemented from rpa::range_step_aux< It >.

template<class Container, class CondVar, bool insertInvalidatesIterators>
template<class Rng2>
size_t rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::chop_again ( tuple2< slice, typename Rng2::slice > &  refPair,
Rng2 &  aSq2 
) [inline]

Flushes the output buffer, then gets a new iterator pair. The range_step mutex is used to protect the flush, AND to 'chop' a new pair of slices.

Protects the slice assignation AND the chop.

Assigns instead of returning the new pair, because we want to benefit from the mutex.

template<class Container, class CondVar, bool insertInvalidatesIterators>
template<class Rng2>
tuple2< slice, typename Rng2::slice > rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::chop_init_lock_cond ( Rng2 &  aSq2,
bool   
) [inline]

When looping on the sub-threads creation, there are no other reading thread, but there might be writes in this container. Therefore, we must absolutely lock.

template<class Container, class CondVar, bool insertInvalidatesIterators>
bool rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::empty ( void   )  const [inline]

template<class Container, class CondVar, bool insertInvalidatesIterators>
sync_iter rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::end ( void   )  const [inline]

In sequential mode, use another type of iterator to allow refreshing. Each value can be read only once. This overrides the same method of range_step_aux.

Reimplemented from rpa::range_step_aux< It >.

template<class Container, class CondVar, bool insertInvalidatesIterators>
void rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::rng_refresh_archiver ( void   )  [inline, private]

The end of the buffer may have changed in the mean time. We never change the beginning of our range except for looping back to the beginning: Rather, it is the buffer which gets the value of the beginning of the range. It may be worth to wait until there are more than just one element to compute. On the other hand, once this thread is scheduled for execution by the signaling of the thread, it is probably better to do as much things as possible instead of simply returning.

The end of the available input data to read is simply refreshed. It might be necessary to change the beginning of the range too, because due to an insertion, it may have changed. All 'chops' will change it too.


Member Data Documentation

template<class Container, class CondVar, bool insertInvalidatesIterators>
piplin_t* rpa::range_step_archiver< Container, CondVar, insertInvalidatesIterators >::_pipe [private]


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