BitMagic-C++

#include <bmsparsevec_serial.h>

Collaboration diagram for bm::sparse_vector_serializer< SV >:

Public Types

typedef SV::bvector_type bvector_type
typedef const bvector_type * bvector_type_const_ptr
typedef bvector_type * bvector_type_ptr
typedef SV::value_type value_type
typedef SV::size_type size_type
typedef bvector_type::allocator_type::allocator_pool_type allocator_pool_type

Public Member Functions

 sparse_vector_serializer ()
void set_bookmarks (bool enable, unsigned bm_interval=256)
 Add skip-markers for faster range deserialization.
void set_xor_ref (bool is_enabled)
 Turn ON and OFF XOR compression of sparse vectors.
bool is_xor_ref () const
 Get XOR reference compression status (enabled/disabled).
void serialize (const SV &sv, sparse_vector_serial_layout< SV > &sv_layout)
 Serialize sparse vector into a memory buffer(s) structure.

Protected Types

typedef bm::serializer< bvector_type >::bv_ref_vector_type bv_ref_vector_type

Protected Member Functions

void build_xor_ref_vector (const SV &sv)

Protected Attributes

bm::serializer< bvector_type > bvs_
bool is_xor_ref_
bv_ref_vector_type bv_ref_

Detailed Description

template<typename SV>
class bm::sparse_vector_serializer< SV >
\brief Serialize sparse vector into a memory buffer(s) structure

Serialization format:

| HEADER | BIT-VECTORS ... | REMAP_MATRIX

Header structure:

BYTE+BYTE: Magic-signature 'BM' or 'BC' (c-compressed) BYTE : Byte order ( 0 - Big Endian, 1 - Little Endian) { BYTE : Number of Bit-vector plains (total) (non-zero when < 255 plains) | BYTE: zero - flag of large plain matrix INT64: Nnmber of bit-vector plains } INT64: Vector size INT64: Offset of plain 0 from the header start (value 0 means plain is empty) INT64: Offset of plain 1 from ... INT32: reserved

Bit-vectors:

Based on current bit-vector serialization

Remap Matrix: SubHeader | Matrix BLOB

sub-header: BYTE: 'R' (remapping) or 'N' (no remapping) N - means no other info is saved on the stream INT64: remap matrix size

Examples
rscsample02.cpp, strsvsample05.cpp, and svsample08.cpp.

Definition at line 160 of file bmsparsevec_serial.h.

Member Typedef Documentation

◆ allocator_pool_type

template<typename SV>
typedef bvector_type::allocator_type::allocator_pool_type bm::sparse_vector_serializer< SV >::allocator_pool_type

Definition at line 169 of file bmsparsevec_serial.h.

◆ bv_ref_vector_type

template<typename SV>
typedef bm::serializer<bvector_type>::bv_ref_vector_type bm::sparse_vector_serializer< SV >::bv_ref_vector_type
protected

Definition at line 204 of file bmsparsevec_serial.h.

◆ bvector_type

template<typename SV>
typedef SV::bvector_type bm::sparse_vector_serializer< SV >::bvector_type

Definition at line 163 of file bmsparsevec_serial.h.

◆ bvector_type_const_ptr

template<typename SV>
typedef const bvector_type* bm::sparse_vector_serializer< SV >::bvector_type_const_ptr

Definition at line 164 of file bmsparsevec_serial.h.

◆ bvector_type_ptr

template<typename SV>
typedef bvector_type* bm::sparse_vector_serializer< SV >::bvector_type_ptr

Definition at line 165 of file bmsparsevec_serial.h.

◆ size_type

template<typename SV>
typedef SV::size_type bm::sparse_vector_serializer< SV >::size_type

Definition at line 167 of file bmsparsevec_serial.h.

◆ value_type

template<typename SV>
typedef SV::value_type bm::sparse_vector_serializer< SV >::value_type

Definition at line 166 of file bmsparsevec_serial.h.

Constructor & Destructor Documentation

◆ sparse_vector_serializer()

template<typename SV>
bm::sparse_vector_serializer< SV >::sparse_vector_serializer ( )

Definition at line 606 of file bmsparsevec_serial.h.

References bvs_, and is_xor_ref_.

Member Function Documentation

◆ build_xor_ref_vector()

template<typename SV>
void bm::sparse_vector_serializer< SV >::build_xor_ref_vector ( const SV & sv)
protected

Definition at line 619 of file bmsparsevec_serial.h.

References bv_ref_.

Referenced by serialize().

◆ is_xor_ref()

template<typename SV>
bool bm::sparse_vector_serializer< SV >::is_xor_ref ( ) const
inline

Get XOR reference compression status (enabled/disabled).

Definition at line 190 of file bmsparsevec_serial.h.

References is_xor_ref_.

Referenced by serialize().

◆ serialize()

◆ set_bookmarks()

template<typename SV>
void bm::sparse_vector_serializer< SV >::set_bookmarks ( bool enable,
unsigned bm_interval = 256 )
inline

Add skip-markers for faster range deserialization.

Parameters
enable- TRUE searilization will add bookmark codes
bm_interval- bookmark interval in (number of blocks) (suggested between 4 and 512) smaller interval means more bookmarks added to the skip list thus more increasing the BLOB size
Examples
rscsample02.cpp, strsvsample05.cpp, and svsample08.cpp.

Definition at line 183 of file bmsparsevec_serial.h.

References bvs_.

Referenced by main().

◆ set_xor_ref()

template<typename SV>
void bm::sparse_vector_serializer< SV >::set_xor_ref ( bool is_enabled)
inline

Turn ON and OFF XOR compression of sparse vectors.

Definition at line 187 of file bmsparsevec_serial.h.

References is_xor_ref_.

Field Documentation

◆ bv_ref_

template<typename SV>
bv_ref_vector_type bm::sparse_vector_serializer< SV >::bv_ref_
protected

Definition at line 215 of file bmsparsevec_serial.h.

Referenced by build_xor_ref_vector(), and serialize().

◆ bvs_

template<typename SV>
bm::serializer<bvector_type> bm::sparse_vector_serializer< SV >::bvs_
protected

Definition at line 212 of file bmsparsevec_serial.h.

Referenced by serialize(), set_bookmarks(), and sparse_vector_serializer().

◆ is_xor_ref_

template<typename SV>
bool bm::sparse_vector_serializer< SV >::is_xor_ref_
protected

Definition at line 214 of file bmsparsevec_serial.h.

Referenced by is_xor_ref(), set_xor_ref(), and sparse_vector_serializer().


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