|
libBf 0.1
|
The fixed width storage policy implements a bit vector where each cell itself is a counter with a fixed number of bits. More...
#include <store.h>

Public Types | |
| typedef Block | block_type |
| typedef Allocator | allocator_type |
|
typedef boost::dynamic_bitset < Block, Allocator > | bitset |
| typedef bitset::size_type | size_type |
| typedef std::vector< size_type > | pos_vector |
| typedef uint64_t | count_type |
Public Member Functions | |
| fixed_width (unsigned cells, unsigned width) | |
| Construct a bit vector of size \(O(mw)\) where \(m\) is the number of cells and \(w\) the number of bits per cell. | |
| template<typename B , typename A > | |
| void | swap (fixed_width< B, A > &store) |
| bool | increment (size_type cell) |
| Increment a cell counter. | |
| bool | increment (size_type cell, count_type value) |
| Increment a cell counter by a given value. | |
| bool | decrement (size_type cell) |
| Decrement a cell counter. | |
| count_type | count (size_type cell) const |
| Get the count of a cell. | |
| void | set () |
| Set every bit in the bit vector. | |
| void | set (size_type cell) |
| Set a cell to all 1s. | |
| void | set (size_type cell, count_type value) |
| Set a cell to a given value. | |
| void | reset () |
| Clear every bit in the bit vector. | |
| void | reset (size_type cell) |
| Clear the bit(s) of specific cell. | |
| void | halve () |
| Shrink the number of cells in the bit vector by a factor of 2. | |
| size_type | size () const |
| Get the size of the underlying bit vector. | |
| count_type | max () const |
| Get the maximum counter value this store supports. | |
| bool | none () const |
| Test whether all bits are 0. | |
| unsigned | width () const |
| Get the counter width of a cell. | |
| void | width (unsigned w) |
| Set the cell width. | |
| std::string | to_string () const |
| Get a string representation of the storage. | |
| template<typename F > | |
| void | each (F f) const |
| Apply a functor to each counter in the bit vector. | |
Private Attributes | |
| bitset | bits_ |
| unsigned | width_ |
The fixed width storage policy implements a bit vector where each cell itself is a counter with a fixed number of bits.
| bf::fixed_width< Block, Allocator >::fixed_width | ( | unsigned | cells, |
| unsigned | width | ||
| ) | [inline] |
Construct a bit vector of size \(O(mw)\) where \(m\) is the number of cells and \(w\) the number of bits per cell.
| cells | The number of cells in the bit vector. |
| width | The number of pits per cell. |
Definition at line 53 of file store.h.
References bf::fixed_width< Block, Allocator >::max().

| count_type bf::fixed_width< Block, Allocator >::count | ( | size_type | cell | ) | const [inline] |
Get the count of a cell.
| cell | The cell index. |
true if the decrement succeeded, false if all bits in the cell were already 0. Definition at line 190 of file store.h.
References bf::fixed_width< Block, Allocator >::size().
Referenced by bf::fixed_width< Block, Allocator >::each(), and bf::fixed_width< Block, Allocator >::halve().


| bool bf::fixed_width< Block, Allocator >::decrement | ( | size_type | cell | ) | [inline] |
Decrement a cell counter.
| cell | The cell index. |
true if the decrement succeeded, false if all bits in the cell were already 0. Definition at line 167 of file store.h.
References bf::fixed_width< Block, Allocator >::size().

| void bf::fixed_width< Block, Allocator >::each | ( | F | f | ) | const [inline] |
Apply a functor to each counter in the bit vector.
| The | type of the unary functor. |
| f | An instance of type F. |
Definition at line 355 of file store.h.
References bf::fixed_width< Block, Allocator >::count().

| bool bf::fixed_width< Block, Allocator >::increment | ( | size_type | cell | ) | [inline] |
Increment a cell counter.
| cell | The cell index. |
true if the increment succeeded, false if all bits in the cell were already 1. Definition at line 79 of file store.h.
References bf::fixed_width< Block, Allocator >::size().

| bool bf::fixed_width< Block, Allocator >::increment | ( | size_type | cell, |
| count_type | value | ||
| ) | [inline] |
Increment a cell counter by a given value.
If the value is larger than or equal to max(), All bits are set to 1.
| cell | The cell index. |
| value | The value that is added to the current cell value. |
true if the increment succeeded, false if all bits in the cell were already 1. Definition at line 103 of file store.h.
References bf::fixed_width< Block, Allocator >::max(), and bf::fixed_width< Block, Allocator >::size().

| count_type bf::fixed_width< Block, Allocator >::max | ( | ) | const [inline] |
Get the maximum counter value this store supports.
Definition at line 276 of file store.h.
References bf::fixed_width< Block, Allocator >::width().
Referenced by bf::fixed_width< Block, Allocator >::fixed_width(), bf::fixed_width< Block, Allocator >::increment(), and bf::fixed_width< Block, Allocator >::set().


| bool bf::fixed_width< Block, Allocator >::none | ( | ) | const [inline] |
| void bf::fixed_width< Block, Allocator >::reset | ( | size_type | cell | ) | [inline] |
Clear the bit(s) of specific cell.
| cell | The cell to clear. |
Definition at line 242 of file store.h.
References bf::fixed_width< Block, Allocator >::size().

| void bf::fixed_width< Block, Allocator >::set | ( | size_type | cell, |
| count_type | value | ||
| ) | [inline] |
Set a cell to a given value.
| cell | The cell whose value changes. |
| value | The new value of the cell. |
Definition at line 223 of file store.h.
References bf::fixed_width< Block, Allocator >::max(), and bf::fixed_width< Block, Allocator >::size().

| void bf::fixed_width< Block, Allocator >::set | ( | size_type | cell | ) | [inline] |
Set a cell to all 1s.
| cell | The cell to set to all 1s. |
Definition at line 211 of file store.h.
References bf::fixed_width< Block, Allocator >::size().

| size_type bf::fixed_width< Block, Allocator >::size | ( | ) | const [inline] |
Get the size of the underlying bit vector.
Definition at line 269 of file store.h.
Referenced by bf::fixed_width< Block, Allocator >::count(), bf::fixed_width< Block, Allocator >::decrement(), bf::fixed_width< Block, Allocator >::increment(), bf::fixed_width< Block, Allocator >::reset(), and bf::fixed_width< Block, Allocator >::set().

| std::string bf::fixed_width< Block, Allocator >::to_string | ( | ) | const [inline] |
| void bf::fixed_width< Block, Allocator >::width | ( | unsigned | w | ) | [inline] |
| unsigned bf::fixed_width< Block, Allocator >::width | ( | ) | const [inline] |
Get the counter width of a cell.
Definition at line 291 of file store.h.
Referenced by bf::fixed_width< Block, Allocator >::max().

1.7.3