dlvhex  2.5.0
bm::blocks_manager< Alloc > Class Template Reference

bitvector blocks manager Embedded class managing bit-blocks on very low level. Includes number of functor classes used in different bitset algorithms. More...

#include <vs10/bm/bmblocks.h>

Data Structures

class  block_any_func
 Functor detects if any bit set. More...
class  block_copy_func
 Block copy functor. More...
class  block_count_arr_func
 Bitcounting functor filling the block counts array. More...
class  block_count_base
 Base class for bitcounting functors. More...
class  block_count_change_func
 bit value change counting functor More...
class  block_count_func
 Bitcounting functor. More...
class  block_free_func
 Block deallocation functor. More...
class  block_invert_func
 Bitblock invert functor. More...
class  block_one_func
 Fill block with all-one bits functor. More...
class  block_opt_func
class  block_zero_func
 Set block zero functor. More...
class  bm_func_base
 Base functor class (block visitor) More...
class  bm_func_base_const
 Base functor class connected for "constant" functors. More...
class  gap_level_func

Public Types

typedef Alloc allocator_type
typedef Alloc allocator_type

Public Member Functions

 blocks_manager (const gap_word_t *glevel_len, bm::id_t max_bits, const Alloc &alloc=Alloc())
 blocks_manager (const blocks_manager &blockman)
 ~blocks_manager ()
void free_ptr (bm::word_t **ptr)
unsigned compute_top_block_size (bm::id_t bits_to_store)
 Compute size of the block array needed to store bits.
bm::id_t capacity () const
 Returns current capacity (bits)
bm::word_tget_block (unsigned nb) const
 Finds block in 2-level blocks array.
bm::word_tget_block (unsigned nb, int *no_more_blocks) const
 Finds block in 2-level blocks array Specilized version of get_block(unsigned), returns an additional condition when there are no more blocks.
void get_block_coord (unsigned nb, unsigned *i, unsigned *j) const
 Recalculate absolute block address into coordinates.
unsigned find_next_nz_block (unsigned nb, bool deep_scan=true) const
 Find the next non-zero block starting from nb.
const bm::word_tget_block (unsigned i, unsigned j) const
 Finds block in 2-level blocks array.
const bm::word_t *const * get_topblock (unsigned i) const
 Function returns top-level block in 2-level blocks array.
bm::word_t *** get_rootblock () const
 Returns root block in the tree.
void free_block (bm::word_t *block)
void set_block_all_set (unsigned nb)
bm::word_talloc_bit_block (unsigned nb)
 Create(allocate) bit block.
bm::word_tmake_bit_block (unsigned nb)
 Create all-zeros bit block.
bm::word_tcopy_bit_block (unsigned nb, const bm::word_t *block_src, int is_src_gap)
 Create bit block as a copy of source block (bit or gap).
bm::word_tcopy_block (unsigned idx, const blocks_manager &bm_src)
 Copy block from another vector.
bm::word_tcheck_allocate_block (unsigned nb, unsigned content_flag, int initial_block_type, int *actual_block_type, bool allow_null_ret=true)
 Function checks if block is not yet allocated, allocates it and sets to all-zero or all-one bits.
void set_all_zero (bool free_mem)
 Fills all blocks with 0.
void set_all_one ()
bm::word_tset_block (unsigned nb, bm::word_t *block)
 Places new block into descriptors table, returns old block's address.
bm::word_tset_gap_block (unsigned nb, const gap_word_t *gap_block_src, int level)
 Allocate an place new GAP block (copy of provided block)
bm::word_tset_block (unsigned nb, bm::word_t *block, bool gap)
 Places new block into descriptors table, returns old block's address.
void set_block_ptr (unsigned nb, bm::word_t *block)
 Places new block into blocks table.
bm::word_tconvert_gap2bitset (unsigned nb, const gap_word_t *gap_block=0, unsigned gap_len=0)
 Converts block from type gap to conventional bitset block.
bm::word_tdeoptimize_block (unsigned nb)
 Make sure block turns into true bit-block if it is GAP or a full block.
bm::word_tzero_block (unsigned nb)
 Free block, make it zero pointer in the tree.
bm::word_tzero_block (unsigned i, unsigned j)
 Free block, make it zero pointer in the tree.
bm::id_t block_bitcount (const bm::word_t *block) const
 Count number of bits ON in the block.
bm::gap_word_textend_gap_block (unsigned nb, gap_word_t *blk)
 Extends GAP block to the next level or converts it to bit block.
