#include <common.h>
Inheritance diagram for rpa::obuf_storage< Buffer, IterBuf >:
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 |
typedef Buffer rpa::obuf_storage< Buffer, IterBuf >::buffer_type |
Must be the same as std::iterator_traits< IterBuf >::value_type.
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.
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.
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.