BitMagic-C++
Public Types
bm::interval_enumerator< BV > Class Template Reference

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_typebuffer_type
 
typedef bm::pair< size_type, size_typepair_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_enumeratoroperator= (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_typeoperator* () const BMNOEXCEPT
 
const pair_typeget () 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...
 

Detailed Description

template<typename BV>
class bm::interval_enumerator< BV >

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.

Examples
sample23.cpp, svsample07a.cpp, and xsample08.cpp.

Definition at line 52 of file bmintervals.h.

Constructor & Destructor Documentation

◆ interval_enumerator() [1/4]

template<typename BV >
bm::interval_enumerator< BV >::interval_enumerator ( const BV &  bv)
inline

Construct enumerator for the bit-vector.

Definition at line 75 of file bmintervals.h.

References bm::interval_enumerator< BV >::go_to_impl().

◆ interval_enumerator() [2/4]

template<typename BV >
bm::interval_enumerator< BV >::interval_enumerator ( const BV &  bv,
size_type  start_pos,
bool  extend_start 
)
inline

Construct enumerator for the specified position.

Parameters
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
See also
go_to

Definition at line 89 of file bmintervals.h.

References bm::interval_enumerator< BV >::go_to_impl().

◆ interval_enumerator() [3/4]

template<typename BV >
bm::interval_enumerator< BV >::interval_enumerator ( const interval_enumerator< BV > &  ien)
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().

◆ interval_enumerator() [4/4]

template<typename BV >
bm::interval_enumerator< BV >::interval_enumerator ( interval_enumerator< BV > &&  ien)
inline

move-ctor

Definition at line 115 of file bmintervals.h.

References bm::interval_enumerator< BV >::swap().

Member Function Documentation

◆ advance()

template<typename BV >
bool bm::interval_enumerator< BV >::advance

◆ end()

template<typename BV >
interval_enumerator< BV >::size_type bm::interval_enumerator< BV >::end

Return interval end/right as bit-vector coordinate 011110 [left..right].

Examples
sample23.cpp, and svsample07a.cpp.

Definition at line 560 of file bmintervals.h.

References bm::pair< First, Second >::second.

Referenced by main(), and print_model().

◆ get()

template<typename BV >
const pair_type& bm::interval_enumerator< BV >::get ( ) const
inline

Get interval pair.

Examples
sample23.cpp.

Definition at line 161 of file bmintervals.h.

Referenced by main().

◆ go_to()

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

Parameters
pos- position on bit-vector
extend_start- find effective start if it is less than the go to position
Returns
true if enumerator remains valid after the jump
Examples
sample23.cpp.

Definition at line 584 of file bmintervals.h.

References bm::interval_enumerator< BV >::go_to_impl().

Referenced by main().

◆ go_to_impl()

template<typename BV >
bool bm::interval_enumerator< BV >::go_to_impl ( size_type  pos,
bool  extend_start 
)
protected

◆ invalidate()

template<typename BV >
void bm::interval_enumerator< BV >::invalidate
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().

◆ operator!=()

template<typename BV >
bool bm::interval_enumerator< BV >::operator!= ( const interval_enumerator< BV > &  ien) const
inline

Definition at line 140 of file bmintervals.h.

References bm::interval_enumerator< BV >::start().

◆ operator++() [1/2]

template<typename BV >
interval_enumerator<BV>& bm::interval_enumerator< BV >::operator++ ( )
inline

Advance enumerator forward to the next available bit.

Definition at line 192 of file bmintervals.h.

References bm::interval_enumerator< BV >::advance().

◆ operator++() [2/2]

template<typename BV >
interval_enumerator<BV> bm::interval_enumerator< BV >::operator++ ( int  )
inline

Advance enumerator forward to the next available bit.

Definition at line 196 of file bmintervals.h.

References bm::interval_enumerator< BV >::advance().

◆ operator<()

template<typename BV >
bool bm::interval_enumerator< BV >::operator< ( const interval_enumerator< BV > &  ien) const
inline

Definition at line 142 of file bmintervals.h.

References bm::interval_enumerator< BV >::start().

◆ operator<=()

template<typename BV >
bool bm::interval_enumerator< BV >::operator<= ( const interval_enumerator< BV > &  ien) const
inline

Definition at line 144 of file bmintervals.h.

References bm::interval_enumerator< BV >::start().

◆ operator=() [1/2]

template<typename BV >
interval_enumerator& bm::interval_enumerator< BV >::operator= ( const interval_enumerator< BV > &  ien)
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().

◆ operator=() [2/2]

template<typename BV >
interval_enumerator<BV>& bm::interval_enumerator< BV >::operator= ( interval_enumerator< BV > &&  ien)
inline

move assignmment operator

Definition at line 122 of file bmintervals.h.

References bm::interval_enumerator< BV >::swap().

◆ operator==()

template<typename BV >
bool bm::interval_enumerator< BV >::operator== ( const interval_enumerator< BV > &  ien) const
inline

Definition at line 138 of file bmintervals.h.

References bm::interval_enumerator< BV >::start().

◆ operator>()

template<typename BV >
bool bm::interval_enumerator< BV >::operator> ( const interval_enumerator< BV > &  ien) const
inline

Definition at line 146 of file bmintervals.h.

References bm::interval_enumerator< BV >::start().

◆ operator>=()

template<typename BV >
bool bm::interval_enumerator< BV >::operator>= ( const interval_enumerator< BV > &  ien) const
inline

Definition at line 148 of file bmintervals.h.

References bm::interval_enumerator< BV >::start().

◆ start()

template<typename BV >
interval_enumerator< BV >::size_type bm::interval_enumerator< BV >::start

◆ swap()

template<typename BV >
void bm::interval_enumerator< BV >::swap ( interval_enumerator< BV > &  ien)

◆ valid()

template<typename BV >
bool bm::interval_enumerator< BV >::valid

Returns true if enumerator is valid (false if traversal is done)

Examples
sample23.cpp, and svsample07a.cpp.

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


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