bool is_block_gap (unsigned nb) const
void set_block_bit (unsigned nb)
void set_block_gap (unsigned nb)
bool is_block_zero (unsigned nb, const bm::word_t *blk, bool deep_scan=true) const
bool is_block_one (unsigned nb, const bm::word_t *blk, bool deep_scan=true) const
 Checks if block has only 1 bits.
bm::word_tcheck_allocate_tempblock ()
void set_glen (const gap_word_t *glevel_len)
bm::gap_word_tallocate_gap_block (unsigned level, const gap_word_t *src=0, const gap_word_t *glevel_len=0)
unsigned mem_used () const
bool is_subblock_null (unsigned nsub) const
 Returns true if second level block pointer is 0.
bm::word_t *** blocks_root ()
const gap_word_tglen () const
 Returns current GAP level vector.
unsigned glen (unsigned level) const
 Returns GAP level length for specified level.
void swap (blocks_manager &bm)
 Swaps content.
unsigned top_block_size () const
 Returns size of the top block array in the tree.
unsigned effective_top_block_size () const
 Returns effective size of the top block array in the tree Effective size excludes NULL pointers at the top descriptor end.
void reserve (unsigned max_bits)
 reserve capacity for specified number of bits
void reserve_top_blocks (unsigned top_blocks)
 Make sure blocks manager has enough blocks capacity.
allocator_typeget_allocator ()
 Returns reference on the allocator.
allocator_type get_allocator () const
 Returns allocator.
 blocks_manager (const gap_word_t *glevel_len, bm::id_t max_bits, const Alloc &alloc=Alloc())
 blocks_manager (const blocks_manager &blockman)
 ~blocks_manager ()
void free_ptr (bm::word_t **ptr)
unsigned compute_top_block_size (bm::id_t bits_to_store)
 Compute size of the block array needed to store bits.
bm::id_t capacity () const
 Returns current capacity (bits)
bm::word_tget_block (unsigned nb) const
 Finds block in 2-level blocks array.
bm::word_tget_block (unsigned nb, int *no_more_blocks) const
 Finds block in 2-level blocks array Specilized version of get_block(unsigned), returns an additional condition when there are no more blocks.
void get_block_coord (unsigned nb, unsigned *i, unsigned *j) const
 Recalculate absolute block address into coordinates.
unsigned find_next_nz_block (unsigned nb, bool deep_scan=true) const
 Find the next non-zero block starting from nb.
const bm::word_tget_block (unsigned i, unsigned j) const
 Finds block in 2-level blocks array.
const bm::word_t *const * get_topblock (unsigned i) const
 Function returns top-level block in 2-level blocks array.
bm::word_t *** get_rootblock () const
 Returns root block in the tree.
void free_block (bm::word_t *block)
void set_block_all_set (unsigned nb)
bm::word_talloc_bit_block (unsigned nb)
 Create(allocate) bit block.
bm::word_tmake_bit_block (unsigned nb)
 Create all-zeros bit block.
bm::word_tcopy_bit_block (unsigned nb, const bm::word_t *block_src, int is_src_gap)
 Create bit block as a copy of source block (bit or gap).
bm::word_tcopy_block (unsigned idx, const blocks_manager &bm_src)
 Copy block from another vector.
bm::word_tcheck_allocate_block (unsigned nb, unsigned content_flag, int initial_block_type, int *actual_block_type, bool allow_null_ret=true)
 Function checks if block is not yet allocated, allocates it and sets to all-zero or all-one bits.
void set_all_zero (bool free_mem)
 Fills all blocks with 0.
void set_all_one ()
bm::word_tset_block (unsigned nb, bm::word_t *block)
 Places new block into descriptors table, returns old block's address.
bm::word_tset_gap_block (unsigned nb, const gap_word_t *gap_block_src, int level)
 Allocate an place new GAP block (copy of provided block)
bm::word_tset_block (unsigned nb, bm::word_t *block, bool gap)
 Places new block into descriptors table, returns old block's address.
void set_block_ptr (unsigned nb, bm::word_t *block)
 Places new block into blocks table.
bm::word_tconvert_gap2bitset (unsigned nb, const gap_word_t *gap_block=0, unsigned gap_len=0)
 Converts block from type gap to conventional bitset block.
bm::word_tdeoptimize_block (unsigned nb)
 Make sure block turns into true bit-block if it is GAP or a full block.
bm::word_tzero_block (unsigned nb)
 Free block, make it zero pointer in the tree.
bm::word_tzero_block (unsigned i, unsigned j)
 Free block, make it zero pointer in the tree.
bm::id_t block_bitcount (const bm::word_t *block) const
 Count number of bits ON in the block.
bm::gap_word_textend_gap_block (unsigned nb, gap_word_t *blk)
 Extends GAP block to the next level or converts it to bit block.
