BitMagicC++Library
Public Types | Public Member Functions
bm::bvector< Alloc >::enumerator Class Reference

Constant iterator designed to enumerate "ON" bits. More...

#include <bm.h>

Inheritance diagram for bm::bvector< Alloc >::enumerator:
Inheritance graph
[legend]
Collaboration diagram for bm::bvector< Alloc >::enumerator:
Collaboration graph
[legend]

Public Types

typedef std::input_iterator_tag iterator_category
 
typedef unsigned value_type
 
typedef unsigned difference_type
 
typedef unsigned * pointer
 
typedef unsigned & reference
 

Public Member Functions

 enumerator ()
 
 enumerator (const bvector< Alloc > *bv)
 Construct enumerator associated with a vector. This construction creates unpositioned iterator with status valid() == false. It can be re-positioned using go_first() or go_to() More...
 
 enumerator (const bvector< Alloc > *bv, bm::id_t pos)
 Construct enumerator for bit vector. More...
 
bm::id_t operator* () const
 Get current position (value) More...
 
bm::id_t value () const
 Get current position (value) More...
 
enumeratoroperator++ ()
 Advance enumerator forward to the next available bit. More...
 
enumerator operator++ (int)
 
void go_first ()
 Position enumerator to the first available bit. More...
 
enumeratorgo_up ()
 Advance enumerator to the next available bit. More...
 
enumeratorgo_to (bm::id_t pos)
 go to a specific position in the bit-vector (or next) More...
 
- Public Member Functions inherited from bm::bvector< Alloc >::iterator_base
 iterator_base ()
 
bool operator== (const iterator_base &it) const
 
bool operator!= (const iterator_base &it) const
 
bool operator< (const iterator_base &it) const
 
bool operator<= (const iterator_base &it) const
 
bool operator> (const iterator_base &it) const
 
bool operator>= (const iterator_base &it) const
 
bool valid () const
 Checks if iterator is still valid. More...
 
void invalidate ()
 Turns iterator into an invalid state. More...
 
bool compare_state (const iterator_base &ib) const
 Compare FSMs for testing purposes. More...
 

Additional Inherited Members

- Protected Attributes inherited from bm::bvector< Alloc >::iterator_base
bm::bvector< Alloc > * bv_
 Pointer on parent bitvector. More...
 
bm::id_t position_
 Bit position (bit idx) More...
 
const bm::word_tblock_
 Block pointer.(NULL-invalid) More...
 
unsigned block_type_
 Type of block. 0-Bit, 1-GAP. More...
 
unsigned block_idx_
 Block index. More...
 
union bm::bvector::iterator_base::block_descr bdescr_
 

Detailed Description

template<class Alloc>
class bm::bvector< Alloc >::enumerator

Constant iterator designed to enumerate "ON" bits.

Examples:
sample5.cpp, sample8.cpp, and xsample01.cpp.

Definition at line 423 of file bm.h.

Member Typedef Documentation

◆ difference_type

template<class Alloc>
typedef unsigned bm::bvector< Alloc >::enumerator::difference_type

Definition at line 430 of file bm.h.

◆ iterator_category

template<class Alloc>
typedef std::input_iterator_tag bm::bvector< Alloc >::enumerator::iterator_category

Definition at line 427 of file bm.h.

◆ pointer

template<class Alloc>
typedef unsigned* bm::bvector< Alloc >::enumerator::pointer

Definition at line 431 of file bm.h.

◆ reference

template<class Alloc>
typedef unsigned& bm::bvector< Alloc >::enumerator::reference

Definition at line 432 of file bm.h.

◆ value_type

template<class Alloc>
typedef unsigned bm::bvector< Alloc >::enumerator::value_type

Definition at line 429 of file bm.h.

Constructor & Destructor Documentation

◆ enumerator() [1/3]

template<class Alloc>
bm::bvector< Alloc >::enumerator::enumerator ( )
inline

Definition at line 435 of file bm.h.

◆ enumerator() [2/3]

template<class Alloc>
bm::bvector< Alloc >::enumerator::enumerator ( const bvector< Alloc > *  bv)
inline

Construct enumerator associated with a vector. This construction creates unpositioned iterator with status valid() == false. It can be re-positioned using go_first() or go_to()

Definition at line 442 of file bm.h.

◆ enumerator() [3/3]

template<class Alloc>
bm::bvector< Alloc >::enumerator::enumerator ( const bvector< Alloc > *  bv,
bm::id_t  pos 
)
inline

Construct enumerator for bit vector.

Parameters
bvbit-vector pointer
posbit position in the vector if position is 0, it finds the next 1 or becomes not valid (en.valid() == false)

Definition at line 454 of file bm.h.

Member Function Documentation

◆ go_first()

template<class Alloc>
void bm::bvector< Alloc >::enumerator::go_first ( )
inline

Position enumerator to the first available bit.

Definition at line 487 of file bm.h.

References bm::bits_in_array, bm::bits_in_block, BM_ASSERT, BM_IS_GAP, FULL_BLOCK_FAKE_ADDR, FULL_BLOCK_REAL_ADDR, and bm::set_array_size.

◆ go_to()

template<class Alloc>
enumerator& bm::bvector< Alloc >::enumerator::go_to ( bm::id_t  pos)
inline

◆ go_up()

template<class Alloc>
enumerator& bm::bvector< Alloc >::enumerator::go_up ( )
inline

◆ operator*()

template<class Alloc>
bm::id_t bm::bvector< Alloc >::enumerator::operator* ( ) const
inline

Get current position (value)

Definition at line 462 of file bm.h.

◆ operator++() [1/2]

template<class Alloc>
enumerator& bm::bvector< Alloc >::enumerator::operator++ ( )
inline

Advance enumerator forward to the next available bit.

Definition at line 473 of file bm.h.

◆ operator++() [2/2]

template<class Alloc>
enumerator bm::bvector< Alloc >::enumerator::operator++ ( int  )
inline

Definition at line 478 of file bm.h.

◆ value()

template<class Alloc>
bm::id_t bm::bvector< Alloc >::enumerator::value ( ) const
inline

Get current position (value)

Definition at line 468 of file bm.h.


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