soma-io
5.1.2
|
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. More... | |
AllocatedVector (const AllocatedVector &other, const AllocatorContext &ac) | |
This copy constructor variant allows to specify a custom AllocatorContext. More... | |
AllocatedVector (size_type n, T *buffer) | |
This constructor builds a vector on an already allocated buffer. More... | |
~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. More... | |
void | copy (const AllocatedVector &, const AllocatorContext &) |
contrarily to operator = (), this copy function may use a different allocator, which may be the copied vector allocator. More... | |
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.
|
inline |
The copy constructor uses a "standard" AllocatorContext using memory allocation.
Definition at line 121 of file allocatedvector.h.
References soma::AllocatorContext::allocatorType(), soma::AllocatedVector< T >::begin(), soma::AllocatedVector< T >::end(), soma::AllocatorContext::isAllocated(), and soma::AllocatorStrategy::ReadOnlyMap.
|
inline |
This copy constructor variant allows to specify a custom AllocatorContext.
Definition at line 137 of file allocatedvector.h.
References soma::AllocatorContext::allocatorType(), soma::AllocatedVector< T >::begin(), soma::AllocatedVector< T >::end(), soma::AllocatorContext::isAllocated(), and soma::AllocatorStrategy::ReadOnlyMap.
|
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.
|
inline |
Definition at line 166 of file allocatedvector.h.
|
inline |
Definition at line 178 of file allocatedvector.h.
References soma::AllocatorContext::allocate().
|
inline |
Definition at line 172 of file allocatedvector.h.
|
inline |
Definition at line 229 of file allocatedvector.h.
Referenced by soma::AllocatedVector< T >::AllocatedVector(), and soma::AllocatedVector< T >::copy().
|
inline |
Definition at line 236 of file allocatedvector.h.
|
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 soma::AllocatedVector< T >::begin(), soma::AllocatorContext::isAllocated(), soma::AllocatorStrategy::ReadOnlyMap, and soma::AllocatedVector< T >::size().
|
inline |
Definition at line 242 of file allocatedvector.h.
Referenced by soma::AllocatedVector< T >::AllocatedVector().
|
inline |
Definition at line 248 of file allocatedvector.h.
|
inline |
Definition at line 188 of file allocatedvector.h.
|
inline |
The copy operator uses a "standard" AllocatorContext using memory allocation.
Definition at line 203 of file allocatedvector.h.
|
inline |
Definition at line 254 of file allocatedvector.h.
|
inline |
Definition at line 260 of file allocatedvector.h.
|
inline |
Definition at line 196 of file allocatedvector.h.
Referenced by soma::AllocatedVector< T >::copy().