bool is_block_gap (unsigned nb) const
void set_block_bit (unsigned nb)
void set_block_gap (unsigned nb)
bool is_block_zero (unsigned nb, const bm::word_t *blk, bool deep_scan=true) const
bool is_block_one (unsigned nb, const bm::word_t *blk, bool deep_scan=true) const
 Checks if block has only 1 bits.
bm::word_tcheck_allocate_tempblock ()
void set_glen (const gap_word_t *glevel_len)
bm::gap_word_tallocate_gap_block (unsigned level, const gap_word_t *src=0, const gap_word_t *glevel_len=0)
unsigned mem_used () const
bool is_subblock_null (unsigned nsub) const
 Returns true if second level block pointer is 0.
bm::word_t *** blocks_root ()
const gap_word_tglen () const
 Returns current GAP level vector.
unsigned glen (unsigned level) const
 Returns GAP level length for specified level.
void swap (blocks_manager &bm)
 Swaps content.
unsigned top_block_size () const
 Returns size of the top block array in the tree.
unsigned effective_top_block_size () const
 Returns effective size of the top block array in the tree Effective size excludes NULL pointers at the top descriptor end.
void reserve (unsigned max_bits)
 reserve capacity for specified number of bits
void reserve_top_blocks (unsigned top_blocks)
 Make sure blocks manager has enough blocks capacity.
allocator_typeget_allocator ()
 Returns reference on the allocator.
allocator_type get_allocator () const
 Returns allocator.

Private Member Functions

void operator= (const blocks_manager &)
void deinit_tree ()
void free_top_block ()
void init_tree ()
 allocate first level of descr. of blocks
void operator= (const blocks_manager &)
void deinit_tree ()
void free_top_block ()
void init_tree ()
 allocate first level of descr. of blocks

Private Attributes

bm::word_t *** blocks_
 Tree of blocks.
unsigned top_block_size_
 Size of the top level block array in blocks_ tree.
unsigned effective_top_block_size_
 Effective size of the top level block array in blocks_ tree.
bm::word_ttemp_block_
 Temp block.
gap_word_t glevel_len_ [bm::gap_levels]
 vector defines gap block lengths for different levels
allocator_type alloc_
 allocator

Detailed Description

template<class Alloc>
class bm::blocks_manager< Alloc >

bitvector blocks manager Embedded class managing bit-blocks on very low level. Includes number of functor classes used in different bitset algorithms.

Definition at line 51 of file bmblocks.h.


Member Typedef Documentation

template<class Alloc >
typedef Alloc bm::blocks_manager< Alloc >::allocator_type

Definition at line 55 of file bmblocks.h.

template<class Alloc >
typedef Alloc bm::blocks_manager< Alloc >::allocator_type

Definition at line 55 of file bmblocks.h.


Constructor & Destructor Documentation


Member Function Documentation

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::alloc_bit_block ( unsigned  nb) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::alloc_bit_block ( unsigned  nb) [inline]

Create(allocate) bit block.

Old block (if exists) gets deleted.

Definition at line 849 of file bmblocks.h.

References bm::blocks_manager< Alloc >::free_block(), bm::blocks_manager< Alloc >::get_allocator(), IS_VALID_ADDR, and bm::blocks_manager< Alloc >::set_block().

template<class Alloc >
bm::gap_word_t* bm::blocks_manager< Alloc >::allocate_gap_block ( unsigned  level,
const gap_word_t src = 0,
const gap_word_t glevel_len = 0 
) [inline]
template<class Alloc >
bm::id_t bm::blocks_manager< Alloc >::block_bitcount ( const bm::word_t block) const [inline]

Count number of bits ON in the block.

Definition at line 1209 of file bmblocks.h.

References bm::bit_block_calc_count(), bm::bits_in_block, BM_IS_GAP, BMGAP_PTR, bm::gap_bit_count(), IS_FULL_BLOCK, and bm::set_block_size.

template<class Alloc >
bm::id_t bm::blocks_manager< Alloc >::block_bitcount ( const bm::word_t block) const [inline]
template<class Alloc >
bm::word_t*** bm::blocks_manager< Alloc >::blocks_root ( ) [inline]

Definition at line 1398 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_.

template<class Alloc >
bm::id_t bm::blocks_manager< Alloc >::capacity ( ) const [inline]

Returns current capacity (bits)

Definition at line 708 of file bmblocks.h.

References bm::bits_in_block, bm::id_max, bm::set_array_size, and bm::blocks_manager< Alloc >::top_block_size_.

Referenced by bm::bvector< Alloc >::capacity().

