BitMagic-C++: bmserial.h File Reference

BitMagic-C++

Data Structures | Namespaces | Macros | Enumerations | Functions | Variables
bmserial.h File Reference

Serialization / compression of bvector<>. Set theoretical operations on compressed BLOBs. More...

`#include "encoding.h"`
`#include "bmfunc.h"`
`#include "bmtrans.h"`
`#include "bmalgo.h"`
`#include "bmutil.h"`
`#include "bmbuffer.h"`
`#include "bmdef.h"`
`#include "bmxor.h"`
`#include "bmundef.h"`
Include dependency graph for bmserial.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
class | bm::serializer< BV >
| Bit-vector serialization class. More...
struct | bm::serializer< BV >::bookmark_state
| Bookmark state structure. More...
class | bm::deseriaizer_base< DEC, BLOCK_IDX >
| Base deserialization class. More...
class | bm::deserializer< BV, DEC >
| Deserializer for bit-vector. More...
class | bm::iterator_deserializer< BV, SerialIterator >
| Iterator to walk forward the serialized stream. More...
class | bm::serial_stream_iterator< DEC, BLOCK_IDX >
| Serialization stream iterator. More...
class | bm::operation_deserializer< BV >
| Deserializer, performs logical operations between bit-vector and serialized bit-vector. More...

## Namespaces
| bm

## Macros
#define | BM_SER_NEXT_GRP(enc, nb, B_1ZERO, B_8ZERO, B_16ZERO, B_32ZERO, B_64ZERO)

## Enumerations
enum | bm::serialization_header_mask { bm::BM_HM_DEFAULT = 1, bm::BM_HM_RESIZE = (1 << 1), bm::BM_HM_ID_LIST = (1 << 2), bm::BM_HM_NO_BO = (1 << 3), bm::BM_HM_NO_GAPL = (1 << 4), bm::BM_HM_64_BIT = (1 << 5), bm::BM_HM_HXOR = (1 << 6) }
enum | bm::serialization_flags { bm::BM_NO_BYTE_ORDER = 1, bm::BM_NO_GAP_LENGTH = (1 << 1) }
| Bit mask flags for serialization algorithm. More...

## Functions
template<class BV >
size_t | bm::serialize (const BV &bv, unsigned char *buf, bm::word_t *temp_block=0, unsigned serialization_flags=0)
| Saves bitvector into memory. More...
template<class BV >
size_t | bm::serialize (BV &bv, unsigned char *buf, unsigned serialization_flags=0)
| Saves bitvector into memory. Allocates temporary memory block for bvector. More...
template<class BV >
size_t | bm::deserialize (BV &bv, const unsigned char *buf, bm::word_t *temp_block=0, const bm::bv_ref_vector< BV > *ref_vect=0)
| Bitvector deserialization from a memory BLOB. More...
template<class BV >
void | bm::deserialize_range (BV &bv, const unsigned char *buf, typename BV::size_type from, typename BV::size_type to, const bm::bv_ref_vector< BV > *ref_vect=0)
| Bitvector range deserialization from a memory BLOB. More...

