rpa::obuf_storage< Buffer, IterBuf > Class Template Reference

#include <common.h>

Inheritance diagram for rpa::obuf_storage< Buffer, IterBuf >:

rpa::obuf_iterator< IterOut, Buffer, IterBuf, Mutex > rpa::obuf_iterator< IterOut, Buffer, IterBuf, void > List of all members.

Public Types

typedef Buffer buffer_type
 Must be the same as std::iterator_traits< IterBuf >::value_type.

Public Member Functions

internal_buffer next_buffer (void)
 obuf_storage (typename Carray_to_iterator< IterBuf >::iterator aItrBuf)

Private Attributes

Carray_to_iterator< IterBuf
>::iterator 
_iterBuf

Classes

class  internal_buffer

Detailed Description

template<class Buffer, class IterBuf>
class rpa::obuf_storage< Buffer, IterBuf >

This class is used to associate a buffer, and the buffer pseudo-allocator, i.e. the object which allows each thread to get its buffer. This pseudo-allocator is an iterator which returns a buffer reference at each dereferencement.


Member Typedef Documentation

template<class Buffer, class IterBuf>
typedef Buffer rpa::obuf_storage< Buffer, IterBuf >::buffer_type

Must be the same as std::iterator_traits< IterBuf >::value_type.


Constructor & Destructor Documentation

template<class Buffer, class IterBuf>
rpa::obuf_storage< Buffer, IterBuf >::obuf_storage ( typename Carray_to_iterator< IterBuf >::iterator  aItrBuf  )  [inline]

We take a reference because the IterBuf may be a C-style fixed-size array, whose copy is very costly, although they behave like iterators. There is unfortunately no way to check that we will not need more buffers than existing. Anyway, the number of sub-threads must be less or equal than the number of available buffers.


Member Function Documentation

template<class Buffer, class IterBuf>
internal_buffer rpa::obuf_storage< Buffer, IterBuf >::next_buffer ( void   )  [inline]

Called when creating slices, this provide a new buffer, or a reference to an existing one, by incrementing IterBuf, if it is not 'void', of course.

Do not need a mutex because buffers are allocated by the main thread.

Maybe we should return the last value of this iterator ? How can we check that we do not iterate beyond the end of the allocator ?

It is up to the slice to insert empty elements in the buffer if needed. We just provide a buffer as-is : It may be empty or full of elements.


Member Data Documentation

template<class Buffer, class IterBuf>
Carray_to_iterator< IterBuf >::iterator rpa::obuf_storage< Buffer, IterBuf >::_iterBuf [private]

Except when the pool of buffers is a C-style fixed-size array, IterBuf is identical to Carray_to_iterator< IterBuf >::iterator.


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