BitMagic-C++
Public Types | Public Member Functions | Protected Attributes
bm::serial_stream_iterator< DEC > Class Template Reference

Serialization stream iterator. More...

#include <bmserial.h>

Inheritance diagram for bm::serial_stream_iterator< DEC >:
Inheritance graph
[legend]
Collaboration diagram for bm::serial_stream_iterator< DEC >:
Collaboration graph
[legend]

Public Types

enum  iterator_state {
  e_unknown = 0, e_list_ids, e_blocks, e_zero_blocks,
  e_one_blocks, e_bit_block, e_gap_block
}
 iterator is a state machine, this enum encodes its key value More...
 
typedef deseriaizer_base< DEC >::decoder_type decoder_type
 
typedef bm::id_t block_idx_type
 
typedef unsigned(serial_stream_iterator< DEC >::* get_bit_func_type) (bm::word_t *, bm::word_t *)
 member function pointer for bitset-bitset get operations More...
 

Public Member Functions

 serial_stream_iterator (const unsigned char *buf)
 
 ~serial_stream_iterator ()
 
block_idx_type bv_size () const
 serialized bitvector size More...
 
bool is_eof () const
 Returns true if end of bit-stream reached. More...
 
void next ()
 get next block More...
 
block_idx_type skip_mono_blocks ()
 skip all zero or all-one blocks More...
 
unsigned get_bit_block (bm::word_t *dst_block, bm::word_t *tmp_block, set_operation op)
 read bit block, using logical operation More...
 
void get_gap_block (bm::gap_word_t *dst_block)
 Read gap block data (with head) More...
 
unsigned dec_size () const
 Return current decoder size. More...
 
decoder_typedecoder ()
 Get low level access to the decoder (use carefully) More...
 
iterator_state state () const
 Returns iterator internal state. More...
 
iterator_state get_state () const
 
unsigned get_id_count () const
 Number of ids in the inverted list (valid for e_list_ids) More...
 
bm::id_t get_id () const
 Get last id from the id list. More...
 
block_idx_type block_idx () const
 Get current block index. More...
 
