Buffer for multiple allocation. More...
#include <arcane/utils/MultiBuffer.h>
Public Types | |
| typedef UniqueArray< T > | BufferType |
Public Member Functions | |
| MultiBufferT (Integer buf_size) | |
| MultiBufferT (const MultiBufferT< T > &ref) | |
| Copy constructor. | |
| void | operator= (const MultiBufferT< T > &ref) |
| Copy assignment operator (forbidden). | |
| T * | allocOne () |
| Allocates a new element. | |
| ArrayView< T > | allocMany (Integer n) |
| Allocates n elements. | |
| void | clear () |
| Integer | nbAllocatedBuffer () |
| Integer | bufferSize () const |
Protected Member Functions | |
| void | _freeAllocatedBuffers () |
Private Member Functions | |
| void | _allocateCurrentBuffer () |
Private Attributes | |
| Integer | m_buffer_size |
| Number of elements in a buffer. | |
| Integer | m_current_buffer_size |
| Maximum number of elements in the current buffer. | |
| Integer | m_nb_in_buffer |
| Number of elements in the current buffer. | |
| BufferType * | m_current_buffer |
| Current buffer. | |
| UniqueArray< BufferType * > | m_allocated_buffers |
| List of all buffers. | |
Buffer for multiple allocation.
This class manages a pre-allocated list of elements in order to limit multiple calls to allocations (new() or malloc()).
Pre-allocations are done in blocks of m_buffer_size elements
To be used by this class, a type must possess a default constructor and a copy operator. This class guarantees that the returned pointers remain valid as long as this instance exists.
The constructors and copy operators do not duplicate memory but simply retain the buffer size.
Definition at line 44 of file MultiBuffer.h.
| typedef UniqueArray<T> Arcane::MultiBufferT< T >::BufferType |
Definition at line 48 of file MultiBuffer.h.
|
inline |
Definition at line 52 of file MultiBuffer.h.
|
inline |
Definition at line 59 of file MultiBuffer.h.
|
inline |
Copy constructor.
Definition at line 68 of file MultiBuffer.h.
References m_buffer_size, m_current_buffer, m_current_buffer_size, and m_nb_in_buffer.
|
inline |
Definition at line 75 of file MultiBuffer.h.
|
inlineprivate |
Definition at line 155 of file MultiBuffer.h.
|
inlineprotected |
Definition at line 139 of file MultiBuffer.h.
|
inline |
Allocates n elements.
Definition at line 106 of file MultiBuffer.h.
References m_allocated_buffers, m_current_buffer, m_current_buffer_size, and m_nb_in_buffer.
|
inline |
Allocates a new element.
Definition at line 94 of file MultiBuffer.h.
References m_current_buffer, m_current_buffer_size, and m_nb_in_buffer.
|
inline |
Definition at line 135 of file MultiBuffer.h.
|
inline |
Definition at line 127 of file MultiBuffer.h.
|
inline |
Definition at line 134 of file MultiBuffer.h.
|
inline |
Copy assignment operator (forbidden).
Definition at line 83 of file MultiBuffer.h.
References m_buffer_size.
|
private |
|
private |
Number of elements in a buffer.
Definition at line 148 of file MultiBuffer.h.
Referenced by MultiBufferT(), and operator=().
|
private |
Current buffer.
Definition at line 151 of file MultiBuffer.h.
Referenced by allocMany(), allocOne(), and MultiBufferT().
|
private |
Maximum number of elements in the current buffer.
Definition at line 149 of file MultiBuffer.h.
Referenced by allocMany(), allocOne(), and MultiBufferT().
|
private |
Number of elements in the current buffer.
Definition at line 150 of file MultiBuffer.h.
Referenced by allocMany(), allocOne(), and MultiBufferT().