BitMagic-C++
|
forward iterator class to traverse bit-vector as ranges More...
#include <bmintervals.h>
Public Types | |
typedef std::input_iterator_tag | iterator_category |
typedef BV | bvector_type |
typedef bvector_type::size_type | size_type |
typedef bvector_type::allocator_type | allocator_type |
typedef bm::byte_buffer< allocator_type > | buffer_type |
typedef bm::pair< size_type, size_type > | pair_type |
Public Member Functions | |
Construction and assignment | |
interval_enumerator () | |
interval_enumerator (const BV &bv) | |
Construct enumerator for the bit-vector. More... | |
interval_enumerator (const BV &bv, size_type start_pos, bool extend_start) | |
Construct enumerator for the specified position. More... | |
interval_enumerator (const interval_enumerator< BV > &ien) | |
Copy constructor. More... | |
interval_enumerator & | operator= (const interval_enumerator< BV > &ien) |
Assignment operator. More... | |
interval_enumerator (interval_enumerator< BV > &&ien) BMNOEXCEPT | |
move-ctor More... | |
interval_enumerator< BV > & | operator= (interval_enumerator< BV > &&ien) BMNOEXCEPT |
move assignmment operator More... | |
Comparison methods all use start position to compare <br> | |
bool | operator== (const interval_enumerator< BV > &ien) const BMNOEXCEPT |
More... | |
bool | operator!= (const interval_enumerator< BV > &ien) const BMNOEXCEPT |
More... | |
bool | operator< (const interval_enumerator< BV > &ien) const BMNOEXCEPT |
More... | |
bool | operator<= (const interval_enumerator< BV > &ien) const BMNOEXCEPT |
More... | |
bool | operator> (const interval_enumerator< BV > &ien) const BMNOEXCEPT |
More... | |
bool | operator>= (const interval_enumerator< BV > &ien) const BMNOEXCEPT |
More... | |
size_type | start () const BMNOEXCEPT |
Return interval start/left as bit-vector coordinate 011110 [left..right]. More... | |
size_type | end () const BMNOEXCEPT |
Return interval end/right as bit-vector coordinate 011110 [left..right]. More... | |
const pair_type & | operator* () const BMNOEXCEPT |
const pair_type & | get () const BMNOEXCEPT |
Get interval pair. More... | |
bool | valid () const BMNOEXCEPT |
Returns true if enumerator is valid (false if traversal is done) More... | |
enumerator positioning <br> | |
typedef bvector_type::block_idx_type | block_idx_type |
typedef bvector_type::allocator_type | bv_allocator_type |
typedef bm::heap_vector< unsigned short, bv_allocator_type, true > | gap_vector_type |
bool | go_to (size_type pos, bool extend_start=true) |
Go to inetrval at specified position Jump to position with interval. If interval is not available at the specified position (o bit) enumerator will find the next interval. If interval is present we have an option to find interval start [left..] and set enumerator from the effective start coodrinate. More... | |
bool | advance () |
More... | |
interval_enumerator< BV > & | operator++ () BMNOEXCEPT |
Advance enumerator forward to the next available bit. More... | |
interval_enumerator< BV > | operator++ (int) BMNOEXCEPT |
Advance enumerator forward to the next available bit. More... | |
void | swap (interval_enumerator< BV > &ien) BMNOEXCEPT |
swap enumerator with another one More... | |
bool | go_to_impl (size_type pos, bool extend_start) |
More... | |
void | invalidate () BMNOEXCEPT |
Turn FSM into invalid state (out of range) More... | |
forward iterator class to traverse bit-vector as ranges
Traverse enumerator for forward walking bit-vector as intervals: series of consequtive 1111s flanked with zeroes. Enumerator can traverse the whole bit-vector or jump(go_to) to position.
Definition at line 52 of file bmintervals.h.
|
inline |
Construct enumerator for the bit-vector.
Definition at line 75 of file bmintervals.h.
References bm::interval_enumerator< BV >::go_to_impl().
|
inline |
Construct enumerator for the specified position.
bv | - source bit-vector |
start_pos | - position on bit-vector to search for interval |
extend_start | - flag to extend interval start to the start if true start happenes to be less than start_pos |
Definition at line 89 of file bmintervals.h.
References bm::interval_enumerator< BV >::go_to_impl().
|
inline |
Copy constructor.
Definition at line 98 of file bmintervals.h.
References bm::interval_enumerator< BV >::go_to_impl(), and bm::interval_enumerator< BV >::start().
|
inline |
move-ctor
Definition at line 115 of file bmintervals.h.
References bm::interval_enumerator< BV >::swap().
bool bm::interval_enumerator< BV >::advance |
Advance to the next interval
Definition at line 717 of file bmintervals.h.
References BM_ASSERT, bm::find_interval_end(), bm::pair< First, Second >::first, bm::gap_max_bits, bm::interval_enumerator< BV >::go_to_impl(), bm::id_max, bm::interval_enumerator< BV >::invalidate(), bm::pair< First, Second >::second, bm::set_block_shift, and bm::interval_enumerator< BV >::valid().
Referenced by main(), bm::interval_enumerator< BV >::operator++(), and print_model().
interval_enumerator< BV >::size_type bm::interval_enumerator< BV >::end |
Return interval end/right as bit-vector coordinate 011110 [left..right].
Definition at line 560 of file bmintervals.h.
References bm::pair< First, Second >::second.
Referenced by main(), and print_model().
|
inline |
Get interval pair.
Definition at line 161 of file bmintervals.h.
Referenced by main().
bool bm::interval_enumerator< BV >::go_to | ( | size_type | pos, |
bool | extend_start = true |
||
) |
Go to inetrval at specified position Jump to position with interval. If interval is not available at the specified position (o bit) enumerator will find the next interval. If interval is present we have an option to find interval start [left..] and set enumerator from the effective start coodrinate.
pos | - position on bit-vector |
extend_start | - find effective start if it is less than the go to position |
Definition at line 584 of file bmintervals.h.
References bm::interval_enumerator< BV >::go_to_impl().
Referenced by main().
|
protected |
Definition at line 592 of file bmintervals.h.
References bm::bit_to_gap(), BM_ASSERT, BM_IS_GAP, BMGAP_PTR, BMRESTRICT, bm::find_interval_end(), bm::find_interval_start(), bm::pair< First, Second >::first, FULL_BLOCK_FAKE_ADDR, bm::gap_bfind(), bm::gap_max_bits, bm::get_block_coord(), bm::id_max, bm::interval_enumerator< BV >::invalidate(), bm::pair< First, Second >::second, bm::set_block_mask, and bm::set_block_shift.
Referenced by bm::interval_enumerator< BV >::advance(), bm::interval_enumerator< BV >::go_to(), bm::interval_enumerator< BV >::interval_enumerator(), and bm::interval_enumerator< BV >::operator=().
|
protected |
Turn FSM into invalid state (out of range)
Definition at line 576 of file bmintervals.h.
References bm::pair< First, Second >::first, bm::id_max, and bm::pair< First, Second >::second.
Referenced by bm::interval_enumerator< BV >::advance(), and bm::interval_enumerator< BV >::go_to_impl().
|
inline |
Definition at line 140 of file bmintervals.h.
References bm::interval_enumerator< BV >::start().
|
inline |
Advance enumerator forward to the next available bit.
Definition at line 192 of file bmintervals.h.
References bm::interval_enumerator< BV >::advance().
|
inline |
Advance enumerator forward to the next available bit.
Definition at line 196 of file bmintervals.h.
References bm::interval_enumerator< BV >::advance().
|
inline |
Definition at line 142 of file bmintervals.h.
References bm::interval_enumerator< BV >::start().
|
inline |
Definition at line 144 of file bmintervals.h.
References bm::interval_enumerator< BV >::start().
|
inline |
Assignment operator.
Definition at line 107 of file bmintervals.h.
References bm::interval_enumerator< BV >::go_to_impl(), and bm::interval_enumerator< BV >::start().
|
inline |
move assignmment operator
Definition at line 122 of file bmintervals.h.
References bm::interval_enumerator< BV >::swap().
|
inline |
Definition at line 138 of file bmintervals.h.
References bm::interval_enumerator< BV >::start().
|
inline |
Definition at line 146 of file bmintervals.h.
References bm::interval_enumerator< BV >::start().
|
inline |
Definition at line 148 of file bmintervals.h.
References bm::interval_enumerator< BV >::start().
interval_enumerator< BV >::size_type bm::interval_enumerator< BV >::start |
Return interval start/left as bit-vector coordinate 011110 [left..right].
Definition at line 551 of file bmintervals.h.
References bm::pair< First, Second >::first.
Referenced by bm::interval_enumerator< BV >::interval_enumerator(), main(), bm::interval_enumerator< BV >::operator!=(), bm::interval_enumerator< BV >::operator<(), bm::interval_enumerator< BV >::operator<=(), bm::interval_enumerator< BV >::operator=(), bm::interval_enumerator< BV >::operator==(), bm::interval_enumerator< BV >::operator>(), bm::interval_enumerator< BV >::operator>=(), and print_model().
void bm::interval_enumerator< BV >::swap | ( | interval_enumerator< BV > & | ien | ) |
swap enumerator with another one
Definition at line 757 of file bmintervals.h.
References bm::pair< First, Second >::first, bm::pair< First, Second >::second, and bm::xor_swap().
Referenced by bm::interval_enumerator< BV >::interval_enumerator(), and bm::interval_enumerator< BV >::operator=().
bool bm::interval_enumerator< BV >::valid |
Returns true if enumerator is valid (false if traversal is done)
Definition at line 568 of file bmintervals.h.
References bm::pair< First, Second >::first, and bm::id_max.
Referenced by bm::interval_enumerator< BV >::advance(), main(), and print_model().