BitMagic-C++
|
#include <bmsparsevec_serial.h>
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_ |
\brief Serialize sparse vector into a memory buffer(s) structure
Serialization format:
| HEADER | BIT-VECTORS ... | REMAP_MATRIX
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
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 160 of file bmsparsevec_serial.h.
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.
|
protected |
Definition at line 204 of file bmsparsevec_serial.h.
typedef SV::bvector_type bm::sparse_vector_serializer< SV >::bvector_type |
Definition at line 163 of file bmsparsevec_serial.h.
typedef const bvector_type* bm::sparse_vector_serializer< SV >::bvector_type_const_ptr |
Definition at line 164 of file bmsparsevec_serial.h.
typedef bvector_type* bm::sparse_vector_serializer< SV >::bvector_type_ptr |
Definition at line 165 of file bmsparsevec_serial.h.
typedef SV::size_type bm::sparse_vector_serializer< SV >::size_type |
Definition at line 167 of file bmsparsevec_serial.h.
typedef SV::value_type bm::sparse_vector_serializer< SV >::value_type |
Definition at line 166 of file bmsparsevec_serial.h.
bm::sparse_vector_serializer< SV >::sparse_vector_serializer | ( | ) |
Definition at line 606 of file bmsparsevec_serial.h.
|
protected |
Definition at line 619 of file bmsparsevec_serial.h.
|
inline |
Get XOR reference compression status (enabled/disabled)
Definition at line 190 of file bmsparsevec_serial.h.
References bm::sparse_vector_serializer< SV >::is_xor_ref_.
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.
sv | - sparse vector to serialize |
sv_layout | - buffer structure to keep the result as defined in bm::serialization_flags |
Definition at line 628 of file bmsparsevec_serial.h.
References BM_ASSERT, 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 main(), and bm::sparse_vector_serialize().
|
inline |
Add skip-markers for faster range deserialization.
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 |
Definition at line 183 of file bmsparsevec_serial.h.
References bm::sparse_vector_serializer< SV >::bvs_, and bm::serializer< BV >::set_bookmarks().
Referenced by main().
|
inline |
Turn ON and OFF XOR compression of sparse vectors.
Definition at line 187 of file bmsparsevec_serial.h.
References bm::sparse_vector_serializer< SV >::is_xor_ref_.
|
protected |
Definition at line 215 of file bmsparsevec_serial.h.
|
protected |
Definition at line 212 of file bmsparsevec_serial.h.
Referenced by bm::sparse_vector_serializer< SV >::set_bookmarks().
|
protected |
Definition at line 214 of file bmsparsevec_serial.h.
Referenced by bm::sparse_vector_serializer< SV >::is_xor_ref(), and bm::sparse_vector_serializer< SV >::set_xor_ref().