Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::interprocess::allocator< T, SegmentManager > Singleton Reference

An STL compatible allocator that uses a segment manager as memory source. More...

#include <interprocess_fwd.hpp>

Inheritance diagram for boost::interprocess::allocator< T, SegmentManager >:

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_managerget_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...
 

Detailed Description

template<class T, class SegmentManager>
singleton boost::interprocess::allocator< T, SegmentManager >

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...

Member Typedef Documentation

template<class T, class SegmentManager>
typedef boost::intrusive:: pointer_traits<pointer>::template rebind_pointer<const T>::type boost::interprocess::allocator< T, SegmentManager >::const_pointer
template<class T, class SegmentManager>
typedef ipcdetail::add_reference<const value_type>::type boost::interprocess::allocator< T, SegmentManager >::const_reference
template<class T, class SegmentManager>
typedef segment_manager::difference_type boost::interprocess::allocator< T, SegmentManager >::difference_type
template<class T, class SegmentManager>
typedef boost::container::container_detail::transform_multiallocation_chain<typename SegmentManager::multiallocation_chain, T> boost::interprocess::allocator< T, SegmentManager >::multiallocation_chain
template<class T, class SegmentManager>
typedef boost::intrusive:: pointer_traits<cvoid_ptr>::template rebind_pointer<T>::type boost::interprocess::allocator< T, SegmentManager >::pointer
template<class T, class SegmentManager>
typedef ipcdetail::add_reference<value_type>::type boost::interprocess::allocator< T, SegmentManager >::reference
template<class T, class SegmentManager>
typedef SegmentManager boost::interprocess::allocator< T, SegmentManager >::segment_manager
template<class T, class SegmentManager>
typedef segment_manager::size_type boost::interprocess::allocator< T, SegmentManager >::size_type
template<class T, class SegmentManager>
typedef T boost::interprocess::allocator< T, SegmentManager >::value_type
template<class T, class SegmentManager>
typedef boost::interprocess::version_type<allocator, 2> boost::interprocess::allocator< T, SegmentManager >::version
template<class T, class SegmentManager>
typedef SegmentManager::void_pointer boost::interprocess::allocator< T, SegmentManager >::void_pointer

Constructor & Destructor Documentation

template<class T, class SegmentManager>
boost::interprocess::allocator< T, SegmentManager >::allocator ( segment_manager segment_mngr)
inline

Constructor from the segment manager.

Never throws

template<class T, class SegmentManager>
boost::interprocess::allocator< T, SegmentManager >::allocator ( const allocator< T, SegmentManager > &  other)
inline

Constructor from other allocator.

Never throws

template<class T, class SegmentManager>
template<class T2 >
boost::interprocess::allocator< T, SegmentManager >::allocator ( const allocator< T2, SegmentManager > &  other)
inline

Constructor from related allocator.

Never throws

Member Function Documentation

template<class T, class SegmentManager>
pointer boost::interprocess::allocator< T, SegmentManager >::address ( reference  value) const
inline

Returns address of mutable object.

Never throws

template<class T, class SegmentManager>
const_pointer boost::interprocess::allocator< T, SegmentManager >::address ( const_reference  value) const
inline

Returns address of non mutable object.

Never throws

template<class T, class SegmentManager>
pointer boost::interprocess::allocator< T, SegmentManager >::allocate ( size_type  count,
cvoid_ptr  hint = 0 
)
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().

template<class T, class SegmentManager>
void boost::interprocess::allocator< T, SegmentManager >::allocate_individual ( size_type  num_elements,
multiallocation_chain chain 
)
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().

template<class T, class SegmentManager>
void boost::interprocess::allocator< T, SegmentManager >::allocate_many ( size_type  elem_size,
size_type  num_elements,
multiallocation_chain chain 
)
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().

template<class T, class SegmentManager>
void boost::interprocess::allocator< T, SegmentManager >::allocate_many ( const size_type elem_sizes,
size_type  n_elements,
multiallocation_chain chain 
)
inline

Allocates n_elements elements, each one of size elem_sizes[i]in a contiguous block of memory.

The elements must be deallocated

template<class T, class SegmentManager>
pointer boost::interprocess::allocator< T, SegmentManager >::allocate_one ( )
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

template<class T, class SegmentManager>
std::pair<pointer, bool> boost::interprocess::allocator< T, SegmentManager >::allocation_command ( boost::interprocess::allocation_type  command,
size_type  limit_size,
size_type  preferred_size,
size_type received_size,
const pointer reuse = 0 
)
inline
template<class T, class SegmentManager>
template<class P >
void boost::interprocess::allocator< T, SegmentManager >::construct ( const pointer ptr,
BOOST_FWD_REF(P)  p 
)
inline

Constructs an object Throws if T's constructor throws For backwards compatibility with libraries using C++03 allocators.

template<class T, class SegmentManager>
void boost::interprocess::allocator< T, SegmentManager >::deallocate ( const pointer ptr,
size_type   
)
inline

Deallocates memory previously allocated.

Never throws

Referenced by boost::interprocess::allocator< bucket_type, segment_manager_base >::deallocate_one().

template<class T, class SegmentManager>
void boost::interprocess::allocator< T, SegmentManager >::deallocate_individual ( multiallocation_chain chain)
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().

template<class T, class SegmentManager>
void boost::interprocess::allocator< T, SegmentManager >::deallocate_many ( multiallocation_chain chain)
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().

template<class T, class SegmentManager>
void boost::interprocess::allocator< T, SegmentManager >::deallocate_one ( const pointer p)
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

template<class T, class SegmentManager>
void boost::interprocess::allocator< T, SegmentManager >::destroy ( const pointer ptr)
inline

Destroys object.

Throws if object's destructor throws

template<class T, class SegmentManager>
segment_manager* boost::interprocess::allocator< T, SegmentManager >::get_segment_manager ( ) const
inline

Returns the segment manager.

Never throws

Referenced by boost::interprocess::operator!=(), and boost::interprocess::operator==().

template<class T, class SegmentManager>
size_type boost::interprocess::allocator< T, SegmentManager >::max_size ( void  ) const
inline

Returns the number of elements that could be allocated.

Never throws

template<class T, class SegmentManager>
size_type boost::interprocess::allocator< T, SegmentManager >::size ( const pointer p) const
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.

Friends And Related Function Documentation

template<class T, class SegmentManager>
void swap ( self_t alloc1,
self_t alloc2 
)
friend

Swap segment manager.

Does not throw. If each allocator is placed in different memory segments, the result is undefined.


The documentation for this singleton was generated from the following file: