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

#include <pipeline.h>

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

rpa::pipe_arc_base< Container, CondVar > rpa::pipebase< Container, CondVar > rpa::pipe_container< Container > rpa::pipe_archiver< Container, CondVar > List of all members.

Public Types

typedef pipe_arc_base< Container,
CondVar > 
pipebase_t
typedef pipebase_t::iterator iterator
typedef pipebase_t::sync_iter sync_iter
typedef pipebase_t::value_type value_type
typedef pipebase_t::mutex_type mutex_type
typedef pipe_archiver< Container,
CondVar > 
piparc_t
typedef range_step< piparc_t,
piparc_t
range_step_type

Public Member Functions

 pipe_arc_aux (mutex_type *mtxPtr)
template<class Iter>
 pipe_arc_aux (mutex_type *mtxPtr, Iter begIter, Iter endIter, bool shutFlag=true)
 pipe_arc_aux (mutex_type *mtxPtr, const Container &aCont, bool shutFlag=true)
void update_after_chop_archiver (iterator sliceEnd)
void push_back (const value_type &aV)
template<class IterIn>
void append (IterIn itBeg, IterIn itEnd, size_t szReserve)
range_step_type build_range (size_t nbSteps, chunk_t aCM=chunk_t())

Friends

class range_step_archiver< Container, CondVar, insertInvalidatesIterators >
class range_step_type::slice
 The slice needs to access the pipe, to wait when there are no data.

Detailed Description

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

An interesting specialization, when using file descriptors, is to use the system call 'tee()', on Linux 2.6.17. The second conditional variable type is never used here, because it is necessary only for containers which may invalidate their iterators when inserting.


Member Typedef Documentation

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef pipebase_t::iterator rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::iterator

Reimplemented from rpa::pipe_arc_base< Container, CondVar >.

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

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

Reimplemented from rpa::pipe_arc_base< Container, CondVar >.

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

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef pipe_archiver< Container, CondVar > rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::piparc_t

This range can be used into any algorithm of this library. It is synchronized with the internal mutex of the container.

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef pipe_arc_base< Container, CondVar > rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::pipebase_t

Reimplemented from rpa::pipe_arc_base< Container, CondVar >.

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef range_step< piparc_t, piparc_t > rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::range_step_type

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef pipebase_t::sync_iter rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::sync_iter

Reimplemented from rpa::pipe_arc_base< Container, CondVar >.

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

template<class Container, class CondVar, bool insertInvalidatesIterators>
typedef pipebase_t::value_type rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::value_type

Reimplemented from rpa::pipe_arc_base< Container, CondVar >.


Constructor & Destructor Documentation

template<class Container, class CondVar, bool insertInvalidatesIterators>
rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::pipe_arc_aux ( mutex_type mtxPtr  )  [inline]

The container is set to the proper size. If this is a plain array, we do nothing. We could do a lazy-resizing, only when it is necessary, but there is no point to wait : If a given size is necessary, why not resizing now ? More: By setting the right size immediately, we ensure that the iterators are always valid. On the other hand, the real shame of it is that we must always pay the price of a full allocation even for a couple of data. (This is also true for output buffers obuf_iterator). To compensate this, a buffer can be reused, once allocated.

template<class Container, class CondVar, bool insertInvalidatesIterators>
template<class Iter>
rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::pipe_arc_aux ( mutex_type mtxPtr,
Iter  begIter,
Iter  endIter,
bool  shutFlag = true 
) [inline]

template<class Container, class CondVar, bool insertInvalidatesIterators>
rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::pipe_arc_aux ( mutex_type mtxPtr,
const Container &  aCont,
bool  shutFlag = true 
) [inline]


Member Function Documentation

template<class Container, class CondVar, bool insertInvalidatesIterators>
template<class IterIn>
void rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::append ( IterIn  itBeg,
IterIn  itEnd,
size_t  szReserve 
) [inline]

template<class Container, class CondVar, bool insertInvalidatesIterators>
range_step_type rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::build_range ( size_t  nbSteps,
chunk_t  aCM = chunk_t() 
) [inline]

The creation of a range is protected by a mutex, because its reads some internal data.

template<class Container, class CondVar, bool insertInvalidatesIterators>
void rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::push_back ( const value_type aV  )  [inline]

This is compatible with std::back_inserter. If necessary, if the iterators are invalid after the insertion, they are refreshed (std::vector ...) If it is the first inserted element, things are refreshed too.

If the container is empty, all its iterators must have a meaningful value after the first insertion.

If the rd iterator points on the end, it must be restored because 'end()' is not a real value for an iterator.

template<class Container, class CondVar, bool insertInvalidatesIterators>
void rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >::update_after_chop_archiver ( iterator  sliceEnd  )  [inline]

When a slice is just created with a 'chop', or is chopped again, the end of the slice becomes the 'Rd' of the slice, that is, the first place to read from. The mutex stays locked between the lock and this method.


Friends And Related Function Documentation

template<class Container, class CondVar, bool insertInvalidatesIterators>
friend class range_step_archiver< Container, CondVar, insertInvalidatesIterators > [friend]

The range step really needs to access the inner guts of the pipe. It is possible to avoid this with accessors everywhere.

template<class Container, class CondVar, bool insertInvalidatesIterators>
friend class range_step_type::slice [friend]

The slice needs to access the pipe, to wait when there are no data.


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