rpa::pipe_itr< ValueType, Reader > Class Template Reference

Synchronized iterator for reading from a pipe_circular or pipe_archiver. More...

#include <pipeline.h>

List of all members.

Public Member Functions

 pipe_itr ()
 pipe_itr (const Reader &pipRd)
 This initialize the internal reader, and reads the first value.
 pipe_itr (const pipe_itr &anIter)
const ValueType & operator * (void) const
 First checks there is data to read. If not, the program has a logic error.
const ValueType * operator-> (void) const
 First checks there is data to read. If not, the program has a logic error.
pipe_itroperator++ (void)
 Invalidates the value in the iterator. So, there will be a read next time.
pipe_itroperator++ (int)
 Invalidates the value in the iterator. So, there will be a read next time.
bool operator== (const pipe_itr &anIt) const
bool operator!= (const pipe_itr &anIt) const
 Just negates 'operator=='.

Private Member Functions

void update (void) const

Private Attributes

Reader _reader
 Stores the logic to read from a pipe_circular or pipe_archiver.
ValueType _val
bool _ok


Detailed Description

template<class ValueType, class Reader>
class rpa::pipe_itr< ValueType, Reader >

Synchronized iterator for reading from a pipe_circular or pipe_archiver.

It blocks until there is data to read. It is compatible with STL algorithms (If used as input_iterator).


Constructor & Destructor Documentation

template<class ValueType, class Reader>
rpa::pipe_itr< ValueType, Reader >::pipe_itr (  )  [inline]

template<class ValueType, class Reader>
rpa::pipe_itr< ValueType, Reader >::pipe_itr ( const Reader &  pipRd  )  [inline]

This initialize the internal reader, and reads the first value.

template<class ValueType, class Reader>
rpa::pipe_itr< ValueType, Reader >::pipe_itr ( const pipe_itr< ValueType, Reader > &  anIter  )  [inline]


Member Function Documentation

template<class ValueType, class Reader>
const ValueType& rpa::pipe_itr< ValueType, Reader >::operator * ( void   )  const [inline]

First checks there is data to read. If not, the program has a logic error.

template<class ValueType, class Reader>
bool rpa::pipe_itr< ValueType, Reader >::operator!= ( const pipe_itr< ValueType, Reader > &  anIt  )  const [inline]

Just negates 'operator=='.

template<class ValueType, class Reader>
pipe_itr& rpa::pipe_itr< ValueType, Reader >::operator++ ( int   )  [inline]

Invalidates the value in the iterator. So, there will be a read next time.

template<class ValueType, class Reader>
pipe_itr& rpa::pipe_itr< ValueType, Reader >::operator++ ( void   )  [inline]

Invalidates the value in the iterator. So, there will be a read next time.

template<class ValueType, class Reader>
const ValueType* rpa::pipe_itr< ValueType, Reader >::operator-> ( void   )  const [inline]

First checks there is data to read. If not, the program has a logic error.

template<class ValueType, class Reader>
bool rpa::pipe_itr< ValueType, Reader >::operator== ( const pipe_itr< ValueType, Reader > &  anIt  )  const [inline]

Beware that the logic is different than, for example, ostream_iterator. it may not work with all types of algorithms. This ensures first that there is a data to read if this is possible.

template<class ValueType, class Reader>
void rpa::pipe_itr< ValueType, Reader >::update ( void   )  const [inline, private]

This reads the next value in advance, only if the previous read did not work: This avoids to read two values without using them.


Member Data Documentation

template<class ValueType, class Reader>
bool rpa::pipe_itr< ValueType, Reader >::_ok [mutable, private]

template<class ValueType, class Reader>
Reader rpa::pipe_itr< ValueType, Reader >::_reader [mutable, private]

Stores the logic to read from a pipe_circular or pipe_archiver.

template<class ValueType, class Reader>
ValueType rpa::pipe_itr< ValueType, Reader >::_val [mutable, private]

This is used as a buffer : When the iterator is created or when it is incremented, it reads one value ahead, just like a std::istream_iterator. It has the same drawback : One extra data copy for nothing.


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