rpa::pipe_arc_base< Container, CondVar > Class Template Reference

Base class for pipe_archiver. Does not depend on the container type. More...

#include <pipeline.h>

Inheritance diagram for rpa::pipe_arc_base< Container, CondVar >:

rpa::pipebase< Container, CondVar > rpa::pipe_container< Container > rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators > rpa::pipe_arc_aux< Container, CondVar, rpa::insert_invalidates_iterators< Container >::value > rpa::pipe_arc_aux< Container, CondVar, true > rpa::pipe_archiver< Container, CondVar > List of all members.

Public Types

typedef pipebase< Container,
CondVar > 
pipebase_t
typedef pipebase_t::iterator iterator
typedef pipebase_t::value_type value_type
typedef pipebase_t::mutex_type mutex_type
typedef pipe_itr< value_type,
reader
sync_iter

Public Member Functions

 pipe_arc_base (mutex_type *mtxPtr)
template<class Iter>
 pipe_arc_base (mutex_type *mtxPtr, Iter begIter, Iter endIter, bool shutFlag=true)
 pipe_arc_base (mutex_type *mtxPtr, const Container &aCont, bool shutFlag=true)
bool data_ready (void) const
 Tells whether the pipe is not empty. Called by wait_data.
sync_iter begin (void)
sync_iter end (void)

Protected Member Functions

void push_back_refresh (const value_type &aV)
template<class IterIn>
size_t append_refresh (IterIn itBeg, IterIn itEnd, size_t szRsrv)
 Updates pointers, notifies threads and returns the inserted elements number.

Classes

class  reader
 Models how to read from a pipe_archiver. More...

Detailed Description

template<class Container, class CondVar>
class rpa::pipe_arc_base< Container, CondVar >

Base class for pipe_archiver. Does not depend on the container type.


Member Typedef Documentation

template<class Container, class CondVar>
typedef pipebase_t::iterator rpa::pipe_arc_base< Container, CondVar >::iterator

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

Reimplemented in rpa::pipe_archiver< Container, CondVar >, rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >, rpa::pipe_arc_aux< Container, CondVar, true >, and rpa::pipe_arc_aux< Container, CondVar, rpa::insert_invalidates_iterators< Container >::value >.

template<class Container, class CondVar>
typedef pipebase_t::mutex_type rpa::pipe_arc_base< Container, CondVar >::mutex_type

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

Reimplemented in rpa::pipe_archiver< Container, CondVar >, rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >, rpa::pipe_arc_aux< Container, CondVar, true >, and rpa::pipe_arc_aux< Container, CondVar, rpa::insert_invalidates_iterators< Container >::value >.

template<class Container, class CondVar>
typedef pipebase< Container, CondVar > rpa::pipe_arc_base< Container, CondVar >::pipebase_t

Reimplemented in rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >, rpa::pipe_arc_aux< Container, CondVar, true >, and rpa::pipe_arc_aux< Container, CondVar, rpa::insert_invalidates_iterators< Container >::value >.

template<class Container, class CondVar>
typedef pipe_itr< value_type, reader > rpa::pipe_arc_base< Container, CondVar >::sync_iter

Reimplemented in rpa::pipe_archiver< Container, CondVar >, rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >, and rpa::pipe_arc_aux< Container, CondVar, rpa::insert_invalidates_iterators< Container >::value >.

template<class Container, class CondVar>
typedef pipebase_t::value_type rpa::pipe_arc_base< Container, CondVar >::value_type

Reimplemented in rpa::pipe_arc_aux< Container, CondVar, insertInvalidatesIterators >, rpa::pipe_arc_aux< Container, CondVar, true >, and rpa::pipe_arc_aux< Container, CondVar, rpa::insert_invalidates_iterators< Container >::value >.


Constructor & Destructor Documentation

template<class Container, class CondVar>
rpa::pipe_arc_base< Container, CondVar >::pipe_arc_base ( 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>
template<class Iter>
rpa::pipe_arc_base< Container, CondVar >::pipe_arc_base ( mutex_type mtxPtr,
Iter  begIter,
Iter  endIter,
bool  shutFlag = true 
) [inline]

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


Member Function Documentation

template<class Container, class CondVar>
template<class IterIn>
size_t rpa::pipe_arc_base< Container, CondVar >::append_refresh ( IterIn  itBeg,
IterIn  itEnd,
size_t  szRsrv 
) [inline, protected]

Updates pointers, notifies threads and returns the inserted elements number.

We must notify AT LEAST the number of elements inserted. Otherwise, some threads could wait, although there would be elements ready to be read. The condition variable must be able to make a broadcast if the number of inserted elements is too big, because there cannot possibly be the same number of threads.

template<class Container, class CondVar>
sync_iter rpa::pipe_arc_base< Container, CondVar >::begin ( void   )  [inline]

These two iterators can be used into algorithm of std. Each value can be read only once.

Reimplemented from rpa::pipe_container< Container >.

template<class Container, class CondVar>
bool rpa::pipe_arc_base< Container, CondVar >::data_ready ( void   )  const [inline]

Tells whether the pipe is not empty. Called by wait_data.

template<class Container, class CondVar>
sync_iter rpa::pipe_arc_base< Container, CondVar >::end ( void   )  [inline]

Reimplemented from rpa::pipe_container< Container >.

template<class Container, class CondVar>
void rpa::pipe_arc_base< Container, CondVar >::push_back_refresh ( const value_type aV  )  [inline, protected]

The mutex must be already locked. For some containers, all the iterators may be invalidated for each insertion. These updates, which are specific to the container, are done in the 'push_back' method which calls this one. Here, we do only the updates which must be logically done for any type of container.

We notify only one thread because there is only one element to read.


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