template<class Alloc >
bm::id_t bm::blocks_manager< Alloc >::capacity ( ) const [inline]

Returns current capacity (bits)

Definition at line 708 of file bmblocks.h.

References bm::bits_in_block, bm::id_max, bm::set_array_size, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::check_allocate_block ( unsigned  nb,
unsigned  content_flag,
int  initial_block_type,
int *  actual_block_type,
bool  allow_null_ret = true 
) [inline]

Function checks if block is not yet allocated, allocates it and sets to all-zero or all-one bits.

If content_flag == 1 (ALLSET block) requested and taken block is already ALLSET, function will return NULL

initial_block_type and actual_block_type : 0 - bitset, 1 - gap

Definition at line 946 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, bm::blocks_manager< Alloc >::allocate_gap_block(), bm::bit_block_set(), BM_IS_GAP, bm::gap_max_bits, bm::gap_set_all(), bm::blocks_manager< Alloc >::get_block(), IS_FULL_BLOCK, IS_VALID_ADDR, and bm::blocks_manager< Alloc >::set_block().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::check_allocate_block ( unsigned  nb,
unsigned  content_flag,
int  initial_block_type,
int *  actual_block_type,
bool  allow_null_ret = true 
) [inline]

Function checks if block is not yet allocated, allocates it and sets to all-zero or all-one bits.

If content_flag == 1 (ALLSET block) requested and taken block is already ALLSET, function will return NULL

initial_block_type and actual_block_type : 0 - bitset, 1 - gap

Definition at line 946 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, bm::blocks_manager< Alloc >::allocate_gap_block(), bm::bit_block_set(), BM_IS_GAP, bm::gap_max_bits, bm::gap_set_all(), bm::blocks_manager< Alloc >::get_block(), IS_FULL_BLOCK, IS_VALID_ADDR, and bm::blocks_manager< Alloc >::set_block().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::check_allocate_tempblock ( ) [inline]

Returns temporary block, allocates if needed.

Definition at line 1342 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, and bm::blocks_manager< Alloc >::temp_block_.

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::check_allocate_tempblock ( ) [inline]

Returns temporary block, allocates if needed.

Definition at line 1342 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, and bm::blocks_manager< Alloc >::temp_block_.

template<class Alloc >
unsigned bm::blocks_manager< Alloc >::compute_top_block_size ( bm::id_t  bits_to_store) [inline]

Compute size of the block array needed to store bits.

Parameters:
bits_to_store- supposed capacity (number of bits)
Returns:
size of the top level block

Definition at line 692 of file bmblocks.h.

References bm::id_max, bm::set_array_size, bm::set_block_size, and bm::blocks_manager< Alloc >::top_block_size().

Referenced by bm::blocks_manager< Alloc >::blocks_manager(), and bm::blocks_manager< Alloc >::reserve().

template<class Alloc >
unsigned bm::blocks_manager< Alloc >::compute_top_block_size ( bm::id_t  bits_to_store) [inline]

Compute size of the block array needed to store bits.

Parameters:
bits_to_store- supposed capacity (number of bits)
Returns:
size of the top level block

Definition at line 692 of file bmblocks.h.

References bm::id_max, bm::set_array_size, bm::set_block_size, and bm::blocks_manager< Alloc >::top_block_size().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::convert_gap2bitset ( unsigned  nb,
const gap_word_t gap_block = 0,
unsigned  gap_len = 0 
) [inline]

Converts block from type gap to conventional bitset block.

Parameters:
nb- Block's index.
gap_block- Pointer to the gap block, if NULL block nb will be taken
gap_len- GAP block length (optional)
Returns:
new bit block's memory

Definition at line 1129 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, BMGAP_PTR, bm::gap_convert_to_bitset_l(), bm::blocks_manager< Alloc >::get_block(), bm::blocks_manager< Alloc >::glen(), IS_VALID_ADDR, bm::blocks_manager< Alloc >::set_block(), and bm::blocks_manager< Alloc >::set_block_ptr().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::convert_gap2bitset ( unsigned  nb,
const gap_word_t gap_block = 0,
unsigned  gap_len = 0 
) [inline]

Converts block from type gap to conventional bitset block.

Parameters:
nb- Block's index.
gap_block- Pointer to the gap block, if NULL block nb will be taken
gap_len- GAP block length (optional)
Returns:
new bit block's memory

Definition at line 1129 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, BMGAP_PTR, bm::gap_convert_to_bitset_l(), bm::blocks_manager< Alloc >::get_block(), bm::blocks_manager< Alloc >::glen(), IS_VALID_ADDR, bm::blocks_manager< Alloc >::set_block(), and bm::blocks_manager< Alloc >::set_block_ptr().

