Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::interprocess::segment_manager_base< MemoryAlgorithm > Class Template Reference

This object is the public base class of segment manager. More...

#include <segment_manager.hpp>

Inheritance diagram for boost::interprocess::segment_manager_base< MemoryAlgorithm >:
Collaboration diagram for boost::interprocess::segment_manager_base< MemoryAlgorithm >:

Public Types

typedef segment_manager_base
< MemoryAlgorithm > 
segment_manager_base_type
 
typedef
MemoryAlgorithm::void_pointer 
void_pointer
 
typedef
MemoryAlgorithm::mutex_family 
mutex_family
 
typedef MemoryAlgorithm memory_algorithm
 
typedef
MemoryAlgorithm::multiallocation_chain 
multiallocation_chain
 
typedef
MemoryAlgorithm::difference_type 
difference_type
 
typedef MemoryAlgorithm::size_type size_type
 

Public Member Functions

 segment_manager_base (size_type sz, size_type reserved_bytes)
 Constructor of the segment_manager_base. More...
 
size_type get_size () const
 Returns the size of the memory segment. More...
 
size_type get_free_memory () const
 Returns the number of free bytes of the memory segment. More...
 
void * allocate (size_type nbytes, std::nothrow_t)
 Allocates nbytes bytes. More...
 
void allocate_many (size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
 Allocates n_elements of elem_bytes bytes. More...
 
void allocate_many (const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
 Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes. More...
 
void allocate_many (std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
 Allocates n_elements of elem_bytes bytes. More...
 
void allocate_many (std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
 Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes. More...
 
void deallocate_many (multiallocation_chain &chain)
 Deallocates all elements contained in chain. More...
 
void * allocate (size_type nbytes)
 Allocates nbytes bytes. More...
 
void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t)
 Allocates nbytes bytes. More...
 
void * allocate_aligned (size_type nbytes, size_type alignment)
 Allocates nbytes bytes. More...
 
template<class T >
std::pair< T *, bool > allocation_command (boost::interprocess::allocation_type command, size_type limit_size, size_type preferred_size, size_type &received_size, T *reuse_ptr=0)
 
std::pair< void *, bool > raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects, size_type preferred_objects, size_type &received_objects, void *reuse_ptr=0, size_type sizeof_object=1)
 
void deallocate (void *addr)
 Deallocates the bytes allocated with allocate/allocate_many() pointed by addr. More...
 
void grow (size_type extra_size)
 Increases managed memory in extra_size bytes more. More...
 
void shrink_to_fit ()
 Decreases managed memory to the minimum. More...
 
bool all_memory_deallocated ()
 Returns the result of "all_memory_deallocated()" function of the used memory algorithm. More...
 
bool check_sanity ()
 Returns the result of "check_sanity()" function of the used memory algorithm. More...
 
void zero_free_memory ()
 Writes to zero free memory (memory not yet allocated) of the memory algorithm. More...
 
size_type size (const void *ptr) const
 Returns the size of the buffer previously allocated pointed by ptr. More...
 

Static Public Member Functions

static size_type get_min_size (size_type size)
 Obtains the minimum size needed by the segment manager. More...
 

Static Public Attributes

static const size_type PayloadPerAllocation = MemoryAlgorithm::PayloadPerAllocation
 This constant indicates the payload size associated with each allocation of the memory algorithm. More...
 

Protected Member Functions

void * prot_anonymous_construct (size_type num, bool dothrow, ipcdetail::in_place_interface &table)
 
void prot_anonymous_destroy (const void *object, ipcdetail::in_place_interface &table)
 Calls the destructor and makes an anonymous deallocate. More...
 

Detailed Description

template<class MemoryAlgorithm>
class boost::interprocess::segment_manager_base< MemoryAlgorithm >

This object is the public base class of segment manager.

This class only depends on the memory allocation algorithm and implements all the allocation features not related to named or unique objects.

Storing a reference to segment_manager forces the holder class to be dependent on index types and character types. When such dependence is not desirable and only anonymous and raw allocations are needed, segment_manager_base is the correct answer.

Member Typedef Documentation

template<class MemoryAlgorithm >
typedef MemoryAlgorithm::difference_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::difference_type
template<class MemoryAlgorithm >
typedef MemoryAlgorithm boost::interprocess::segment_manager_base< MemoryAlgorithm >::memory_algorithm
template<class MemoryAlgorithm >
typedef MemoryAlgorithm::multiallocation_chain boost::interprocess::segment_manager_base< MemoryAlgorithm >::multiallocation_chain
template<class MemoryAlgorithm >
typedef MemoryAlgorithm::mutex_family boost::interprocess::segment_manager_base< MemoryAlgorithm >::mutex_family
template<class MemoryAlgorithm >
typedef segment_manager_base<MemoryAlgorithm> boost::interprocess::segment_manager_base< MemoryAlgorithm >::segment_manager_base_type
template<class MemoryAlgorithm >
typedef MemoryAlgorithm::size_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::size_type
template<class MemoryAlgorithm >
typedef MemoryAlgorithm::void_pointer boost::interprocess::segment_manager_base< MemoryAlgorithm >::void_pointer

Constructor & Destructor Documentation

template<class MemoryAlgorithm >
boost::interprocess::segment_manager_base< MemoryAlgorithm >::segment_manager_base ( size_type  sz,
size_type  reserved_bytes 
)
inline

Constructor of the segment_manager_base.

"size" is the size of the memory segment where the basic segment manager is being constructed.

"reserved_bytes" is the number of bytes after the end of the memory algorithm object itself that the memory algorithm will exclude from dynamic allocation

Can throw

References BOOST_ASSERT.

Member Function Documentation

template<class MemoryAlgorithm >
bool boost::interprocess::segment_manager_base< MemoryAlgorithm >::all_memory_deallocated ( )
inline

Returns the result of "all_memory_deallocated()" function of the used memory algorithm.

template<class MemoryAlgorithm >
void* boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocate ( size_type  nbytes,
std::nothrow_t   
)
inline

Allocates nbytes bytes.

This function is only used in single-segment management. Never throws

Referenced by boost::interprocess::segment_manager_base< MemoryAlgorithm >::prot_anonymous_construct().

template<class MemoryAlgorithm >
void* boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocate ( size_type  nbytes)
inline

Allocates nbytes bytes.

Throws boost::interprocess::bad_alloc on failure

template<class MemoryAlgorithm >
void* boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocate_aligned ( size_type  nbytes,
size_type  alignment,
std::nothrow_t   
)
inline

Allocates nbytes bytes.

This function is only used in single-segment management. Never throws

template<class MemoryAlgorithm >
void* boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocate_aligned ( size_type  nbytes,
size_type  alignment 
)
inline

Allocates nbytes bytes.

This function is only used in single-segment management. Throws bad_alloc when fails

template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocate_many ( size_type  elem_bytes,
size_type  n_elements,
multiallocation_chain chain 
)
inline

Allocates n_elements of elem_bytes bytes.

Throws bad_alloc on failure. chain.size() is not increased on failure.

template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocate_many ( const size_type element_lengths,
size_type  n_elements,
size_type  sizeof_element,
multiallocation_chain chain 
)
inline

Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes.

Throws bad_alloc on failure. chain.size() is not increased on failure.

template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocate_many ( std::nothrow_t  ,
size_type  elem_bytes,
size_type  n_elements,
multiallocation_chain chain 
)
inline

Allocates n_elements of elem_bytes bytes.

Non-throwing version. chain.size() is not increased on failure.

template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocate_many ( std::nothrow_t  ,
const size_type elem_sizes,
size_type  n_elements,
size_type  sizeof_element,
multiallocation_chain chain 
)
inline

Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes.

Non-throwing version. chain.size() is not increased on failure.

template<class MemoryAlgorithm >
template<class T >
std::pair<T *, bool> boost::interprocess::segment_manager_base< MemoryAlgorithm >::allocation_command ( boost::interprocess::allocation_type  command,
size_type  limit_size,
size_type  preferred_size,
size_type received_size,
T reuse_ptr = 0 
)
inline
template<class MemoryAlgorithm >
bool boost::interprocess::segment_manager_base< MemoryAlgorithm >::check_sanity ( )
inline

Returns the result of "check_sanity()" function of the used memory algorithm.

template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::deallocate ( void *  addr)
inline

Deallocates the bytes allocated with allocate/allocate_many() pointed by addr.

Referenced by boost::interprocess::segment_manager_base< MemoryAlgorithm >::prot_anonymous_destroy().

template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::deallocate_many ( multiallocation_chain chain)
inline

Deallocates all elements contained in chain.

Never throws.

template<class MemoryAlgorithm >
size_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::get_free_memory ( ) const
inline

Returns the number of free bytes of the memory segment.

template<class MemoryAlgorithm >
static size_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::get_min_size ( size_type  size)
inlinestatic

Obtains the minimum size needed by the segment manager.

Referenced by boost::interprocess::segment_manager< CharType, MemoryAlgorithm, IndexType >::get_min_size().

template<class MemoryAlgorithm >
size_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::get_size ( ) const
inline

Returns the size of the memory segment.

template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::grow ( size_type  extra_size)
inline

Increases managed memory in extra_size bytes more.

This only works with single-segment management.

template<class MemoryAlgorithm >
void* boost::interprocess::segment_manager_base< MemoryAlgorithm >::prot_anonymous_construct ( size_type  num,
bool  dothrow,
ipcdetail::in_place_interface &  table 
)
inlineprotected
template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::prot_anonymous_destroy ( const void *  object,
ipcdetail::in_place_interface &  table 
)
inlineprotected

Calls the destructor and makes an anonymous deallocate.

References BOOST_ASSERT, and boost::interprocess::segment_manager_base< MemoryAlgorithm >::deallocate().

template<class MemoryAlgorithm >
std::pair<void *, bool> boost::interprocess::segment_manager_base< MemoryAlgorithm >::raw_allocation_command ( boost::interprocess::allocation_type  command,
size_type  limit_objects,
size_type  preferred_objects,
size_type received_objects,
void *  reuse_ptr = 0,
size_type  sizeof_object = 1 
)
inline
template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::shrink_to_fit ( )
inline

Decreases managed memory to the minimum.

This only works with single-segment management.

template<class MemoryAlgorithm >
size_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::size ( const void *  ptr) const
inline

Returns the size of the buffer previously allocated pointed by ptr.

References boost::fusion::size().

template<class MemoryAlgorithm >
void boost::interprocess::segment_manager_base< MemoryAlgorithm >::zero_free_memory ( )
inline

Writes to zero free memory (memory not yet allocated) of the memory algorithm.

Member Data Documentation

template<class MemoryAlgorithm >
const size_type boost::interprocess::segment_manager_base< MemoryAlgorithm >::PayloadPerAllocation = MemoryAlgorithm::PayloadPerAllocation
static

This constant indicates the payload size associated with each allocation of the memory algorithm.


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