An STL compatible allocator that uses a segment manager as memory source. More...
#include <interprocess_fwd.hpp>
Classes | |
struct | rebind |
Obtains an allocator that allocates objects of type T2. More... | |
Public Types | |
typedef SegmentManager | segment_manager |
typedef SegmentManager::void_pointer | void_pointer |
typedef T | value_type |
typedef boost::intrusive::pointer_traits < cvoid_ptr >::template rebind_pointer< T >::type | pointer |
typedef boost::intrusive::pointer_traits < pointer >::template rebind_pointer< const T > ::type | const_pointer |
typedef ipcdetail::add_reference < value_type >::type | reference |
typedef ipcdetail::add_reference < const value_type >::type | const_reference |
typedef segment_manager::size_type | size_type |
typedef segment_manager::difference_type | difference_type |
typedef boost::interprocess::version_type < allocator, 2 > | version |
typedef boost::container::container_detail::transform_multiallocation_chain < typename SegmentManager::multiallocation_chain, T > | multiallocation_chain |
Public Member Functions | |
segment_manager * | get_segment_manager () const |
Returns the segment manager. More... | |
allocator (segment_manager *segment_mngr) | |
Constructor from the segment manager. More... | |
allocator (const allocator &other) | |
Constructor from other allocator. More... | |
template<class T2 > | |
allocator (const allocator< T2, SegmentManager > &other) | |
Constructor from related allocator. More... | |
pointer | allocate (size_type count, cvoid_ptr hint=0) |
Allocates memory for an array of count elements. More... | |
void | deallocate (const pointer &ptr, size_type) |
Deallocates memory previously allocated. More... | |
size_type | max_size () const |
Returns the number of elements that could be allocated. More... | |
size_type | size (const pointer &p) const |
Returns maximum the number of objects the previously allocated memory pointed by p can hold. More... | |
std::pair< pointer, bool > | allocation_command (boost::interprocess::allocation_type command, size_type limit_size, size_type preferred_size, size_type &received_size, const pointer &reuse=0) |
void | allocate_many (size_type elem_size, size_type num_elements, multiallocation_chain &chain) |
Allocates many elements of size elem_size in a contiguous block of memory. More... | |
void | allocate_many (const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) |
Allocates n_elements elements, each one of size elem_sizes[i]in a contiguous block of memory. More... | |
void | deallocate_many (multiallocation_chain &chain) |
Allocates many elements of size elem_size in a contiguous block of memory. More... | |
pointer | allocate_one () |
Allocates just one object. More... | |
void | allocate_individual (size_type num_elements, multiallocation_chain &chain) |
Allocates many elements of size == 1 in a contiguous block of memory. More... | |
void | deallocate_one (const pointer &p) |
Deallocates memory previously allocated with allocate_one(). More... | |
void | deallocate_individual (multiallocation_chain &chain) |
Allocates many elements of size == 1 in a contiguous block of memory. More... | |
pointer | address (reference value) const |
Returns address of mutable object. More... | |
const_pointer | address (const_reference value) const |
Returns address of non mutable object. More... | |
template<class P > | |
void | construct (const pointer &ptr, BOOST_FWD_REF(P) p) |
Constructs an object Throws if T's constructor throws For backwards compatibility with libraries using C++03 allocators. More... | |
void | destroy (const pointer &ptr) |
Destroys object. More... | |
Friends | |
void | swap (self_t &alloc1, self_t &alloc2) |
Swap segment manager. More... | |
An STL compatible allocator that uses a segment manager as memory source.
The internal pointer type will of the same type (raw, smart) as "typename SegmentManager::void_pointer" type. This allows placing the allocator in shared memory, memory mapped-files, etc...
typedef boost::intrusive:: pointer_traits<pointer>::template rebind_pointer<const T>::type boost::interprocess::allocator< T, SegmentManager >::const_pointer |
typedef ipcdetail::add_reference<const value_type>::type boost::interprocess::allocator< T, SegmentManager >::const_reference |
typedef segment_manager::difference_type boost::interprocess::allocator< T, SegmentManager >::difference_type |
typedef boost::container::container_detail::transform_multiallocation_chain<typename SegmentManager::multiallocation_chain, T> boost::interprocess::allocator< T, SegmentManager >::multiallocation_chain |
typedef boost::intrusive:: pointer_traits<cvoid_ptr>::template rebind_pointer<T>::type boost::interprocess::allocator< T, SegmentManager >::pointer |
typedef ipcdetail::add_reference<value_type>::type boost::interprocess::allocator< T, SegmentManager >::reference |
typedef SegmentManager boost::interprocess::allocator< T, SegmentManager >::segment_manager |
typedef segment_manager::size_type boost::interprocess::allocator< T, SegmentManager >::size_type |
typedef T boost::interprocess::allocator< T, SegmentManager >::value_type |
typedef boost::interprocess::version_type<allocator, 2> boost::interprocess::allocator< T, SegmentManager >::version |
typedef SegmentManager::void_pointer boost::interprocess::allocator< T, SegmentManager >::void_pointer |
|
inline |
Constructor from the segment manager.
Never throws
|
inline |
Constructor from other allocator.
Never throws
|
inline |
Constructor from related allocator.
Never throws
|
inline |
Returns address of mutable object.
Never throws
|
inline |
Returns address of non mutable object.
Never throws
|
inline |
Allocates memory for an array of count elements.
Throws boost::interprocess::bad_alloc if there is no enough memory
Referenced by boost::interprocess::allocator< bucket_type, segment_manager_base >::allocate_one().
|
inline |
Allocates many elements of size == 1 in a contiguous block of memory.
The minimum number to be allocated is min_elements, the preferred and maximum number is preferred_elements. The number of actually allocated elements is will be assigned to received_size. Memory allocated with this function must be deallocated only with deallocate_one().
|
inline |
Allocates many elements of size elem_size in a contiguous block of memory.
The minimum number to be allocated is min_elements, the preferred and maximum number is preferred_elements. The number of actually allocated elements is will be assigned to received_size. The elements must be deallocated with deallocate(...)
Referenced by boost::interprocess::allocator< bucket_type, segment_manager_base >::allocate_individual().
|
inline |
Allocates n_elements elements, each one of size elem_sizes[i]in a contiguous block of memory.
The elements must be deallocated
|
inline |
Allocates just one object.
Memory allocated with this function must be deallocated only with deallocate_one(). Throws boost::interprocess::bad_alloc if there is no enough memory
|
inline |
|
inline |
Constructs an object Throws if T's constructor throws For backwards compatibility with libraries using C++03 allocators.
|
inline |
Deallocates memory previously allocated.
Never throws
Referenced by boost::interprocess::allocator< bucket_type, segment_manager_base >::deallocate_one().
|
inline |
Allocates many elements of size == 1 in a contiguous block of memory.
The minimum number to be allocated is min_elements, the preferred and maximum number is preferred_elements. The number of actually allocated elements is will be assigned to received_size. Memory allocated with this function must be deallocated only with deallocate_one().
|
inline |
Allocates many elements of size elem_size in a contiguous block of memory.
The minimum number to be allocated is min_elements, the preferred and maximum number is preferred_elements. The number of actually allocated elements is will be assigned to received_size. The elements must be deallocated with deallocate(...)
Referenced by boost::interprocess::allocator< bucket_type, segment_manager_base >::deallocate_individual().
|
inline |
Deallocates memory previously allocated with allocate_one().
You should never use deallocate_one to deallocate memory allocated with other functions different from allocate_one(). Never throws
|
inline |
Destroys object.
Throws if object's destructor throws
|
inline |
Returns the segment manager.
Never throws
Referenced by boost::interprocess::operator!=(), and boost::interprocess::operator==().
|
inline |
Returns the number of elements that could be allocated.
Never throws
|
inline |
Returns maximum the number of objects the previously allocated memory pointed by p can hold.
This size only works for memory allocated with allocate, allocation_command and allocate_many.
Swap segment manager.
Does not throw. If each allocator is placed in different memory segments, the result is undefined.