Referenced by bm::blocks_manager< Alloc >::deoptimize_block(), and bm::blocks_manager< Alloc >::extend_gap_block().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::copy_bit_block ( unsigned  nb,
const bm::word_t block_src,
int  is_src_gap 
) [inline]

Create bit block as a copy of source block (bit or gap).

Old block (if exists) gets deleted.

Definition at line 874 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_bit_block(), bm::bit_block_copy(), BMGAP_PTR, bm::gap_convert_to_bitset(), and bm::blocks_manager< Alloc >::zero_block().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::copy_bit_block ( unsigned  nb,
const bm::word_t block_src,
int  is_src_gap 
) [inline]

Create bit block as a copy of source block (bit or gap).

Old block (if exists) gets deleted.

Definition at line 874 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_bit_block(), bm::bit_block_copy(), BMGAP_PTR, bm::gap_convert_to_bitset(), and bm::blocks_manager< Alloc >::zero_block().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::copy_block ( unsigned  idx,
const blocks_manager< Alloc > &  bm_src 
) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::copy_block ( unsigned  idx,
const blocks_manager< Alloc > &  bm_src 
) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::deoptimize_block ( unsigned  nb) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::deoptimize_block ( unsigned  nb) [inline]
template<class Alloc >
unsigned bm::blocks_manager< Alloc >::effective_top_block_size ( ) const [inline]

Returns effective size of the top block array in the tree Effective size excludes NULL pointers at the top descriptor end.

Definition at line 1450 of file bmblocks.h.

References bm::blocks_manager< Alloc >::effective_top_block_size_.

Referenced by bm::bvector< Alloc >::any(), bm::bvector< Alloc >::count_blocks(), bm::blocks_manager< Alloc >::deinit_tree(), and bm::blocks_manager< Alloc >::set_all_zero().

template<class Alloc >
unsigned bm::blocks_manager< Alloc >::effective_top_block_size ( ) const [inline]

Returns effective size of the top block array in the tree Effective size excludes NULL pointers at the top descriptor end.

Definition at line 1450 of file bmblocks.h.

References bm::blocks_manager< Alloc >::effective_top_block_size_.

template<class Alloc >
bm::gap_word_t* bm::blocks_manager< Alloc >::extend_gap_block ( unsigned  nb,
gap_word_t blk 
) [inline]

Extends GAP block to the next level or converts it to bit block.

Parameters:
nb- Block's linear index.
blk- Blocks's pointer
Returns:
new GAP block pointer or NULL if block type mutated

Definition at line 1233 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, bm::blocks_manager< Alloc >::allocate_gap_block(), BMSET_PTRGAP, bm::blocks_manager< Alloc >::convert_gap2bitset(), bm::gap_length(), bm::gap_level(), bm::gap_max_buff_len, bm::gap_max_level, bm::blocks_manager< Alloc >::glen(), and bm::blocks_manager< Alloc >::set_block_ptr().

template<class Alloc >
bm::gap_word_t* bm::blocks_manager< Alloc >::extend_gap_block ( unsigned  nb,
gap_word_t blk 
) [inline]

Extends GAP block to the next level or converts it to bit block.

Parameters:
nb- Block's linear index.
blk- Blocks's pointer
Returns:
new GAP block pointer or NULL if block type mutated

Definition at line 1233 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, bm::blocks_manager< Alloc >::allocate_gap_block(), BMSET_PTRGAP, bm::blocks_manager< Alloc >::convert_gap2bitset(), bm::gap_length(), bm::gap_level(), bm::gap_max_buff_len, bm::gap_max_level, bm::blocks_manager< Alloc >::glen(), and bm::blocks_manager< Alloc >::set_block_ptr().

Referenced by bm::bvector< Alloc >::extend_gap_block().

template<class Alloc >
unsigned bm::blocks_manager< Alloc >::find_next_nz_block ( unsigned  nb,
bool  deep_scan = true 
) const [inline]

Find the next non-zero block starting from nb.

Parameters:
nb- block index
deep_scan- flag to perform detailed bit-block analysis
Returns:
bm::set_total_blocks - no more blocks

Definition at line 771 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, bm::blocks_manager< Alloc >::effective_top_block_size_, bm::blocks_manager< Alloc >::get_block_coord(), bm::blocks_manager< Alloc >::is_block_zero(), bm::set_array_size, and bm::set_total_blocks.

template<class Alloc >
unsigned bm::blocks_manager< Alloc >::find_next_nz_block ( unsigned  nb,
bool  deep_scan = true 
) const [inline]

