BitMagic-C++
|
BM style allocator adapter. More...
#include <bmalloc.h>
Public Types | |
typedef BA | block_allocator_type |
typedef PA | ptr_allocator_type |
typedef APool | allocator_pool_type |
Public Member Functions | |
mem_alloc (const BA &block_alloc=BA(), const PA &ptr_alloc=PA()) BMNOEXCEPT | |
mem_alloc (const mem_alloc &ma) BMNOEXCEPT | |
mem_alloc & | operator= (const mem_alloc &ma) BMNOEXCEPT |
More... | |
block_allocator_type | get_block_allocator () const BMNOEXCEPT |
Returns copy of the block allocator object. More... | |
ptr_allocator_type | get_ptr_allocator () const BMNOEXCEPT |
Returns copy of the ptr allocator object. More... | |
void | set_pool (allocator_pool_type *pool) BMNOEXCEPT |
set pointer to external pool More... | |
allocator_pool_type * | get_pool () BMNOEXCEPT |
get pointer to allocation pool (if set) More... | |
bm::word_t * | alloc_bit_block (unsigned alloc_factor=1) |
Allocates and returns bit block. More... | |
void | free_bit_block (bm::word_t *block, size_t alloc_factor=1) BMNOEXCEPT |
Frees bit block allocated by alloc_bit_block. More... | |
bm::gap_word_t * | alloc_gap_block (unsigned level, const bm::gap_word_t *glevel_len) |
Allocates GAP block using bit block allocator (BA). More... | |
void | free_gap_block (bm::gap_word_t *block, const bm::gap_word_t *glevel_len) |
Frees GAP block using bot block allocator (BA) More... | |
void * | alloc_ptr (size_t size) |
Allocates block of pointers. More... | |
void | free_ptr (void *p, size_t size) BMNOEXCEPT |
Frees block of pointers. More... | |
BA & | get_block_alloc () BMNOEXCEPT |
Get access to block allocator. More... | |
Protected Attributes | |
BA | block_alloc_ |
More... | |
PA | ptr_alloc_ |
More... | |
allocator_pool_type * | alloc_pool_p_ |
More... | |
BM style allocator adapter.
Template takes parameters: BA - allocator object for bit blocks PA - allocator object for pointer blocks APool - Allocation pool
|
inline |
Allocates and returns bit block.
alloc_factor | indicated how many blocks we want to allocate in chunk total allocation is going to be bm::set_block_size * alloc_factor Default allocation factor is 1 |
Definition at line 352 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::alloc_pool_p_, bm::mem_alloc< BA, PA, APool >::block_alloc_, and bm::set_block_size.
|
inline |
Allocates GAP block using bit block allocator (BA).
GAP blocks in BM library belong to levels. Each level has a correspondent length described in bm::gap_len_table<>
level | GAP block level. |
glevel_len | table of level lengths |
Definition at line 378 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::block_alloc_, BM_ASSERT, and bm::gap_levels.
|
inline |
Allocates block of pointers.
Definition at line 402 of file bmalloc.h.
References BM_ASSERT, and bm::mem_alloc< BA, PA, APool >::ptr_alloc_.
|
inline |
Frees bit block allocated by alloc_bit_block.
Definition at line 361 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::alloc_pool_p_, bm::mem_alloc< BA, PA, APool >::block_alloc_, BM_ASSERT, IS_VALID_ADDR, and bm::set_block_size.
|
inline |
Frees GAP block using bot block allocator (BA)
Definition at line 390 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::block_alloc_, BM_ASSERT, bm::gap_capacity(), and IS_VALID_ADDR.
|
inline |
Frees block of pointers.
Definition at line 410 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::ptr_alloc_.
|
inline |
Get access to block allocator.
Definition at line 419 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::block_alloc_.
|
inline |
Returns copy of the block allocator object.
Definition at line 322 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::block_alloc_.
|
inline |
get pointer to allocation pool (if set)
Definition at line 341 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::alloc_pool_p_.
|
inline |
Returns copy of the ptr allocator object.
Definition at line 329 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::block_alloc_.
|
inline |
Definition at line 312 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::block_alloc_, and bm::mem_alloc< BA, PA, APool >::ptr_alloc_.
|
inline |
set pointer to external pool
Definition at line 335 of file bmalloc.h.
References bm::mem_alloc< BA, PA, APool >::alloc_pool_p_.