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 >:
[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 ()
| ~bvps_addr_resolver ()
| bvps_addr_resolver (const bvps_addr_resolver &addr_res)
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.
bool | resolve (size_type id_from, size_type *id_to) const BMNOEXCEPT
| Resolve id to integer id (address).
bool | get (size_type id_from, size_type *id_to) const BMNOEXCEPT
| Resolve id to integer id (address) without sync check.
void | set (size_type id_from)
| Set id (bit) to address resolver.
void | calc_prefix_sum (bool force=false)
| Re-calculate prefix sum table.
void | sync (bool force=false)
| Re-calculate prefix sum table (same as calc_prefix_sum).
bool | in_sync () const
| returns true if prefix sum table is in sync with the vector
void | unsync ()
| Unsync the prefix sum table.
const bvector_type & | get_bvector () const
| Get const reference to the underlying bit-vector.
bvector_type & | get_bvector ()
| Get writable reference to the underlying bit-vector.
void | optimize (bm::word_t *temp_block=0)
| optimize underlying bit-vector
bool | equal (const bvps_addr_resolver &addr_res) const BMNOEXCEPT
| equality comparison

## Protected Member Functions

void | construct_rs_index ()
void | free_rs_index ()

## 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 Typedef Documentation

## bvector_type

template<class BV>

typedef BV bm::bvps_addr_resolver< BV >::bvector_type

Definition at line 48 of file bmsparsevec_util.h.

## rs_index_type

template<class BV>

typedef bvector_type::rs_index_type bm::bvps_addr_resolver< BV >::rs_index_type

Definition at line 50 of file bmsparsevec_util.h.

## size_type

template<class BV>

typedef BV::size_type bm::bvps_addr_resolver< BV >::size_type

Definition at line 49 of file bmsparsevec_util.h.

## Constructor & Destructor Documentation

## bvps_addr_resolver() [1/2]

template<class BV>

bm::bvps_addr_resolver< BV >::bvps_addr_resolver | ( |  | ) |

Definition at line 379 of file bmsparsevec_util.h.

References construct_rs_index().

Referenced by bvps_addr_resolver(), equal(), and move_from().

## ~bvps_addr_resolver()

template<class BV>

bm::bvps_addr_resolver< BV >::~bvps_addr_resolver | ( |  | ) |

Definition at line 389 of file bmsparsevec_util.h.

References free_rs_index().

## bvps_addr_resolver() [2/2]

template<class BV>

bm::bvps_addr_resolver< BV >::bvps_addr_resolver | ( | const bvps_addr_resolver< BV > & | addr_res | ) |

Definition at line 422 of file bmsparsevec_util.h.

References bvps_addr_resolver(), and construct_rs_index().

## 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< bvector_type >::sync().

## construct_rs_index()

template<class BV>

void bm::bvps_addr_resolver< BV >::construct_rs_index | ( |  | ) |

protected

Definition at line 397 of file bmsparsevec_util.h.

References bm::aligned_new_malloc().

Referenced by bvps_addr_resolver(), and bvps_addr_resolver().

## 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.

References BMNOEXCEPT, and bvps_addr_resolver().

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

Referenced by move_from(), and ~bvps_addr_resolver().

## 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, and BMNOEXCEPT.

## 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.

## 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_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.

References BMNOEXCEPT, bvps_addr_resolver(), and free_rs_index().

## operator=()

template<class BV>

bvps_addr_resolver & bm::bvps_addr_resolver< BV >::operator= | ( | const bvps_addr_resolver< BV > & | addr_res | ) |

inline

Definition at line 56 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, and BMNOEXCEPT.

## 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.

## 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< bvector_type >::get_bvector().

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

- bmsparsevec_util.h