Find the next non-zero block starting from nb.

Parameters:
nb- block index
deep_scan- flag to perform detailed bit-block analysis
Returns:
bm::set_total_blocks - no more blocks

Definition at line 771 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, bm::blocks_manager< Alloc >::effective_top_block_size_, bm::blocks_manager< Alloc >::get_block_coord(), bm::blocks_manager< Alloc >::is_block_zero(), bm::set_array_size, and bm::set_total_blocks.

template<class Alloc >
void bm::blocks_manager< Alloc >::free_block ( bm::word_t block) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::free_ptr ( bm::word_t **  ptr) [inline]

Definition at line 682 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_.

template<class Alloc >
void bm::blocks_manager< Alloc >::free_ptr ( bm::word_t **  ptr) [inline]

Definition at line 682 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_.

template<class Alloc >
void bm::blocks_manager< Alloc >::free_top_block ( ) [inline, private]
template<class Alloc >
allocator_type& bm::blocks_manager< Alloc >::get_allocator ( ) [inline]

Returns reference on the allocator.

Definition at line 1492 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_.

template<class Alloc >
allocator_type bm::blocks_manager< Alloc >::get_allocator ( ) const [inline]

Returns allocator.

Definition at line 1496 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_.

template<class Alloc >
allocator_type bm::blocks_manager< Alloc >::get_allocator ( ) const [inline]

Returns allocator.

Definition at line 1496 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_.

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::get_block ( unsigned  nb) const [inline]

Finds block in 2-level blocks array.

Parameters:
nb- Index of block (logical linear number)
Returns:
block adress or NULL if not yet allocated

Definition at line 720 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, bm::set_array_mask, bm::set_array_shift, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::get_block ( unsigned  nb,
int *  no_more_blocks 
) const [inline]

Finds block in 2-level blocks array Specilized version of get_block(unsigned), returns an additional condition when there are no more blocks.

Parameters:
nb- Index of block (logical linear number)
no_more_blocks- 1 if there are no more blocks at all
Returns:
block adress or NULL if not yet allocated

Definition at line 740 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, bm::set_array_mask, bm::set_array_shift, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::get_block ( unsigned  nb,
int *  no_more_blocks 
) const [inline]

Finds block in 2-level blocks array Specilized version of get_block(unsigned), returns an additional condition when there are no more blocks.

Parameters:
nb- Index of block (logical linear number)
no_more_blocks- 1 if there are no more blocks at all
Returns:
block adress or NULL if not yet allocated

Definition at line 740 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, bm::set_array_mask, bm::set_array_shift, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
const bm::word_t* bm::blocks_manager< Alloc >::get_block ( unsigned  i,
unsigned  j 
) const [inline]

Finds block in 2-level blocks array.

Parameters:
i- top level block index
j- second level block index
Returns:
block adress or NULL if not yet allocated

Definition at line 800 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
const bm::word_t* bm::blocks_manager< Alloc >::get_block ( unsigned  i,
unsigned  j 
) const [inline]

Finds block in 2-level blocks array.

Parameters:
i- top level block index
j- second level block index
Returns:
block adress or NULL if not yet allocated

Definition at line 800 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
void bm::blocks_manager< Alloc >::get_block_coord ( unsigned  nb,
unsigned *  i,
unsigned *  j 
) const [inline]

Recalculate absolute block address into coordinates.

Definition at line 756 of file bmblocks.h.

References bm::set_array_mask, and bm::set_array_shift.

Referenced by bm::blocks_manager< Alloc >::find_next_nz_block().

template<class Alloc >
void bm::blocks_manager< Alloc >::get_block_coord ( unsigned  nb,
unsigned *  i,
unsigned *  j 
) const [inline]

Recalculate absolute block address into coordinates.

Definition at line 756 of file bmblocks.h.

References bm::set_array_mask, and bm::set_array_shift.

template<class Alloc >
bm::word_t*** bm::blocks_manager< Alloc >::get_rootblock ( ) const [inline]
template<class Alloc >
bm::word_t*** bm::blocks_manager< Alloc >::get_rootblock ( ) const [inline]

Returns root block in the tree.

Definition at line 820 of file bmblocks.h.

template<class Alloc >
const bm::word_t* const* bm::blocks_manager< Alloc >::get_topblock ( unsigned  i) const [inline]

Function returns top-level block in 2-level blocks array.

Parameters:
i- top level block index
Returns:
block adress or NULL if not yet allocated

Definition at line 812 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
const bm::word_t* const* bm::blocks_manager< Alloc >::get_topblock ( unsigned  i) const [inline]

Function returns top-level block in 2-level blocks array.

