dlvhex
2.5.0
|
Bit-vector serialization class. More...
#include <vs10/bm/bmserial.h>
Public Types | |
typedef BV::allocator_type | allocator_type |
typedef BV::blocks_manager_type | blocks_manager_type |
typedef BV::allocator_type | allocator_type |
typedef BV::blocks_manager_type | blocks_manager_type |
Public Member Functions | |
serializer (const allocator_type &alloc=allocator_type()) | |
~serializer () | |
void | set_compression_level (unsigned clevel) |
Set compression level. | |
unsigned | get_compression_level () const |
Get compression level. | |
unsigned | serialize (const BV &bv, unsigned char *buf, unsigned buf_size) |
Bitvector serilization into memory block. | |
void | gap_length_serialization (bool value) |
Set GAP length serialization (serializes GAP levels of the original vector) | |
void | byte_order_serialization (bool value) |
Set byte-order serialization (for cross platform compatibility) | |
serializer (const allocator_type &alloc=allocator_type()) | |
~serializer () | |
void | set_compression_level (unsigned clevel) |
Set compression level. | |
unsigned | get_compression_level () const |
Get compression level. | |
unsigned | serialize (const BV &bv, unsigned char *buf, unsigned buf_size) |
Bitvector serilization into memory block. | |
void | gap_length_serialization (bool value) |
Set GAP length serialization (serializes GAP levels of the original vector) | |
void | byte_order_serialization (bool value) |
Set byte-order serialization (for cross platform compatibility) | |
Protected Member Functions | |
void | encode_header (const BV &bv, bm::encoder &enc) |
Encode serialization header information. | |
void | encode_gap_block (bm::gap_word_t *gap_block, bm::encoder &enc) |
Encode GAP block. | |
void | gamma_gap_block (bm::gap_word_t *gap_block, bm::encoder &enc) |
Encode GAP block with Elias Gamma coder. | |
void | gamma_gap_array (const bm::gap_word_t *gap_block, unsigned arr_len, bm::encoder &enc, bool inverted=false) |
Encode GAP block as delta-array with Elias Gamma coder. | |
void | encode_bit_interval (const bm::word_t *blk, bm::encoder &enc, unsigned size_control) |
Encode BIT block with repeatable runs of zeroes. | |
void | encode_header (const BV &bv, bm::encoder &enc) |
Encode serialization header information. | |
void | encode_gap_block (bm::gap_word_t *gap_block, bm::encoder &enc) |
Encode GAP block. | |
void | gamma_gap_block (bm::gap_word_t *gap_block, bm::encoder &enc) |
Encode GAP block with Elias Gamma coder. | |
void | gamma_gap_array (const bm::gap_word_t *gap_block, unsigned arr_len, bm::encoder &enc, bool inverted=false) |
Encode GAP block as delta-array with Elias Gamma coder. | |
void | encode_bit_interval (const bm::word_t *blk, bm::encoder &enc, unsigned size_control) |
Encode BIT block with repeatable runs of zeroes. | |
Private Types | |
typedef bm::bit_out< bm::encoder > | bit_out_type |
typedef bm::gamma_encoder < bm::gap_word_t, bit_out_type > | gamma_encoder_func |
typedef bm::bit_out< bm::encoder > | bit_out_type |
typedef bm::gamma_encoder < bm::gap_word_t, bit_out_type > | gamma_encoder_func |
Private Member Functions | |
serializer (const serializer &) | |
serializer & | operator= (const serializer &) |
serializer (const serializer &) | |
serializer & | operator= (const serializer &) |
Private Attributes | |
allocator_type | alloc_ |
bool | gap_serial_ |
bool | byte_order_serial_ |
bm::word_t * | temp_block_ |
unsigned | compression_level_ |
Bit-vector serialization class.
Class designed to convert sparse bit-vector into a block of memory ready for file or database storage or network transfer.
Definition at line 146 of file bmserial.h.
typedef BV::allocator_type bm::serializer< BV >::allocator_type |
Definition at line 149 of file bmserial.h.
typedef BV::allocator_type bm::serializer< BV >::allocator_type |
Definition at line 149 of file bmserial.h.
typedef bm::bit_out<bm::encoder> bm::serializer< BV >::bit_out_type [private] |
Definition at line 235 of file bmserial.h.
typedef bm::bit_out<bm::encoder> bm::serializer< BV >::bit_out_type [private] |
Definition at line 235 of file bmserial.h.
typedef BV::blocks_manager_type bm::serializer< BV >::blocks_manager_type |
Definition at line 150 of file bmserial.h.
typedef BV::blocks_manager_type bm::serializer< BV >::blocks_manager_type |
Definition at line 150 of file bmserial.h.
typedef bm::gamma_encoder<bm::gap_word_t, bit_out_type> bm::serializer< BV >::gamma_encoder_func [private] |
Definition at line 236 of file bmserial.h.
typedef bm::gamma_encoder<bm::gap_word_t, bit_out_type> bm::serializer< BV >::gamma_encoder_func [private] |
Definition at line 236 of file bmserial.h.
bm::serializer< BV >::serializer | ( | const allocator_type & | alloc = allocator_type() | ) |
Definition at line 544 of file bmserial.h.
References bm::serializer< BV >::alloc_, and bm::serializer< BV >::temp_block_.
bm::serializer< BV >::~serializer | ( | ) |
Definition at line 567 of file bmserial.h.
bm::serializer< BV >::serializer | ( | const serializer< BV > & | ) | [private] |
bm::serializer< BV >::serializer | ( | const allocator_type & | alloc = allocator_type() | ) |
bm::serializer< BV >::~serializer | ( | ) |
bm::serializer< BV >::serializer | ( | const serializer< BV > & | ) | [private] |
void bm::serializer< BV >::byte_order_serialization | ( | bool | value | ) |
Set byte-order serialization (for cross platform compatibility)
value | - TRUE serialization format includes byte-order marker |
Definition at line 580 of file bmserial.h.
Referenced by bm::serialize().
void bm::serializer< BV >::byte_order_serialization | ( | bool | value | ) |
Set byte-order serialization (for cross platform compatibility)
value | - TRUE serialization format includes byte-order marker |
void bm::serializer< BV >::encode_bit_interval | ( | const bm::word_t * | blk, |
bm::encoder & | enc, | ||
unsigned | size_control | ||
) | [protected] |
Encode BIT block with repeatable runs of zeroes.
Definition at line 762 of file bmserial.h.
References bm::encoder::put_16(), bm::encoder::put_32(), bm::encoder::put_8(), bm::set_block_bit_0runs, and bm::set_block_size.
void bm::serializer< BV >::encode_bit_interval | ( | const bm::word_t * | blk, |
bm::encoder & | enc, | ||
unsigned | size_control | ||
) | [protected] |
Encode BIT block with repeatable runs of zeroes.
void bm::serializer< BV >::encode_gap_block | ( | bm::gap_word_t * | gap_block, |
bm::encoder & | enc | ||
) | [protected] |
Encode GAP block.
void bm::serializer< BV >::encode_gap_block | ( | bm::gap_word_t * | gap_block, |
bm::encoder & | enc | ||
) | [protected] |
Encode GAP block.
Definition at line 709 of file bmserial.h.
References bm::gap_bit_count(), bm::gap_convert_to_arr(), bm::gap_equiv_len, bm::gap_length(), bm::gap_max_bits, bm::encoder::put_16(), bm::encoder::put_8(), and bm::set_block_bit_1bit.
void bm::serializer< BV >::encode_header | ( | const BV & | bv, |
bm::encoder & | enc | ||
) | [protected] |
Encode serialization header information.
void bm::serializer< BV >::encode_header | ( | const BV & | bv, |
bm::encoder & | enc | ||
) | [protected] |
Encode serialization header information.
Definition at line 586 of file bmserial.h.
References bm::BM_HM_DEFAULT, bm::BM_HM_NO_BO, bm::BM_HM_NO_GAPL, bm::BM_HM_RESIZE, bm::globals< T >::byte_order(), bm::gap_levels, bm::id_max, bm::encoder::put_16(), bm::encoder::put_32(), and bm::encoder::put_8().
void bm::serializer< BV >::gamma_gap_array | ( | const bm::gap_word_t * | gap_block, |
unsigned | arr_len, | ||
bm::encoder & | enc, | ||
bool | inverted = false |
||
) | [protected] |
Encode GAP block as delta-array with Elias Gamma coder.
void bm::serializer< BV >::gamma_gap_array | ( | const bm::gap_word_t * | gap_block, |
unsigned | arr_len, | ||
bm::encoder & | enc, | ||
bool | inverted = false |
||
) | [protected] |
Encode GAP block as delta-array with Elias Gamma coder.
Definition at line 662 of file bmserial.h.
References bm::bit_out< TEncoder >::gamma(), bm::encoder::get_pos(), bm::encoder::put_8(), bm::encoder::put_prefixed_array_16(), bm::set_block_arrgap, bm::set_block_arrgap_egamma, bm::set_block_arrgap_egamma_inv, bm::set_block_arrgap_inv, and bm::encoder::set_pos().
void bm::serializer< BV >::gamma_gap_block | ( | bm::gap_word_t * | gap_block, |
bm::encoder & | enc | ||
) | [protected] |
Encode GAP block with Elias Gamma coder.
Definition at line 625 of file bmserial.h.
References bm::for_each_dgap(), bm::gap_length(), bm::encoder::get_pos(), bm::encoder::put_16(), bm::encoder::put_8(), bm::set_block_gap, bm::set_block_gap_egamma, and bm::encoder::set_pos().
void bm::serializer< BV >::gamma_gap_block | ( | bm::gap_word_t * | gap_block, |
bm::encoder & | enc | ||
) | [protected] |
Encode GAP block with Elias Gamma coder.
void bm::serializer< BV >::gap_length_serialization | ( | bool | value | ) |
Set GAP length serialization (serializes GAP levels of the original vector)
value | - when TRUE serialized vector includes GAP levels parameters |
Definition at line 574 of file bmserial.h.
Referenced by bm::serialize().
void bm::serializer< BV >::gap_length_serialization | ( | bool | value | ) |
Set GAP length serialization (serializes GAP levels of the original vector)
value | - when TRUE serialized vector includes GAP levels parameters |
unsigned bm::serializer< BV >::get_compression_level | ( | ) | const |
Get compression level.
Definition at line 561 of file bmserial.h.
unsigned bm::serializer< BV >::get_compression_level | ( | ) | const |
Get compression level.
serializer& bm::serializer< BV >::operator= | ( | const serializer< BV > & | ) | [private] |
serializer& bm::serializer< BV >::operator= | ( | const serializer< BV > & | ) | [private] |
unsigned bm::serializer< BV >::serialize | ( | const BV & | bv, |
unsigned char * | buf, | ||
unsigned | buf_size | ||
) |
Bitvector serilization into memory block.
bv | - input bitvector |
buf | - out buffer (pre-allocated) No range checking is done in this method. It is responsibility of caller to allocate sufficient amount of memory using information from calc_stat() function. |
buf_size | - size of the output buffer |
unsigned bm::serializer< BV >::serialize | ( | const BV & | bv, |
unsigned char * | buf, | ||
unsigned | buf_size | ||
) |
Bitvector serilization into memory block.
bv | - input bitvector |
buf | - out buffer (pre-allocated) No range checking is done in this method. It is responsibility of caller to allocate sufficient amount of memory using information from calc_stat() function. |
buf_size | - size of the output buffer |
Definition at line 814 of file bmserial.h.
References bm::bit_block_calc_count_change(), bm::bit_convert_to_arr(), bm::bit_convert_to_gap(), bm::bit_count_nonzero_size(), bm::bit_find_in_block(), BM_IS_GAP, BMGAP_PTR, bm::gap_equiv_len, bm::gap_max_bits, bm::encoder::put_16(), bm::encoder::put_8(), bm::encoder::put_prefixed_array_32(), SER_NEXT_GRP, bm::set_block_16one, bm::set_block_16zero, bm::set_block_1one, bm::set_block_1zero, bm::set_block_32one, bm::set_block_32zero, bm::set_block_8one, bm::set_block_8zero, bm::set_block_aone, bm::set_block_azero, bm::set_block_bit, bm::set_block_bit_1bit, bm::set_block_end, bm::set_block_size, bm::set_total_blocks, and bm::encoder::size().
Referenced by bm::serialize().
void bm::serializer< BV >::set_compression_level | ( | unsigned | clevel | ) |
Set compression level.
Higher compression takes more time to process.
clevel | - compression level (0-4) |
Definition at line 555 of file bmserial.h.
Referenced by bm::serialize().
void bm::serializer< BV >::set_compression_level | ( | unsigned | clevel | ) |
Set compression level.
Higher compression takes more time to process.
clevel | - compression level (0-4) |
allocator_type bm::serializer< BV >::alloc_ [private] |
Definition at line 239 of file bmserial.h.
Referenced by bm::serializer< BV >::serializer().
bool bm::serializer< BV >::byte_order_serial_ [private] |
Definition at line 241 of file bmserial.h.
unsigned bm::serializer< BV >::compression_level_ [private] |
Definition at line 243 of file bmserial.h.
bool bm::serializer< BV >::gap_serial_ [private] |
Definition at line 240 of file bmserial.h.
bm::word_t * bm::serializer< BV >::temp_block_ [private] |
Definition at line 242 of file bmserial.h.
Referenced by bm::serializer< BV >::serializer().