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

This class implements an algorithm that stores the free nodes in a red-black tree to have logarithmic search/insert times. More...

#include <rbtree_best_fit.hpp>

Public Types

typedef MutexFamily mutex_family
 Shared mutex family used for the rest of the Interprocess framework. More...
 
typedef VoidPointer void_pointer
 Pointer type to be used with the rest of the Interprocess framework. More...
 
typedef
ipcdetail::basic_multiallocation_chain
< VoidPointer > 
multiallocation_chain
 
typedef
boost::intrusive::pointer_traits
< char_ptr >::difference_type 
difference_type
 
typedef boost::make_unsigned
< difference_type >::type 
size_type
 

Public Member Functions

 rbtree_best_fit (size_type size, size_type extra_hdr_bytes)
 Constructor. More...
 
 ~rbtree_best_fit ()
 Destructor. More...
 
void * allocate (size_type nbytes)
 Allocates bytes, returns 0 if there is not more memory. More...
 
void allocate_many (size_type elem_bytes, size_type num_elements, multiallocation_chain &chain)
 Multiple element allocation, same size. More...
 
void allocate_many (const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
 Multiple element allocation, different size. More...
 
void deallocate_many (multiallocation_chain &chain)
 Multiple element allocation, different size. More...
 
void deallocate (void *addr)
 Deallocates previously allocated bytes. 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 segment. More...
 
void zero_free_memory ()
 Initializes to zero all the memory that's not in use. More...
 
void grow (size_type extra_size)
 Increases managed memory in extra_size bytes more. More...
 
void shrink_to_fit ()
 Decreases managed memory as much as possible. More...
 
bool all_memory_deallocated ()
 Returns true if all allocated memory has been deallocated. More...
 
bool check_sanity ()
 Makes an internal sanity check and returns true if success. 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_object, size_type preferred_object, size_type &received_object, void *reuse_ptr=0, size_type sizeof_object=1)
 
size_type size (const void *ptr) const
 Returns the size of the buffer previously allocated pointed by ptr. More...
 
void * allocate_aligned (size_type nbytes, size_type alignment)
 Allocates aligned bytes, returns 0 if there is not more memory. More...
 

Static Public Member Functions

static size_type get_min_size (size_type extra_hdr_bytes)
 Obtains the minimum size needed by the algorithm. More...
 

Static Public Attributes

static const size_type Alignment
 
static const size_type PayloadPerAllocation = AllocatedCtrlBytes - UsableByPreviousChunk
 

Friends

class ipcdetail::memory_algorithm_common< rbtree_best_fit >
 

Detailed Description

template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
class boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >

This class implements an algorithm that stores the free nodes in a red-black tree to have logarithmic search/insert times.

Member Typedef Documentation

template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
typedef boost::intrusive::pointer_traits<char_ptr>::difference_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::difference_type
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
typedef ipcdetail::basic_multiallocation_chain<VoidPointer> boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::multiallocation_chain
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
typedef MutexFamily boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::mutex_family

Shared mutex family used for the rest of the Interprocess framework.

template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
typedef boost::make_unsigned<difference_type>::type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size_type
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
typedef VoidPointer boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::void_pointer

Pointer type to be used with the rest of the Interprocess framework.

Constructor & Destructor Documentation

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::rbtree_best_fit ( size_type  size,
size_type  extra_hdr_bytes 
)
inline

Constructor.

"size" is the total size of the managed memory segment, "extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(rbtree_best_fit) offset that the allocator should not use at all.

References BOOST_ASSERT.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::~rbtree_best_fit ( )
inline

Destructor.

Member Function Documentation

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
bool boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::all_memory_deallocated ( )
inline

Returns true if all allocated memory has been deallocated.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
void * boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::allocate ( size_type  nbytes)
inline

Allocates bytes, returns 0 if there is not more memory.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
void * boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::allocate_aligned ( size_type  nbytes,
size_type  alignment 
)
inline

Allocates aligned bytes, returns 0 if there is not more memory.

Alignment must be power of 2

template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::allocate_many ( size_type  elem_bytes,
size_type  num_elements,
multiallocation_chain chain 
)
inline

Multiple element allocation, same size.

template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::allocate_many ( const size_type elem_sizes,
size_type  n_elements,
size_type  sizeof_element,
multiallocation_chain chain 
)
inline

Multiple element allocation, different size.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
template<class T >
std::pair< T *, bool > boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::allocation_command ( boost::interprocess::allocation_type  command,
size_type  limit_size,
size_type  preferred_size,
size_type received_size,
T reuse_ptr = 0 
)
inline

References BOOST_ASSERT, and T.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
bool boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::check_sanity ( )

Makes an internal sanity check and returns true if success.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::deallocate ( void *  addr)

Deallocates previously allocated bytes.

template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::deallocate_many ( multiallocation_chain chain)
inline

Multiple element allocation, different size.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::get_free_memory ( ) const

Returns the number of free bytes of the segment.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::get_min_size ( size_type  extra_hdr_bytes)
static

Obtains the minimum size needed by the algorithm.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::get_size ( ) const
inline

Returns the size of the memory segment.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::grow ( size_type  extra_size)

Increases managed memory in extra_size bytes more.

References BOOST_ASSERT, and boost::multiprecision::backends::this.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
std::pair< void *, bool > boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::raw_allocation_command ( boost::interprocess::allocation_type  command,
size_type  limit_object,
size_type  preferred_object,
size_type received_object,
void *  reuse_ptr = 0,
size_type  sizeof_object = 1 
)
inline
template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::shrink_to_fit ( )

Decreases managed memory as much as possible.

References BOOST_ASSERT, and boost::detail::void.

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::size ( const void *  ptr) const

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

template<class MutexFamily , class VoidPointer , std::size_t MemAlignment>
void boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::zero_free_memory ( )
inline

Initializes to zero all the memory that's not in use.

This function is normally used for security reasons.

References boost::python::ptr(), and boost::asio::s.

Friends And Related Function Documentation

template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
friend class ipcdetail::memory_algorithm_common< rbtree_best_fit >
friend

Member Data Documentation

template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
const size_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::Alignment
static
Initial value:
= !MemAlignment
: size_type(MemAlignment)
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
const size_type boost::interprocess::rbtree_best_fit< MutexFamily, VoidPointer, MemAlignment >::PayloadPerAllocation = AllocatedCtrlBytes - UsableByPreviousChunk
static

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