Parameters:
i- top level block index
Returns:
block adress or NULL if not yet allocated

Definition at line 812 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
const gap_word_t* bm::blocks_manager< Alloc >::glen ( ) const [inline]

Returns current GAP level vector.

Definition at line 1405 of file bmblocks.h.

References bm::blocks_manager< Alloc >::glevel_len_.

template<class Alloc >
unsigned bm::blocks_manager< Alloc >::glen ( unsigned  level) const [inline]

Returns GAP level length for specified level.

Parameters:
level- level number

Definition at line 1413 of file bmblocks.h.

References bm::blocks_manager< Alloc >::glevel_len_.

template<class Alloc >
unsigned bm::blocks_manager< Alloc >::glen ( unsigned  level) const [inline]

Returns GAP level length for specified level.

Parameters:
level- level number

Definition at line 1413 of file bmblocks.h.

References bm::blocks_manager< Alloc >::glevel_len_.

template<class Alloc >
void bm::blocks_manager< Alloc >::init_tree ( ) [inline, private]
template<class Alloc >
bool bm::blocks_manager< Alloc >::is_block_gap ( unsigned  nb) const [inline]

Definition at line 1256 of file bmblocks.h.

References BMPTR_TESTBIT0, and bm::blocks_manager< Alloc >::get_block().

template<class Alloc >
bool bm::blocks_manager< Alloc >::is_block_gap ( unsigned  nb) const [inline]

Definition at line 1256 of file bmblocks.h.

References BMPTR_TESTBIT0, and bm::blocks_manager< Alloc >::get_block().

template<class Alloc >
bool bm::blocks_manager< Alloc >::is_block_one ( unsigned  nb,
const bm::word_t blk,
bool  deep_scan = true 
) const [inline]

Checks if block has only 1 bits.

Parameters:
nb- Index of the block.
blk- Block's pointer
deep_scan- flag to do full bit block verification (scan) when deep scan is not requested result can be approximate
Returns:
true if block consists of 1 bits.

Definition at line 1317 of file bmblocks.h.

References BM_IS_GAP, BMGAP_PTR, bm::gap_is_all_one(), bm::gap_max_bits, bm::is_bits_one(), IS_FULL_BLOCK, and bm::set_block_size.

template<class Alloc >
bool bm::blocks_manager< Alloc >::is_block_one ( unsigned  nb,
const bm::word_t blk,
bool  deep_scan = true 
) const [inline]

Checks if block has only 1 bits.

Parameters:
nb- Index of the block.
blk- Block's pointer
deep_scan- flag to do full bit block verification (scan) when deep scan is not requested result can be approximate
Returns:
true if block consists of 1 bits.

Definition at line 1317 of file bmblocks.h.

References BM_IS_GAP, BMGAP_PTR, bm::gap_is_all_one(), bm::gap_max_bits, bm::is_bits_one(), IS_FULL_BLOCK, and bm::set_block_size.

template<class Alloc >
bool bm::blocks_manager< Alloc >::is_block_zero ( unsigned  nb,
const bm::word_t blk,
bool  deep_scan = true 
) const [inline]
template<class Alloc >
bool bm::blocks_manager< Alloc >::is_block_zero ( unsigned  nb,
const bm::word_t blk,
bool  deep_scan = true 
) const [inline]
template<class Alloc >
bool bm::blocks_manager< Alloc >::is_subblock_null ( unsigned  nsub) const [inline]

Returns true if second level block pointer is 0.

Definition at line 1392 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_.

template<class Alloc >
bool bm::blocks_manager< Alloc >::is_subblock_null ( unsigned  nsub) const [inline]

Returns true if second level block pointer is 0.

Definition at line 1392 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_.

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::make_bit_block ( unsigned  nb) [inline]

Create all-zeros bit block.

Old block (if exists) gets deleted.

Definition at line 863 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_bit_block(), and bm::bit_block_set().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::make_bit_block ( unsigned  nb) [inline]

Create all-zeros bit block.

Old block (if exists) gets deleted.

Definition at line 863 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_bit_block(), and bm::bit_block_set().

template<class Alloc >
void bm::blocks_manager< Alloc >::operator= ( const blocks_manager< Alloc > &  ) [private]
template<class Alloc >
void bm::blocks_manager< Alloc >::operator= ( const blocks_manager< Alloc > &  ) [private]
template<class Alloc >
void bm::blocks_manager< Alloc >::reserve ( unsigned  max_bits) [inline]

reserve capacity for specified number of bits

Definition at line 1458 of file bmblocks.h.

References bm::blocks_manager< Alloc >::compute_top_block_size(), and bm::blocks_manager< Alloc >::reserve_top_blocks().

