|
soma-io 6.0.6
|
A STL-like vector with a smart and slow allocation system for large data buffers. More...
#include <soma-io/utilities/allocatedvector.h>
Public Types | |
| typedef size_t | size_type |
| typedef T * | iterator |
| typedef const T * | const_iterator |
Public Member Functions | |
| AllocatedVector (size_type n, const AllocatorContext &ac) | |
| AllocatedVector (const AllocatedVector &other) | |
| The copy constructor uses a "standard" AllocatorContext using memory allocation. | |
| AllocatedVector (const AllocatedVector &other, const AllocatorContext &ac) | |
| This copy constructor variant allows to specify a custom AllocatorContext. | |
| AllocatedVector (size_type n, T *buffer) | |
| This constructor builds a vector on an already allocated buffer. | |
| ~AllocatedVector () | |
| size_type | size () const |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
| T & | operator[] (size_type i) |
| const T & | operator[] (size_type i) const |
| AllocatedVector & | operator= (const AllocatedVector &) |
| The copy operator uses a "standard" AllocatorContext using memory allocation. | |
| void | copy (const AllocatedVector &, const AllocatorContext &) |
| contrarily to operator = (), this copy function may use a different allocator, which may be the copied vector allocator. | |
| const AllocatorContext & | allocatorContext () const |
| void | free () |
| void | allocate (size_type n, const AllocatorContext &ac) |
A STL-like vector with a smart and slow allocation system for large data buffers.
AllocatedVector is a fixed-size vector (no push_back(), insert() functions, nor reallocation method) which is suitable for very large data that may need the use of memory mapping and/or partial input/output functionalities. However for small data blocks, this container class is not optimal, because the allocation system is rather slow when repeatedly used many times.
Otherwise, AllocatedVector works like a std::vector, or rather like a block.
The allocation system uses an allocation context (AllocatorContext) to automatically switch to the most suitable type of allocation (or memory mapping). This system is describe in the Allocators system section.
Definition at line 62 of file allocatedvector.h.
| typedef const T* soma::AllocatedVector< T >::const_iterator |
Definition at line 67 of file allocatedvector.h.
| typedef T* soma::AllocatedVector< T >::iterator |
Definition at line 66 of file allocatedvector.h.
| typedef size_t soma::AllocatedVector< T >::size_type |
Definition at line 65 of file allocatedvector.h.
|
inline |
Definition at line 113 of file allocatedvector.h.
References allocate(), and AllocatedVector().
Referenced by AllocatedVector(), AllocatedVector(), AllocatedVector(), AllocatedVector(), copy(), operator=(), operator[](), and operator[]().
|
inline |
The copy constructor uses a "standard" AllocatorContext using memory allocation.
Definition at line 121 of file allocatedvector.h.
References allocate(), AllocatedVector(), soma::AllocatorContext::isAllocated(), soma::AllocatorStrategy::ReadOnlyMap, and size().
|
inline |
This copy constructor variant allows to specify a custom AllocatorContext.
Definition at line 137 of file allocatedvector.h.
References allocate(), AllocatedVector(), soma::AllocatorContext::isAllocated(), soma::AllocatorStrategy::ReadOnlyMap, and size().
|
inline |
This constructor builds a vector on an already allocated buffer.
The vector is not owner of the underlying data.
Definition at line 154 of file allocatedvector.h.
References allocate(), and AllocatedVector().
|
inline |
Definition at line 166 of file allocatedvector.h.
References free(), and ~AllocatedVector().
Referenced by ~AllocatedVector().
|
inline |
Definition at line 178 of file allocatedvector.h.
References allocate(), soma::AllocatorContext::allocate(), and free().
Referenced by allocate(), AllocatedVector(), AllocatedVector(), AllocatedVector(), AllocatedVector(), and copy().
|
inline |
Definition at line 172 of file allocatedvector.h.
References allocatorContext().
Referenced by allocatorContext().
|
inline |
|
inline |
Definition at line 236 of file allocatedvector.h.
References begin().
|
inline |
contrarily to operator = (), this copy function may use a different allocator, which may be the copied vector allocator.
Definition at line 210 of file allocatedvector.h.
References allocate(), AllocatedVector(), begin(), copy(), end(), soma::AllocatorContext::isAllocated(), soma::AllocatorStrategy::ReadOnlyMap, and size().
Referenced by copy(), and operator=().
|
inline |
|
inline |
Definition at line 248 of file allocatedvector.h.
References end().
|
inline |
Definition at line 188 of file allocatedvector.h.
References free().
Referenced by allocate(), free(), and ~AllocatedVector().
|
inline |
The copy operator uses a "standard" AllocatorContext using memory allocation.
Definition at line 203 of file allocatedvector.h.
References AllocatedVector(), and copy().
|
inline |
Definition at line 254 of file allocatedvector.h.
References AllocatedVector().
|
inline |
Definition at line 260 of file allocatedvector.h.
References AllocatedVector().
|
inline |
Definition at line 196 of file allocatedvector.h.
References size().
Referenced by AllocatedVector(), AllocatedVector(), copy(), and size().