BitMagic-C++
Public Types | Public Member Functions | Protected Member Functions
bm::bvps_addr_resolver< BV > Class Template Reference

Bit-bector prefix sum address resolver using bit-vector prefix sum as a space compactor. More...

#include <bmsparsevec_util.h>

Inheritance diagram for bm::bvps_addr_resolver< BV >:
Inheritance graph
[legend]

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_resolveroperator= (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_typeget_bvector () const
 Get const reference to the underlying bit-vector. More...
 
bvector_typeget_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...
 

Detailed Description

template<class BV>
class bm::bvps_addr_resolver< BV >

Bit-bector prefix sum address resolver using bit-vector prefix sum as a space compactor.

Definition at line 45 of file bmsparsevec_util.h.

Member Function Documentation

◆ calc_prefix_sum()

template<class BV >
void bm::bvps_addr_resolver< BV >::calc_prefix_sum ( bool  force = false)

Re-calculate prefix sum table.

Parameters
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().

◆ construct_rs_index()

template<class BV >
void bm::bvps_addr_resolver< BV >::construct_rs_index
protected

◆ equal()

template<class BV >
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.

◆ free_rs_index()

template<class BV >
void bm::bvps_addr_resolver< BV >::free_rs_index
protected

Definition at line 409 of file bmsparsevec_util.h.

References bm::aligned_free().

◆ get()

template<class BV >
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

Parameters
id_from- input id to resolve
id_to- output id
Returns
true if id is known and resolved successfully

Definition at line 488 of file bmsparsevec_util.h.

References BM_ASSERT.

◆ get_bvector() [1/2]

template<class BV >
bvector_type& bm::bvps_addr_resolver< BV >::get_bvector ( )
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().

◆ get_bvector() [2/2]

template<class BV >
const bvector_type& bm::bvps_addr_resolver< BV >::get_bvector ( ) const
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().

◆ in_sync()

template<class BV >
bool bm::bvps_addr_resolver< BV >::in_sync ( ) const
inline

returns true if prefix sum table is in sync with the vector

Definition at line 120 of file bmsparsevec_util.h.

◆ move_from()

template<class BV >
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.

◆ optimize()

template<class BV >
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.

◆ resolve()

template<class BV >
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

Parameters
id_from- input id to resolve
id_to- output id
Returns
true if id is known and resolved successfully

Definition at line 462 of file bmsparsevec_util.h.

References BM_ASSERT.

◆ set()

template<class BV >
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.

◆ sync()

template<class BV >
void bm::bvps_addr_resolver< BV >::sync ( bool  force = false)
inline

Re-calculate prefix sum table (same as calc_prefix_sum)

Parameters
force- force recalculation even if it is already recalculated
See also
calc_prefix_sum

Definition at line 115 of file bmsparsevec_util.h.

References bm::bvps_addr_resolver< BV >::calc_prefix_sum().

◆ unsync()

template<class BV >
void bm::bvps_addr_resolver< BV >::unsync ( )
inline

Unsync the prefix sum table.

Definition at line 125 of file bmsparsevec_util.h.

Referenced by bm::bvps_addr_resolver< BV >::get_bvector().


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