BitMagic-C++
|
Bit-bector prefix sum address resolver using bit-vector prefix sum as a space compactor. More...
#include <bmsparsevec_util.h>
Public Types | |
typedef BV | bvector_type |
typedef BV::size_type | size_type |
typedef bvector_type::rs_index_type | rs_index_type |
Public Member Functions | |
bvps_addr_resolver () | |
More... | |
~bvps_addr_resolver () | |
bvps_addr_resolver (const bvps_addr_resolver &addr_res) | |
More... | |
bvps_addr_resolver & | operator= (const bvps_addr_resolver &addr_res) |
void | move_from (bvps_addr_resolver &addr_res) BMNOEXCEPT |
Move content from the argument address resolver. More... | |
bool | resolve (size_type id_from, size_type *id_to) const BMNOEXCEPT |
Resolve id to integer id (address) More... | |
bool | get (size_type id_from, size_type *id_to) const BMNOEXCEPT |
Resolve id to integer id (address) without sync check. More... | |
void | set (size_type id_from) |
Set id (bit) to address resolver. More... | |
void | calc_prefix_sum (bool force=false) |
Re-calculate prefix sum table. More... | |
void | sync (bool force=false) |
Re-calculate prefix sum table (same as calc_prefix_sum) More... | |
bool | in_sync () const |
returns true if prefix sum table is in sync with the vector More... | |
void | unsync () |
Unsync the prefix sum table. More... | |
const bvector_type & | get_bvector () const |
Get const reference to the underlying bit-vector. More... | |
bvector_type & | get_bvector () |
Get writable reference to the underlying bit-vector. More... | |
void | optimize (bm::word_t *temp_block=0) |
optimize underlying bit-vector More... | |
bool | equal (const bvps_addr_resolver &addr_res) const BMNOEXCEPT |
equality comparison More... | |
Protected Member Functions | |
void | construct_rs_index () |
More... | |
void | free_rs_index () |
More... | |
Bit-bector prefix sum address resolver using bit-vector prefix sum as a space compactor.
Definition at line 45 of file bmsparsevec_util.h.
void bm::bvps_addr_resolver< BV >::calc_prefix_sum | ( | bool | force = false | ) |
Re-calculate prefix sum table.
force | - force recalculation even if it is already recalculated |
Definition at line 514 of file bmsparsevec_util.h.
Referenced by bm::bvps_addr_resolver< BV >::sync().
|
protected |
Definition at line 397 of file bmsparsevec_util.h.
References bm::aligned_new_malloc().
Referenced by bm::bvps_addr_resolver< BV >::bvps_addr_resolver().
bool bm::bvps_addr_resolver< BV >::equal | ( | const bvps_addr_resolver< BV > & | addr_res | ) | const |
equality comparison
Definition at line 534 of file bmsparsevec_util.h.
|
protected |
Definition at line 409 of file bmsparsevec_util.h.
References bm::aligned_free().
bool bm::bvps_addr_resolver< BV >::get | ( | size_type | id_from, |
size_type * | id_to | ||
) | const |
Resolve id to integer id (address) without sync check.
If prefix sum table is not sync - unexpected behavior
id_from | - input id to resolve |
id_to | - output id |
Definition at line 488 of file bmsparsevec_util.h.
References BM_ASSERT.
|
inline |
Get writable reference to the underlying bit-vector.
Access to underlying vector assumes modification and loss of prefix sum acceleration structures. Need to call sync() at the end of transaction.
Definition at line 139 of file bmsparsevec_util.h.
References bm::bvps_addr_resolver< BV >::unsync().
|
inline |
Get const reference to the underlying bit-vector.
Definition at line 130 of file bmsparsevec_util.h.
Referenced by bm::compressed_buffer_collection< BV >::calc_stat(), and bm::compressed_collection< Value, BV >::equal().
|
inline |
returns true if prefix sum table is in sync with the vector
Definition at line 120 of file bmsparsevec_util.h.
void bm::bvps_addr_resolver< BV >::move_from | ( | bvps_addr_resolver< BV > & | addr_res | ) |
Move content from the argument address resolver.
Definition at line 440 of file bmsparsevec_util.h.
void bm::bvps_addr_resolver< BV >::optimize | ( | bm::word_t * | temp_block = 0 | ) |
optimize underlying bit-vector
Definition at line 526 of file bmsparsevec_util.h.
bool bm::bvps_addr_resolver< BV >::resolve | ( | size_type | id_from, |
size_type * | id_to | ||
) | const |
Resolve id to integer id (address)
Resolve id to address with full sync and range checking
id_from | - input id to resolve |
id_to | - output id |
Definition at line 462 of file bmsparsevec_util.h.
References BM_ASSERT.
void bm::bvps_addr_resolver< BV >::set | ( | size_type | id_from | ) |
Set id (bit) to address resolver.
Definition at line 501 of file bmsparsevec_util.h.
References BM_ASSERT.
|
inline |
Re-calculate prefix sum table (same as calc_prefix_sum)
force | - force recalculation even if it is already recalculated |
Definition at line 115 of file bmsparsevec_util.h.
References bm::bvps_addr_resolver< BV >::calc_prefix_sum().
|
inline |
Unsync the prefix sum table.
Definition at line 125 of file bmsparsevec_util.h.
Referenced by bm::bvps_addr_resolver< BV >::get_bvector().