BitMagicC++Library
Data Structures | Functions
Sparse vector serialization

Sparse vector serialization. More...

Collaboration diagram for Sparse vector serialization:

Data Structures

struct  bm::sparse_vector_serial_layout< SV >
 layout class for serialization buffer structure More...
 

Functions

template<class SV >
void bm::sparse_vector_serialize (const SV &sv, sparse_vector_serial_layout< SV > &sv_layout, bm::word_t *temp_block=0)
 Serialize sparse vector into a memory buffer(s) structure. More...
 

Detailed Description

Sparse vector serialization.

Function Documentation

◆ sparse_vector_serialize()

template<class SV >
void bm::sparse_vector_serialize ( const SV &  sv,
sparse_vector_serial_layout< SV > &  sv_layout,
bm::word_t temp_block = 0 
)

Serialize sparse vector into a memory buffer(s) structure.

Serialization format:

| HEADER | BITVECTRORS |
Header structure:
  BYTE+BYTE: Magic-signature 'BM'
  BYTE : Byte order ( 0 - Big Endian, 1 - Little Endian)
  BYTE : Number of Bit-vector plains (total)
  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
Parameters
sv- sparse vector to serialize
sv_layout- buffer structure to keep the result
temp_block- temporary buffer (allocate with BM_DECLARE_TEMP_BLOCK(x) for speed)
bv_serialization_flags- bit-vector serialization flags as defined in bm::serialization_flags
See also
serialization_flags
Examples:
svsample02.cpp.

Definition at line 153 of file bmsparsevec_serial.h.

References bm::sparse_vector_serial_layout< SV >::buf(), bm::globals< T >::byte_order(), bm::sparse_vector_serial_layout< SV >::capacity(), bm::serializer< BV >::gap_length_serialization(), bm::sparse_vector_serial_layout< SV >::get_plain(), bm::sparse_vector_serial_layout< SV >::reserve(), bm::sparse_vector_serial_layout< SV >::resize(), bm::serializer< BV >::serialize(), bm::serializer< BV >::set_compression_level(), and bm::sparse_vector_serial_layout< SV >::set_plain().

Referenced by main().