## Variables
const unsigned | bm::set_compression_max = 5
| Maximum supported compression level. More...
const unsigned | bm::set_compression_default = 5
| Default compression level. More...
const unsigned char | bm::set_block_end = 0
| End of serialization. More...
const unsigned char | bm::set_block_1zero = 1
| One all-zero block. More...
const unsigned char | bm::set_block_1one = 2
| One block all-set (1111...) More...
const unsigned char | bm::set_block_8zero = 3
| Up to 256 zero blocks. More...
const unsigned char | bm::set_block_8one = 4
| Up to 256 all-set blocks. More...
const unsigned char | bm::set_block_16zero = 5
| Up to 65536 zero blocks. More...
const unsigned char | bm::set_block_16one = 6
| UP to 65536 all-set blocks. More...
const unsigned char | bm::set_block_32zero = 7
| Up to 4G zero blocks. More...
const unsigned char | bm::set_block_32one = 8
| UP to 4G all-set blocks. More...
const unsigned char | bm::set_block_azero = 9
| All other blocks zero. More...
const unsigned char | bm::set_block_aone = 10
| All other blocks one. More...
const unsigned char | bm::set_block_bit = 11
| Plain bit block. More...
const unsigned char | bm::set_block_sgapbit = 12
| SGAP compressed bitblock. More...
const unsigned char | bm::set_block_sgapgap = 13
| SGAP compressed GAP block. More...
const unsigned char | bm::set_block_gap = 14
| Plain GAP block. More...
const unsigned char | bm::set_block_gapbit = 15
| GAP compressed bitblock. More...
const unsigned char | bm::set_block_arrbit = 16
| List of bits ON. More...
const unsigned char | bm::set_block_bit_interval = 17
| Interval block. More...
const unsigned char | bm::set_block_arrgap = 18
| List of bits ON (GAP block) More...
const unsigned char | bm::set_block_bit_1bit = 19
| Bit block with 1 bit ON. More...
const unsigned char | bm::set_block_gap_egamma = 20
| Gamma compressed GAP block. More...
const unsigned char | bm::set_block_arrgap_egamma = 21
| Gamma compressed delta GAP array. More...
const unsigned char | bm::set_block_bit_0runs = 22
| Bit block with encoded zero intervals. More...
const unsigned char | bm::set_block_arrgap_egamma_inv = 23
| Gamma compressed inverted delta GAP array. More...
const unsigned char | bm::set_block_arrgap_inv = 24
| List of bits OFF (GAP block) More...
const unsigned char | bm::set_block_64zero = 25
| lots of zero blocks More...
const unsigned char | bm::set_block_64one = 26
| lots of all-set blocks More...
const unsigned char | bm::set_block_gap_bienc = 27
| Interpolated GAP block (legacy) More...
const unsigned char | bm::set_block_arrgap_bienc = 28
| Interpolated GAP array. More...
const unsigned char | bm::set_block_arrgap_bienc_inv = 29
| Interpolated GAP array (inverted) More...
const unsigned char | bm::set_block_arrbit_inv = 30
| List of bits OFF. More...
const unsigned char | bm::set_block_arr_bienc = 31
| Interpolated block as int array. More...
const unsigned char | bm::set_block_arr_bienc_inv = 32
| Interpolated inverted block int array. More...
const unsigned char | bm::set_block_bitgap_bienc = 33
| Interpolated bit-block as GAPs. More...
const unsigned char | bm::set_block_bit_digest0 = 34
| H-compression with digest mask. More...
const unsigned char | bm::set_block_ref_eq = 35
| block is a copy of a reference block More...
const unsigned char | bm::set_block_xor_ref8 = 36
| block is masked XOR of a reference block (8-bit) More...
const unsigned char | bm::set_block_xor_ref16 = 37
| block is masked XOR of a reference block (16-bit) More...
const unsigned char | bm::set_block_xor_ref32 = 38
| ..... 32-bit (should never happen) More...
const unsigned char | bm::set_block_xor_gap_ref8 = 39
| ..... 8-bit More...
const unsigned char | bm::set_block_xor_gap_ref16 = 40
| ..... 16-bit More...
const unsigned char | bm::set_block_xor_gap_ref32 = 41
| ..... 32-bit (should never happen) More...
const unsigned char | bm::set_block_xor_chain = 42
| XOR chain (reserved) More...
const unsigned char | bm::set_block_gap_bienc_v2 = 43
| Interpolated GAP block (v2) More...
const unsigned char | bm::set_block_arrgap_bienc_v2 = 44
| //!< Interpolated GAP array (v2) More...
const unsigned char | bm::set_block_arrgap_bienc_inv_v2 = 45
| Interpolated GAP array (inverted) More...
const unsigned char | bm::set_block_bitgap_bienc_v2 = 46
| Interpolated bit-block as GAPs (v2 - reseved) More...
const unsigned char | bm::set_nb_bookmark16 = 47
const unsigned char | bm::set_nb_bookmark24 = 48
const unsigned char | bm::set_nb_bookmark32 = 49
const unsigned char | bm::set_nb_sync_mark8 = 50
| bookmark sync point (8-bits) More...
const unsigned char | bm::set_nb_sync_mark16 = 51
const unsigned char | bm::set_nb_sync_mark24 = 52
const unsigned char | bm::set_nb_sync_mark32 = 53
const unsigned char | bm::set_nb_sync_mark48 = 54
const unsigned char | bm::set_nb_sync_mark64 = 55
| ..... 64-bit (should never happen) More...

## Detailed Description

Serialization / compression of bvector<>. Set theoretical operations on compressed BLOBs.

Definition in file bmserial.h.

## Macro Definition Documentation

## ◆ BM_SER_NEXT_GRP

#define BM_SER_NEXT_GRP | ( |  | enc,
|  |  | nb,
|  |  | B_1ZERO,
|  |  | B_8ZERO,
|  |  | B_16ZERO,
|  |  | B_32ZERO,
|  |  | B_64ZERO
| ) |  |

Value:
if (nb == 1u) \
enc.put_8(B_1ZERO); \
else if (nb < 256u) \
{ \
enc.put_8(B_8ZERO); \
enc.put_8((unsigned char)nb); \
} \
else if (nb < 65536u) \
{ \
enc.put_8(B_16ZERO); \
enc.put_16((unsigned short)nb); \
} \
else if (nb < bm::id_max32) \
{ \
enc.put_8(B_32ZERO); \
enc.put_32(unsigned(nb)); \
} \
else \
{\
enc.put_8(B_64ZERO); \
enc.put_64(nb); \
}

Definition at line 2128 of file bmserial.h.

bm::id_max32
const unsigned id_max32
Definition: bmconst.h:49