34 #ifndef SOMAIO_UTILITIES_ALLOCATEDVECTOR_H
35 #define SOMAIO_UTILITIES_ALLOCATEDVECTOR_H
112 template<
typename T>
inline
115 : _allocatorContext( ac ), _size( n ),
116 _items( _allocatorContext.allocate( _items, n ) )
120 template<
typename T>
inline
122 : _allocatorContext(), _size( other.size() ),
123 _items( _allocatorContext.allocate( _items, _size ) )
131 for( i =
begin(); i != e; ++i, ++j )
136 template<
typename T>
inline
139 : _allocatorContext( ac ), _size( other.size() ),
140 _items( _allocatorContext.allocate( _items, _size ) )
148 for( i =
begin(); i != e; ++i, ++j )
153 template<
typename T>
inline
158 ( buffer ), n * sizeof( T ),
161 _items( _allocatorContext.allocate( _items, _size ) )
165 template<
typename T>
inline
171 template<
typename T>
inline
174 return _allocatorContext;
177 template<
typename T>
inline
183 _allocatorContext = ac;
184 _items = _allocatorContext.
allocate( _items, n );
187 template<
typename T>
inline
190 _allocatorContext.deallocate( _items, _size );
195 template<
typename T>
inline
201 template<
typename T>
inline
209 template<
typename T>
inline
215 allocate( other.
size(), ac );
217 && _allocatorContext.isAllocated()
222 for( i = begin(); i != e; ++i, ++j )
228 template<
typename T>
inline
234 template<
typename T>
inline
241 template<
typename T>
inline
244 return _items + _size;
247 template<
typename T>
inline
250 return _items + _size;
253 template<
typename T>
inline
259 template<
typename T>
inline
A STL-like vector with a smart and slow allocation system for large data buffers.
AllocatedVector(size_type n, const AllocatorContext &ac)
void copy(const AllocatedVector &, const AllocatorContext &)
contrarily to operator = (), this copy function may use a different allocator, which may be the copie...
const AllocatorContext & allocatorContext() const
AllocatedVector & operator=(const AllocatedVector &)
The copy operator uses a "standard" AllocatorContext using memory allocation.
T & operator[](size_type i)
void allocate(size_type n, const AllocatorContext &ac)
MappingMode allocatorType() const
T * allocate(T *&ptr, size_t n) const
return value is the same as modifiable input param ptr
Determination of the allocation type depending of the buffer size to allocate and the disk format of ...
Abstraction layer for various data sources (file, buffer, socket...).