template<class Alloc >
void bm::blocks_manager< Alloc >::reserve ( unsigned  max_bits) [inline]

reserve capacity for specified number of bits

Definition at line 1458 of file bmblocks.h.

References bm::blocks_manager< Alloc >::compute_top_block_size(), and bm::blocks_manager< Alloc >::reserve_top_blocks().

template<class Alloc >
void bm::blocks_manager< Alloc >::reserve_top_blocks ( unsigned  top_blocks) [inline]

Make sure blocks manager has enough blocks capacity.

Definition at line 1470 of file bmblocks.h.

References bm::blocks_manager< Alloc >::alloc_, bm::blocks_manager< Alloc >::blocks_, bm::set_array_size, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
void bm::blocks_manager< Alloc >::reserve_top_blocks ( unsigned  top_blocks) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::set_all_one ( ) [inline]

Replaces all blocks with ALL_ONE block.

Definition at line 1008 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, bm::for_each_block(), bm::set_array_size, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
void bm::blocks_manager< Alloc >::set_all_one ( ) [inline]

Replaces all blocks with ALL_ONE block.

Definition at line 1008 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, bm::for_each_block(), bm::set_array_size, and bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
void bm::blocks_manager< Alloc >::set_all_zero ( bool  free_mem) [inline]

Fills all blocks with 0.

Parameters:
free_mem- if true function frees the resources

Definition at line 990 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, bm::blocks_manager< Alloc >::deinit_tree(), bm::blocks_manager< Alloc >::effective_top_block_size(), bm::for_each_nzblock(), and bm::blocks_manager< Alloc >::init_tree().

template<class Alloc >
void bm::blocks_manager< Alloc >::set_all_zero ( bool  free_mem) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::set_block ( unsigned  nb,
bm::word_t block 
) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::set_block ( unsigned  nb,
bm::word_t block,
bool  gap 
) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::set_block ( unsigned  nb,
bm::word_t block,
bool  gap 
) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::set_block_all_set ( unsigned  nb) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::set_block_all_set ( unsigned  nb) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::set_block_bit ( unsigned  nb) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::set_block_gap ( unsigned  nb) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::set_block_gap ( unsigned  nb) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::set_block_ptr ( unsigned  nb,
bm::word_t block 
) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::set_gap_block ( unsigned  nb,
const gap_word_t gap_block_src,
int  level 
) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::set_gap_block ( unsigned  nb,
const gap_word_t gap_block_src,
int  level 
) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::set_glen ( const gap_word_t glevel_len) [inline]

Assigns new GAP lengths vector

Definition at line 1349 of file bmblocks.h.

References bm::blocks_manager< Alloc >::glevel_len_.

template<class Alloc >
void bm::blocks_manager< Alloc >::set_glen ( const gap_word_t glevel_len) [inline]

Assigns new GAP lengths vector

Definition at line 1349 of file bmblocks.h.

References bm::blocks_manager< Alloc >::glevel_len_.

Referenced by bm::bvector< Alloc >::set_gap_levels().

template<class Alloc >
void bm::blocks_manager< Alloc >::swap ( blocks_manager< Alloc > &  bm) [inline]
template<class Alloc >
void bm::blocks_manager< Alloc >::swap ( blocks_manager< Alloc > &  bm) [inline]
template<class Alloc >
unsigned bm::blocks_manager< Alloc >::top_block_size ( ) const [inline]
template<class Alloc >
unsigned bm::blocks_manager< Alloc >::top_block_size ( ) const [inline]

Returns size of the top block array in the tree.

Definition at line 1442 of file bmblocks.h.

References bm::blocks_manager< Alloc >::top_block_size_.

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::zero_block ( unsigned  nb) [inline]
template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::zero_block ( unsigned  nb) [inline]

Free block, make it zero pointer in the tree.

Definition at line 1182 of file bmblocks.h.

References bm::blocks_manager< Alloc >::free_block(), bm::blocks_manager< Alloc >::get_block(), and bm::blocks_manager< Alloc >::set_block().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::zero_block ( unsigned  i,
unsigned  j 
) [inline]

Free block, make it zero pointer in the tree.

Definition at line 1194 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, and bm::blocks_manager< Alloc >::free_block().

template<class Alloc >
bm::word_t* bm::blocks_manager< Alloc >::zero_block ( unsigned  i,
unsigned  j 
) [inline]

Free block, make it zero pointer in the tree.

Definition at line 1194 of file bmblocks.h.

References bm::blocks_manager< Alloc >::blocks_, and bm::blocks_manager< Alloc >::free_block().


Field Documentation


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