dlvhex
2.5.0
|
BM style allocator adapter. More...
#include <vs10/bm/bmalloc.h>
Public Types | |
typedef BA | block_allocator_type |
typedef PA | ptr_allocator_type |
typedef BA | block_allocator_type |
typedef PA | ptr_allocator_type |
Public Member Functions | |
mem_alloc (const BA &block_alloc=BA(), const PA &ptr_alloc=PA()) | |
block_allocator_type | get_block_allocator () const |
Returns copy of the block allocator object. | |
ptr_allocator_type | get_ptr_allocator () const |
Returns copy of the ptr allocator object. | |
bm::word_t * | alloc_bit_block (unsigned alloc_factor=1) |
Allocates and returns bit block. | |
void | free_bit_block (bm::word_t *block, unsigned alloc_factor=1) |
Frees bit block allocated by alloc_bit_block. | |
bm::gap_word_t * | alloc_gap_block (unsigned level, const gap_word_t *glevel_len) |
Allocates GAP block using bit block allocator (BA). | |
void | free_gap_block (bm::gap_word_t *block, const gap_word_t *glevel_len) |
Frees GAP block using bot block allocator (BA) | |
void * | alloc_ptr (unsigned size=bm::set_array_size) |
Allocates block of pointers. | |
void | free_ptr (void *p, unsigned size=bm::set_array_size) |
Frees block of pointers. | |
mem_alloc (const BA &block_alloc=BA(), const PA &ptr_alloc=PA()) | |
block_allocator_type | get_block_allocator () const |
Returns copy of the block allocator object. | |
ptr_allocator_type | get_ptr_allocator () const |
Returns copy of the ptr allocator object. | |
bm::word_t * | alloc_bit_block (unsigned alloc_factor=1) |
Allocates and returns bit block. | |
void | free_bit_block (bm::word_t *block, unsigned alloc_factor=1) |
Frees bit block allocated by alloc_bit_block. | |
bm::gap_word_t * | alloc_gap_block (unsigned level, const gap_word_t *glevel_len) |
Allocates GAP block using bit block allocator (BA). | |
void | free_gap_block (bm::gap_word_t *block, const gap_word_t *glevel_len) |
Frees GAP block using bot block allocator (BA) | |
void * | alloc_ptr (unsigned size=bm::set_array_size) |
Allocates block of pointers. | |
void | free_ptr (void *p, unsigned size=bm::set_array_size) |
Frees block of pointers. | |
Private Attributes | |
BA | block_alloc_ |
PA | ptr_alloc_ |
BM style allocator adapter.
Template takes two parameters BA - allocator object for bit blocks and PA - allocator object for pointer blocks.
typedef BA bm::mem_alloc< BA, PA >::block_allocator_type |
typedef BA bm::mem_alloc< BA, PA >::block_allocator_type |
typedef PA bm::mem_alloc< BA, PA >::ptr_allocator_type |
typedef PA bm::mem_alloc< BA, PA >::ptr_allocator_type |
bm::mem_alloc< BA, PA >::mem_alloc | ( | const BA & | block_alloc = BA() , |
const PA & | ptr_alloc = PA() |
||
) | [inline] |
bm::mem_alloc< BA, PA >::mem_alloc | ( | const BA & | block_alloc = BA() , |
const PA & | ptr_alloc = PA() |
||
) | [inline] |
bm::word_t* bm::mem_alloc< BA, PA >::alloc_bit_block | ( | unsigned | alloc_factor = 1 | ) | [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 173 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_, and bm::set_block_size.
bm::word_t* bm::mem_alloc< BA, PA >::alloc_bit_block | ( | unsigned | alloc_factor = 1 | ) | [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 173 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_, and bm::set_block_size.
bm::gap_word_t* bm::mem_alloc< BA, PA >::alloc_gap_block | ( | unsigned | level, |
const gap_word_t * | glevel_len | ||
) | [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. |
Definition at line 193 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_, and bm::gap_levels.
bm::gap_word_t* bm::mem_alloc< BA, PA >::alloc_gap_block | ( | unsigned | level, |
const gap_word_t * | glevel_len | ||
) | [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. |
Definition at line 193 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_, and bm::gap_levels.
void* bm::mem_alloc< BA, PA >::alloc_ptr | ( | unsigned | size = bm::set_array_size | ) | [inline] |
Allocates block of pointers.
Definition at line 217 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::ptr_alloc_.
void* bm::mem_alloc< BA, PA >::alloc_ptr | ( | unsigned | size = bm::set_array_size | ) | [inline] |
Allocates block of pointers.
Definition at line 217 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::ptr_alloc_.
void bm::mem_alloc< BA, PA >::free_bit_block | ( | bm::word_t * | block, |
unsigned | alloc_factor = 1 |
||
) | [inline] |
Frees bit block allocated by alloc_bit_block.
Definition at line 180 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_, IS_VALID_ADDR, and bm::set_block_size.
void bm::mem_alloc< BA, PA >::free_bit_block | ( | bm::word_t * | block, |
unsigned | alloc_factor = 1 |
||
) | [inline] |
Frees bit block allocated by alloc_bit_block.
Definition at line 180 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_, IS_VALID_ADDR, and bm::set_block_size.
void bm::mem_alloc< BA, PA >::free_gap_block | ( | bm::gap_word_t * | block, |
const gap_word_t * | glevel_len | ||
) | [inline] |
Frees GAP block using bot block allocator (BA)
Definition at line 205 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_, bm::gap_capacity(), and IS_VALID_ADDR.
void bm::mem_alloc< BA, PA >::free_gap_block | ( | bm::gap_word_t * | block, |
const gap_word_t * | glevel_len | ||
) | [inline] |
Frees GAP block using bot block allocator (BA)
Definition at line 205 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_, bm::gap_capacity(), and IS_VALID_ADDR.
void bm::mem_alloc< BA, PA >::free_ptr | ( | void * | p, |
unsigned | size = bm::set_array_size |
||
) | [inline] |
Frees block of pointers.
Definition at line 224 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::ptr_alloc_.
void bm::mem_alloc< BA, PA >::free_ptr | ( | void * | p, |
unsigned | size = bm::set_array_size |
||
) | [inline] |
Frees block of pointers.
Definition at line 224 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::ptr_alloc_.
block_allocator_type bm::mem_alloc< BA, PA >::get_block_allocator | ( | ) | const [inline] |
Returns copy of the block allocator object.
Definition at line 154 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_.
block_allocator_type bm::mem_alloc< BA, PA >::get_block_allocator | ( | ) | const [inline] |
Returns copy of the block allocator object.
Definition at line 154 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_.
ptr_allocator_type bm::mem_alloc< BA, PA >::get_ptr_allocator | ( | ) | const [inline] |
Returns copy of the ptr allocator object.
Definition at line 161 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_.
ptr_allocator_type bm::mem_alloc< BA, PA >::get_ptr_allocator | ( | ) | const [inline] |
Returns copy of the ptr allocator object.
Definition at line 161 of file bmalloc.h.
References bm::mem_alloc< BA, PA >::block_alloc_.
BA bm::mem_alloc< BA, PA >::block_alloc_ [private] |
Definition at line 230 of file bmalloc.h.
Referenced by bm::mem_alloc< BA, PA >::alloc_bit_block(), bm::mem_alloc< BA, PA >::alloc_gap_block(), bm::mem_alloc< BA, PA >::free_bit_block(), bm::mem_alloc< BA, PA >::free_gap_block(), bm::mem_alloc< BA, PA >::get_block_allocator(), and bm::mem_alloc< BA, PA >::get_ptr_allocator().
PA bm::mem_alloc< BA, PA >::ptr_alloc_ [private] |
Definition at line 231 of file bmalloc.h.
Referenced by bm::mem_alloc< BA, PA >::alloc_ptr(), and bm::mem_alloc< BA, PA >::free_ptr().