|
BitMagic-C++
|
Constant iterator designed to enumerate "ON" bits. More...
#include <bm.h>


Public Types | |
| typedef std::input_iterator_tag | iterator_category |
| typedef size_type | value_type |
| typedef unsigned | difference_type |
| typedef unsigned * | pointer |
| typedef unsigned & | reference |
Public Member Functions | |
| enumerator () BMNOEXCEPT | |
| enumerator (const bvector< Alloc > *bv) BMNOEXCEPT | |
| Construct enumerator associated with a vector. Important: This construction creates unpositioned iterator with status valid() == false. It can be re-positioned using go_first() or go_to(). | |
| enumerator (const bvector< Alloc > &bv, size_type pos=0) BMNOEXCEPT | |
| Construct enumerator for bit vector. | |
| enumerator (const bvector< Alloc > *bv, size_type pos) BMNOEXCEPT | |
| Construct enumerator for bit vector. | |
| size_type | operator* () const BMNOEXCEPT |
| Get current position (value). | |
| size_type | value () const BMNOEXCEPT |
| Get current position (value). | |
| enumerator & | operator++ () BMNOEXCEPT |
| Advance enumerator forward to the next available bit. | |
| enumerator | operator++ (int) BMNOEXCEPT |
| Advance enumerator forward to the next available bit. Possibly do NOT use this operator it is slower than the pre-fix increment. | |
| void | go_first () BMNOEXCEPT |
| Position enumerator to the first available bit. | |
| bool | advance () BMNOEXCEPT |
| bool | go_up () BMNOEXCEPT |
| Advance enumerator to the next available bit. | |
| bool | skip_to_rank (size_type rank) BMNOEXCEPT |
| Skip to specified relative rank. | |
| bool | skip (size_type rank) BMNOEXCEPT |
| Skip specified number of bits from enumeration. | |
| bool | go_to (size_type pos) BMNOEXCEPT |
| go to a specific position in the bit-vector (or next) | |
| Public Member Functions inherited from bm::bvector< Alloc >::iterator_base | |
| iterator_base () BMNOEXCEPT | |
| bool | operator== (const iterator_base &it) const BMNOEXCEPT |
| bool | operator!= (const iterator_base &it) const BMNOEXCEPT |
| bool | operator< (const iterator_base &it) const BMNOEXCEPT |
| bool | operator<= (const iterator_base &it) const BMNOEXCEPT |
| bool | operator> (const iterator_base &it) const BMNOEXCEPT |
| bool | operator>= (const iterator_base &it) const BMNOEXCEPT |
| bool | valid () const BMNOEXCEPT |
| Checks if iterator is still valid. | |
| void | invalidate () BMNOEXCEPT |
| Turns iterator into an invalid state. | |
| bool | compare_state (const iterator_base &ib) const BMNOEXCEPT |
| Compare FSMs for testing purposes. | |
Additional Inherited Members | |
| Protected Attributes inherited from bm::bvector< Alloc >::iterator_base | |
| bm::bvector< Alloc > * | bv_ |
| Pointer on parent bitvector. | |
| size_type | position_ |
| Bit position (bit idx). | |
| const bm::word_t * | block_ |
| Block pointer.(NULL-invalid). | |
| unsigned | block_type_ |
| Type of block. 0-Bit, 1-GAP. | |
| block_idx_type | block_idx_ |
| Block index. | |
| union bm::bvector::iterator_base::block_descr | bdescr_ |
Constant iterator designed to enumerate "ON" bits.
| typedef unsigned bm::bvector< Alloc >::enumerator::difference_type |
| typedef std::input_iterator_tag bm::bvector< Alloc >::enumerator::iterator_category |
| typedef unsigned* bm::bvector< Alloc >::enumerator::pointer |
| typedef unsigned& bm::bvector< Alloc >::enumerator::reference |
| typedef size_type bm::bvector< Alloc >::enumerator::value_type |
|
inline |
Definition at line 614 of file bm.h.
References BMNOEXCEPT, and bm::bvector< Alloc >::iterator_base::iterator_base().
Referenced by bm::bvector< Alloc >::counted_enumerator::counted_enumerator(), operator++(), operator++(), and bm::bvector< Alloc >::counted_enumerator::operator=().
|
inline |
Construct enumerator associated with a vector. Important: This construction creates unpositioned iterator with status valid() == false. It can be re-positioned using go_first() or go_to().
Definition at line 622 of file bm.h.
References BMNOEXCEPT, bm::bvector< Alloc >::iterator_base::bv_, and bm::bvector< Alloc >::iterator_base::bvector.
|
inline |
Construct enumerator for bit vector.
| bv | bit-vector reference |
| pos | bit position in the vector if position is 0, it finds the next 1 or becomes not valid (en.valid() == false) |
Definition at line 634 of file bm.h.
References BMNOEXCEPT, bm::bvector< Alloc >::iterator_base::bv_, bm::bvector< Alloc >::iterator_base::bvector, go_to(), and bm::bvector< Alloc >::iterator_base::iterator_base().
|
inline |
Construct enumerator for bit vector.
| bv | bit-vector pointer |
| pos | bit position in the vector if position is 0, it finds the next 1 or becomes not valid (en.valid() == false) |
Definition at line 648 of file bm.h.
References BMNOEXCEPT, bm::bvector< Alloc >::iterator_base::bv_, bm::bvector< Alloc >::iterator_base::bvector, and go_to().
|
inline |
advance iterator forward by one
Definition at line 680 of file bm.h.
References advance(), BMNOEXCEPT, and go_up().
Referenced by advance(), bm::rsc_sparse_vector< Val, SV >::decode(), and bm::rsc_sparse_vector< Val, SV >::decode_buf().
| void bm::bvector< Alloc >::enumerator::go_first | ( | ) |
Position enumerator to the first available bit.
Definition at line 8301 of file bm.h.
References bm::bits_in_array, bm::bits_in_block, bm::bvector< Alloc >::iterator_base::block_, bm::bvector< Alloc >::iterator_base::block_idx_, bm::bvector< Alloc >::iterator_base::block_type_, BM_ASSERT, BM_IS_GAP, bm::bvector< Alloc >::iterator_base::bv_, FULL_BLOCK_FAKE_ADDR, FULL_BLOCK_REAL_ADDR, FULL_SUB_BLOCK_REAL_ADDR, bm::bvector< Alloc >::iterator_base::invalidate(), bm::bvector< Alloc >::iterator_base::position_, and bm::set_sub_array_size.
Referenced by go_to().
| bool bm::bvector< Alloc >::enumerator::go_to | ( | size_type | pos | ) |
go to a specific position in the bit-vector (or next)
Definition at line 8209 of file bm.h.
References bm::bvector< Alloc >::iterator_base::bdescr_, bm::bvector< Alloc >::iterator_base::block_descr::bit_, bm::bvector< Alloc >::iterator_base::bitblock_descr::bits, bm::bitscan_wave(), bm::bvector< Alloc >::iterator_base::block_, bm::bvector< Alloc >::iterator_base::block_idx_, bm::bvector< Alloc >::iterator_base::block_type_, BM_ASSERT, BM_IS_GAP, BMGAP_PTR, BMNOEXCEPT, bm::bvector< Alloc >::iterator_base::bv_, bm::bvector< Alloc >::iterator_base::bitblock_descr::cnt, bm::bvector< Alloc >::iterator_base::block_descr::gap_, bm::gap_bfind(), bm::bvector< Alloc >::iterator_base::dgap_descr::gap_len, bm::get_block_coord(), go_first(), bm::bvector< Alloc >::iterator_base::bitblock_descr::idx, bm::bvector< Alloc >::iterator_base::invalidate(), bm::bvector< Alloc >::iterator_base::bitblock_descr::pos, bm::bvector< Alloc >::iterator_base::position_, bm::bvector< Alloc >::iterator_base::bitblock_descr::ptr, bm::bvector< Alloc >::iterator_base::dgap_descr::ptr, bm::set_bitscan_wave_size, bm::set_block_mask, bm::set_block_shift, bm::set_block_size, bm::set_word_mask, bm::set_word_shift, and bm::bvector< Alloc >::iterator_base::valid().
Referenced by assign_to_best_cluster(), assign_to_best_cluster_union(), enumerator(), enumerator(), and main().
| bool bm::bvector< Alloc >::enumerator::go_up | ( | ) |
Advance enumerator to the next available bit.
Definition at line 8083 of file bm.h.
References bm::bvector< Alloc >::iterator_base::bdescr_, bm::bvector< Alloc >::iterator_base::block_descr::bit_, bm::bvector< Alloc >::iterator_base::bitblock_descr::bits, bm::bvector< Alloc >::iterator_base::block_type_, BM_ASSERT, BMNOEXCEPT, bm::bvector< Alloc >::iterator_base::block_descr::gap_, bm::bvector< Alloc >::iterator_base::dgap_descr::gap_len, bm::gap_max_bits, bm::bvector< Alloc >::iterator_base::bitblock_descr::idx, bm::bvector< Alloc >::iterator_base::invalidate(), bm::bvector< Alloc >::iterator_base::bitblock_descr::pos, bm::bvector< Alloc >::iterator_base::position_, bm::bvector< Alloc >::iterator_base::bitblock_descr::ptr, bm::bvector< Alloc >::iterator_base::dgap_descr::ptr, bm::set_bitscan_wave_size, and bm::bvector< Alloc >::iterator_base::valid().
Referenced by advance(), bm::bvector< Alloc >::counted_enumerator::operator++(), bm::bvector< Alloc >::counted_enumerator::operator++(), operator++(), and operator++().
|
inline |
Get current position (value).
Definition at line 656 of file bm.h.
References BMNOEXCEPT, and bm::bvector< Alloc >::iterator_base::position_.
|
inline |
Advance enumerator forward to the next available bit.
Definition at line 662 of file bm.h.
References BMNOEXCEPT, enumerator(), and go_up().
|
inline |
Advance enumerator forward to the next available bit. Possibly do NOT use this operator it is slower than the pre-fix increment.
Definition at line 667 of file bm.h.
References BMNOEXCEPT, enumerator(), and go_up().
| bool bm::bvector< Alloc >::enumerator::skip | ( | size_type | rank | ) |
Skip specified number of bits from enumeration.
| rank | - number of ON bits to skip |
Definition at line 8136 of file bm.h.
References bm::bvector< Alloc >::iterator_base::bdescr_, bm::bvector< Alloc >::iterator_base::block_descr::bit_, bm::bvector< Alloc >::iterator_base::bitblock_descr::bits, bm::bvector< Alloc >::iterator_base::block_type_, BM_ASSERT, BMNOEXCEPT, bm::bvector< Alloc >::iterator_base::block_descr::gap_, bm::bvector< Alloc >::iterator_base::dgap_descr::gap_len, bm::gap_max_bits, bm::bvector< Alloc >::iterator_base::bitblock_descr::idx, bm::bvector< Alloc >::iterator_base::invalidate(), bm::bvector< Alloc >::iterator_base::bitblock_descr::pos, bm::bvector< Alloc >::iterator_base::position_, bm::bvector< Alloc >::iterator_base::bitblock_descr::ptr, bm::bvector< Alloc >::iterator_base::dgap_descr::ptr, bm::bvector< Alloc >::rank(), bm::set_bitscan_wave_size, and bm::bvector< Alloc >::iterator_base::valid().
Referenced by skip_to_rank().
|
inline |
Skip to specified relative rank.
| rank | - number of ON bits to go for (must be: > 0) |
Definition at line 690 of file bm.h.
References BM_ASSERT, BMNOEXCEPT, bm::bvector< Alloc >::rank(), skip(), skip_to_rank(), and bm::bvector< Alloc >::iterator_base::valid().
Referenced by skip_to_rank().
|
inline |
Get current position (value).
Definition at line 659 of file bm.h.
References BMNOEXCEPT, and bm::bvector< Alloc >::iterator_base::position_.
Referenced by bm::rsc_sparse_vector< Val, SV >::decode_buf(), bm::bvector< Alloc >::insert(), and bm::bvector< Alloc >::set_range().