BitMagic-C++
Public Types | Public Member Functions | Protected Attributes
bm::sparse_vector_serializer< SV > Class Template Reference

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

#include <bmsparsevec_serial.h>

Collaboration diagram for bm::sparse_vector_serializer< SV >:
Collaboration graph
[legend]

Public Types

typedef SV::bvector_type bvector_type
 
typedef const bvector_typebvector_type_const_ptr
 
typedef bvector_typebvector_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 serialize (const SV &sv, sparse_vector_serial_layout< SV > &sv_layout)
 Serialize sparse vector into a memory buffer(s) structure. More...
 

Protected Attributes

bm::serializer< bvector_typebvs_
 

Detailed Description

template<typename SV>
class bm::sparse_vector_serializer< SV >

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

Definition at line 157 of file bmsparsevec_serial.h.

Member Typedef Documentation

◆ allocator_pool_type

Definition at line 165 of file bmsparsevec_serial.h.

◆ bvector_type

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

Definition at line 160 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 161 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 162 of file bmsparsevec_serial.h.

◆ size_type

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

Definition at line 164 of file bmsparsevec_serial.h.

◆ value_type

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

Definition at line 163 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 480 of file bmsparsevec_serial.h.

Member Function Documentation

◆ serialize()

template<typename SV >
void bm::sparse_vector_serializer< SV >::serialize ( const SV &  sv,
sparse_vector_serial_layout< SV > &  sv_layout 
)

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

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

Definition at line 488 of file bmsparsevec_serial.h.

References BM_ASSERT, bm::sparse_vector_serial_layout< SV >::buf(), bm::globals< T >::byte_order(), bm::sparse_vector_serial_layout< SV >::capacity(), bm::sparse_vector_serial_layout< SV >::get_plain(), bm::encoder::memcpy(), bm::encoder::put_64(), bm::encoder::put_8(), bm::sparse_vector_serial_layout< SV >::reserve(), bm::sparse_vector_serial_layout< SV >::resize(), bm::sparse_vector_serial_layout< SV >::set_plain(), and bm::encoder::size().

Referenced by bm::sparse_vector_serialize().

Field Documentation

◆ bvs_

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

Definition at line 185 of file bmsparsevec_serial.h.


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