unsigned get_bit_block_ASSIGN (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_OR (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_AND (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_SUB (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_XOR (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_COUNT (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_COUNT_AND (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_COUNT_OR (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_COUNT_XOR (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_COUNT_SUB_AB (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_COUNT_SUB_BA (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_COUNT_A (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_bit_block_COUNT_B (bm::word_t *dst_block, bm::word_t *tmp_block)
 
unsigned get_arr_bit (bm::word_t *dst_block, bool clear_target=true)
 Get array of bits out of the decoder into bit block (Converts inverted list into bits) Returns number of words (bits) being read. More...
 
unsigned get_block_type () const
 Get current block type. More...
 
unsigned get_bit ()
 
void get_inv_arr (bm::word_t *block)
 

Protected Attributes

get_bit_func_type bit_func_table_ [bm::set_END]
 
decoder_type decoder_
 
bool end_of_stream_
 
block_idx_type bv_size_
 
iterator_state state_
 
unsigned id_cnt_
 Id counter for id list. More...
 
bm::id_t last_id_
 Last id from the id list. More...
 
gap_word_t glevels_ [bm::gap_levels]
 GAP levels. More...
 
unsigned block_type_
 current block type More...
 
block_idx_type block_idx_
 current block index More...
 
block_idx_type mono_block_cnt_
 number of 0 or 1 blocks More...
 
gap_word_t gap_head_
 
gap_word_tblock_idx_arr_
 
- Protected Attributes inherited from bm::deseriaizer_base< DEC >
bm::gap_word_tid_array_
 ptr to idx array for temp decode use More...
 

Additional Inherited Members

- Protected Types inherited from bm::deseriaizer_base< DEC >
typedef DEC decoder_type
 
- Protected Member Functions inherited from bm::deseriaizer_base< DEC >
 deseriaizer_base ()
 
void read_gap_block (decoder_type &decoder, unsigned block_type, bm::gap_word_t *dst_block, bm::gap_word_t &gap_head)
 Read GAP block from the stream. More...
 
unsigned read_id_list (decoder_type &decoder, unsigned block_type, bm::gap_word_t *dst_arr)
 Read list of bit ids. More...
 
void read_bic_arr (decoder_type &decoder, bm::word_t *blk)
 Read binary interpolated list into a bit-set. More...
 
void read_bic_gap (decoder_type &decoder, bm::word_t *blk)
 Read binary interpolated gap blocks into a bitset. More...
 
void read_bic_arr_inv (decoder_type &decoder, bm::word_t *blk)
 Read inverted binary interpolated list into a bit-set. More...
 
void read_digest0_block (decoder_type &decoder, bm::word_t *blk)
 Read digest0-type bit-block. More...
 
- Static Protected Member Functions inherited from bm::deseriaizer_base< DEC >
static void read_0runs_block (decoder_type &decoder, bm::word_t *blk)
 read bit-block encoded as runs More...
 
static const char * err_msg ()
 

Detailed Description

template<class DEC>
class bm::serial_stream_iterator< DEC >

Serialization stream iterator.

Iterates blocks and control tokens of serialized bit-stream

Definition at line 475 of file bmserial.h.

Member Typedef Documentation

◆ block_idx_type

template<class DEC >
typedef bm::id_t bm::serial_stream_iterator< DEC >::block_idx_type

Definition at line 482 of file bmserial.h.

◆ decoder_type

template<class DEC >
typedef deseriaizer_base<DEC>::decoder_type bm::serial_stream_iterator< DEC >::decoder_type

Definition at line 478 of file bmserial.h.

◆ get_bit_func_type

template<class DEC >
typedef unsigned(serial_stream_iterator<DEC>::* bm::serial_stream_iterator< DEC >::get_bit_func_type) (bm::word_t *, bm::word_t *)

member function pointer for bitset-bitset get operations

Definition at line 549 of file bmserial.h.

Member Enumeration Documentation

◆ iterator_state

template<class DEC >
enum bm::serial_stream_iterator::iterator_state

iterator is a state machine, this enum encodes its key value

Enumerator
e_unknown 
e_list_ids 

plain int array

e_blocks 

stream of blocks

e_zero_blocks 

one or more zero bit blocks

e_one_blocks 

one or more all-1 bit blocks

e_bit_block 

one bit block

e_gap_block 

one gap block

Definition at line 519 of file bmserial.h.

Constructor & Destructor Documentation

◆ serial_stream_iterator()

template<class DEC >
bm::serial_stream_iterator< DEC >::serial_stream_iterator ( const unsigned char *  buf)

◆ ~serial_stream_iterator()

template<class DEC >
bm::serial_stream_iterator< DEC >::~serial_stream_iterator

Definition at line 2835 of file bmserial.h.

Member Function Documentation

◆ block_idx()

template<class DEC >
block_idx_type bm::serial_stream_iterator< DEC >::block_idx ( ) const
inline

Get current block index.

Definition at line 542 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::block_idx_.

◆ bv_size()

template<class DEC >
block_idx_type bm::serial_stream_iterator< DEC >::bv_size ( ) const
inline

serialized bitvector size

Definition at line 490 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::bv_size_.

◆ dec_size()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::dec_size ( ) const
inline

Return current decoder size.

Definition at line 511 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::decoder_.

◆ decoder()

template<class DEC >
decoder_type& bm::serial_stream_iterator< DEC >::decoder ( )
inline

Get low level access to the decoder (use carefully)

Definition at line 514 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::decoder_.

◆ get_arr_bit()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_arr_bit ( bm::word_t dst_block,
bool  clear_target = true 
)

Get array of bits out of the decoder into bit block (Converts inverted list into bits) Returns number of words (bits) being read.

Definition at line 4163 of file bmserial.h.

References bm::bit_block_set(), BM_ASSERT, bm::set_bit(), bm::set_block_arrbit, and bm::set_block_bit_1bit.

◆ get_bit()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit

Definition at line 4201 of file bmserial.h.

References BM_ASSERT, and bm::set_block_bit_1bit.

◆ get_bit_block()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block ( bm::word_t dst_block,
bm::word_t tmp_block,
set_operation  op 
)

read bit block, using logical operation

Definition at line 4230 of file bmserial.h.

References BM_ASSERT.

◆ get_bit_block_AND()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_AND ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_ASSIGN()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_ASSIGN ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_COUNT()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_COUNT ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_COUNT_A()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_A ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_COUNT_AND()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_AND ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_COUNT_B()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_B ( bm::word_t dst_block,
bm::word_t tmp_block 
)
inline

◆ get_bit_block_COUNT_OR()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_OR ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_COUNT_SUB_AB()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_SUB_AB ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_COUNT_SUB_BA()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_SUB_BA ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_COUNT_XOR()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_COUNT_XOR ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_OR()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_OR ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_SUB()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_SUB ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_bit_block_XOR()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_bit_block_XOR ( bm::word_t dst_block,
bm::word_t tmp_block 
)

◆ get_block_type()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_block_type ( ) const
inline

Get current block type.

Definition at line 588 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::block_type_.

◆ get_gap_block()

template<class DEC >
void bm::serial_stream_iterator< DEC >::get_gap_block ( bm::gap_word_t dst_block)

Read gap block data (with head)

Definition at line 4212 of file bmserial.h.

References BM_ASSERT, and bm::set_block_bit_1bit.

◆ get_id()

template<class DEC >
bm::id_t bm::serial_stream_iterator< DEC >::get_id ( ) const
inline

Get last id from the id list.

Definition at line 539 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::last_id_.

◆ get_id_count()

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::get_id_count ( ) const
inline

Number of ids in the inverted list (valid for e_list_ids)

Definition at line 536 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::id_cnt_.

◆ get_inv_arr()

template<class DEC >
void bm::serial_stream_iterator< DEC >::get_inv_arr ( bm::word_t block)

Definition at line 3005 of file bmserial.h.

References bm::bit_block_set(), and bm::clear_bit().

◆ get_state()

template<class DEC >
iterator_state bm::serial_stream_iterator< DEC >::get_state ( ) const
inline

Definition at line 534 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::state_.

◆ is_eof()

template<class DEC >
bool bm::serial_stream_iterator< DEC >::is_eof ( ) const
inline

Returns true if end of bit-stream reached.

Definition at line 493 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::end_of_stream_.

◆ next()

template<class DEC >
void bm::serial_stream_iterator< DEC >::next

◆ skip_mono_blocks()

template<class DEC >
serial_stream_iterator< DEC >::block_idx_type bm::serial_stream_iterator< DEC >::skip_mono_blocks

skip all zero or all-one blocks

Definition at line 2990 of file bmserial.h.

References BM_ASSERT.

◆ state()

template<class DEC >
iterator_state bm::serial_stream_iterator< DEC >::state ( ) const
inline

Returns iterator internal state.

Definition at line 532 of file bmserial.h.

References bm::serial_stream_iterator< DEC >::state_.

Field Documentation

◆ bit_func_table_

template<class DEC >
get_bit_func_type bm::serial_stream_iterator< DEC >::bit_func_table_[bm::set_END]
protected

◆ block_idx_

template<class DEC >
block_idx_type bm::serial_stream_iterator< DEC >::block_idx_
protected

current block index

Definition at line 606 of file bmserial.h.

Referenced by bm::serial_stream_iterator< DEC >::block_idx().

◆ block_idx_arr_

template<class DEC >
gap_word_t* bm::serial_stream_iterator< DEC >::block_idx_arr_
protected

◆ block_type_

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::block_type_
protected

current block type

Definition at line 605 of file bmserial.h.

Referenced by bm::serial_stream_iterator< DEC >::get_block_type().

◆ bv_size_

template<class DEC >
block_idx_type bm::serial_stream_iterator< DEC >::bv_size_
protected

◆ decoder_

template<class DEC >
decoder_type bm::serial_stream_iterator< DEC >::decoder_
protected

◆ end_of_stream_

template<class DEC >
bool bm::serial_stream_iterator< DEC >::end_of_stream_
protected

Definition at line 598 of file bmserial.h.

Referenced by bm::serial_stream_iterator< DEC >::is_eof().

◆ gap_head_

template<class DEC >
gap_word_t bm::serial_stream_iterator< DEC >::gap_head_
protected

Definition at line 609 of file bmserial.h.

◆ glevels_

template<class DEC >
gap_word_t bm::serial_stream_iterator< DEC >::glevels_[bm::gap_levels]
protected

GAP levels.

Definition at line 603 of file bmserial.h.

Referenced by bm::serial_stream_iterator< DEC >::serial_stream_iterator().

◆ id_cnt_

template<class DEC >
unsigned bm::serial_stream_iterator< DEC >::id_cnt_
protected

◆ last_id_

template<class DEC >
bm::id_t bm::serial_stream_iterator< DEC >::last_id_
protected

Last id from the id list.

Definition at line 602 of file bmserial.h.

Referenced by bm::serial_stream_iterator< DEC >::get_id().

◆ mono_block_cnt_

template<class DEC >
block_idx_type bm::serial_stream_iterator< DEC >::mono_block_cnt_
protected

number of 0 or 1 blocks

Definition at line 607 of file bmserial.h.

◆ state_

template<class DEC >
iterator_state bm::serial_stream_iterator< DEC >::state_
protected

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