rpa::iterator_lock< It, Mutex > Class Template Reference

To protect an output iterator. More...

#include <common.h>

List of all members.

Public Types

typedef std::iterator_traits<
It > 
it_traits
typedef std::output_iterator_tag iterator_category
 THIS CAN BE DISCUSSED : All iterator_lock are output iterators.
typedef output_iterator_traits<
It >::value_type 
value_type
typedef it_traits::difference_type difference_type
typedef it_traits::pointer pointer
typedef it_traits::reference reference

Public Member Functions

 iterator_lock (const It &anIter, Mutex &aMtx)
 iterator_lock (const iterator_lock &anILH)
It base_iterator (void) const
 Converts into the original iterator's value.
void base_set (const It &refIt)
 Sets the iterator only because the mutex reference cannot change.
void base_set_and_incr (const value_type &refVal)
Mutex & mutex (void)
 Returns a reference on the mutex.

Private Member Functions

iterator_lockoperator++ (void)
iterator_lock operator++ (int)

Private Attributes

It _It
Mutex & _MtxRef
 Please note that it is a REFERENCE !!


Detailed Description

template<class It, class Mutex>
class rpa::iterator_lock< It, Mutex >

To protect an output iterator.

For parallel use, this is just a helper, that tells to an algorithm how to lock an output iterator. This unique iterator will be shared by several sub-threads writing into it. It is possible to use any mutex type as long as it is compatible with the interface of mutex_base. See guard.h for possible evolutions into a full-fledged smart pointer.


Member Typedef Documentation

template<class It, class Mutex>
typedef it_traits::difference_type rpa::iterator_lock< It, Mutex >::difference_type

template<class It, class Mutex>
typedef std::iterator_traits< It > rpa::iterator_lock< It, Mutex >::it_traits

template<class It, class Mutex>
typedef std::output_iterator_tag rpa::iterator_lock< It, Mutex >::iterator_category

THIS CAN BE DISCUSSED : All iterator_lock are output iterators.

template<class It, class Mutex>
typedef it_traits::pointer rpa::iterator_lock< It, Mutex >::pointer

template<class It, class Mutex>
typedef it_traits::reference rpa::iterator_lock< It, Mutex >::reference

template<class It, class Mutex>
typedef output_iterator_traits< It >::value_type rpa::iterator_lock< It, Mutex >::value_type


Constructor & Destructor Documentation

template<class It, class Mutex>
rpa::iterator_lock< It, Mutex >::iterator_lock ( const It &  anIter,
Mutex &  aMtx 
) [inline]

template<class It, class Mutex>
rpa::iterator_lock< It, Mutex >::iterator_lock ( const iterator_lock< It, Mutex > &  anILH  )  [inline]


Member Function Documentation

template<class It, class Mutex>
It rpa::iterator_lock< It, Mutex >::base_iterator ( void   )  const [inline]

Converts into the original iterator's value.

template<class It, class Mutex>
void rpa::iterator_lock< It, Mutex >::base_set ( const It &  refIt  )  [inline]

Sets the iterator only because the mutex reference cannot change.

template<class It, class Mutex>
void rpa::iterator_lock< It, Mutex >::base_set_and_incr ( const value_type refVal  )  [inline]

template<class It, class Mutex>
Mutex& rpa::iterator_lock< It, Mutex >::mutex ( void   )  [inline]

Returns a reference on the mutex.

Mutexes are not copiable nor assignable, and we want to use only the original mutex passed as a parameter.

template<class It, class Mutex>
iterator_lock rpa::iterator_lock< It, Mutex >::operator++ ( int   )  [private]

template<class It, class Mutex>
iterator_lock& rpa::iterator_lock< It, Mutex >::operator++ ( void   )  [private]


Member Data Documentation

template<class It, class Mutex>
It rpa::iterator_lock< It, Mutex >::_It [private]

template<class It, class Mutex>
Mutex& rpa::iterator_lock< It, Mutex >::_MtxRef [private]

Please note that it is a REFERENCE !!


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