# bvector serialization
[BitMagic C++ Library]

Collaboration diagram for bvector serialization:

## Data Structures

class | bm::serializer< BV >
| Bit-vector serialization class. More...
class | bm::deseriaizer_base< DEC >
| Base deserialization class. More...
class | bm::deserializer< BV, DEC >
| Class deserializer. More...
class | bm::serial_stream_iterator< DEC >
| Serialization stream iterator. More...
class | bm::operation_deserializer< BV >
| Class deserializer, can perform logical operation on bit-vector and serialized bit-vector. More...

## Enumerations

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 >
unsigned | bm::serialize (const BV &bv, unsigned char *buf, bm::word_t *temp_block, unsigned serialization_flags=0)
| Saves bitvector into memory.
template<class BV >
unsigned | bm::serialize (BV &bv, unsigned char *buf, unsigned serialization_flags=0)
| Saves bitvector into memory. Allocates temporary memory block for bvector.
template<class BV >
unsigned | bm::deserialize (BV &bv, const unsigned char *buf, bm::word_t *temp_block=0)
| Bitvector deserialization from memory.

## Detailed Description

bvector serialization

## Enumeration Type Documentation

enum bm::serialization_flags

Bit mask flags for serialization algorithm.

Enumerator:

  BM_NO_BYTE_ORDER | save no byte-order info (save some space)
  BM_NO_GAP_LENGTH | save no GAP info (save some space)

Definition at line 1037 of file bmserial.h.

## Function Documentation

template<class BV >

unsigned bm::deserialize | ( | BV & | bv,
|  | const unsigned char * | buf,
|  | bm::word_t * | temp_block = `0` |
| ) |  |  | `[inline]`

Bitvector deserialization from memory.

Parameters:

  | buf | - pointer on memory which keeps serialized bvector
  | temp_block | - pointer on temporary block, if NULL bvector allocates own.

Returns:
  Number of bytes consumed by deserializer.

Function desrializes bitvector from memory block containig results of previous serialization. Function does not remove bits which are currently set. Effectively it means OR logical operation between current bitset and previously serialized one.

Examples:
  sample4.cpp.

Definition at line 1146 of file bmserial.h.

References bm::BigEndian, BM_ASSERT, bm::BM_HM_NO_BO, bm::globals< T >::byte_order(), bm::deserializer< BV, DEC >::deserialize(), bm::decoder_base::get_8(), and bm::LittleEndian.

Referenced by main().

template<class BV >

unsigned bm::serialize | ( | BV & | bv,
|  | unsigned char * | buf,
|  | unsigned | serialization_flags = `0` |
| ) |  |  | `[inline]`

Saves bitvector into memory. Allocates temporary memory block for bvector.

Definition at line 1110 of file bmserial.h.

References bm::BM_NO_BYTE_ORDER, bm::BM_NO_GAP_LENGTH, bm::serializer< BV >::byte_order_serialization(), bm::serializer< BV >::gap_length_serialization(), bm::serializer< BV >::serialize(), and bm::serializer< BV >::set_compression_level().

template<class BV >

unsigned bm::serialize | ( | const BV & | bv,
|  | unsigned char * | buf,
|  | bm::word_t * | temp_block,
|  | unsigned | serialization_flags = `0` |
| ) |  |  | `[inline]`

Saves bitvector into memory.

Function serializes content of the bitvector into memory. Serialization adaptively uses compression(variation of GAP encoding) when it is benefitial.

Parameters:

  | buf | - pointer on target memory area. No range checking in the function. It is responsibility of programmer to allocate sufficient amount of memory using information from calc_stat function.
  | temp_block | - pointer on temporary memory block. Cannot be 0; If you want to save memory across multiple bvectors allocate temporary block using allocate_tempblock and pass it to serialize. (Of course serialize does not deallocate temp_block.)
  | serialization_flags | Flags controlling serilization (bit-mask) (use OR-ed serialization flags)

Returns:
  Size of serialization block.

See also:
  calc_stat, serialization_flags

Definition at line 1084 of file bmserial.h.

References bm::BM_NO_BYTE_ORDER, bm::BM_NO_GAP_LENGTH, bm::serializer< BV >::byte_order_serialization(), bm::serializer< BV >::gap_length_serialization(), bm::serializer< BV >::serialize(), and bm::serializer< BV >::set_compression_level().