bm::sparse_vector_deserializer< SV > Class Template Reference

sparse vector de-serializer More...

`#include <bmsparsevec_serial.h>`

Inheritance diagram for bm::sparse_vector_deserializer< SV >:
[legend]
Collaboration diagram for bm::sparse_vector_deserializer< SV >:
[legend]

## 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
typedef bm::serializer< bvector_type >::bv_ref_vector_type | bv_ref_vector_type

## Public Member Functions

| sparse_vector_deserializer ()
| ~sparse_vector_deserializer ()
void | set_finalization (bm::finalization is_final)
| Set deserialization finalization to force deserialized vectors into READONLY (or READWRITE) mode.
void | set_xor_ref (bv_ref_vector_type *bv_ref_ptr)
| Set external XOR reference vectors (data frame referenece vectors).
void | deserialize (SV &sv, const unsigned char *buf, bool clear_sv=true)
void | deserialize_range (SV &sv, const unsigned char *buf, size_type from, size_type to, bool clear_sv=true)
void | deserialize (SV &sv, const unsigned char *buf, size_type from, size_type to)
void | deserialize (SV &sv, const unsigned char *buf, const bvector_type &mask_bv)
void | deserialize_structure (SV &sv, const unsigned char *buf)

## Protected Types

typedef bvector_type::allocator_type | alloc_type

## Protected Member Functions

unsigned | load_header (bm::decoder &dec, SV &sv, unsigned char &matr_s_ser)
| Deserialize header/version and other common info.
void | deserialize_sv (SV &sv, const unsigned char *buf, const bvector_type *mask_bv, bool clear_sv)
void | deserialize_planes (SV &sv, unsigned planes, const unsigned char *buf, const bvector_type *mask_bv=0)
| deserialize bit-vector planes
void | load_planes_off_table (const unsigned char *buf, bm::decoder &dec, unsigned planes)
| load offset table
int | load_null_plane (SV &sv, int planes, const unsigned char *buf, const bvector_type *mask_bv)
| load NULL bit-plane (returns new planes count)
void | load_remap (SV &sv, const unsigned char *remap_buf_ptr)
| load string remap dict
void | setup_xor_compression ()
| setup deserializers
void | clear_xor_compression ()
| unset XOR compression vectors

## Static Protected Member Functions

static void | raise_invalid_header ()
| throw error on incorrect deserialization
static void | raise_invalid_64bit ()
| throw error on incorrect deserialization
static void | raise_invalid_bitdepth ()
| throw error on incorrect deserialization
static void | raise_invalid_format ()
| throw error on incorrect deserialization
static void | raise_missing_remap_matrix ()
| throw error on incorrect deserialization

## Protected Attributes

bm::finalization | is_final_ = bm::finalization::UNDEFINED
const unsigned char * | remap_buf_ptr_ = 0
alloc_type | alloc_
bm::word_t * | temp_block_ = 0
allocator_pool_type | pool_
bvector_type | plane_digest_bv_
bm::id64_t | sv_size_
bm::id64_t | digest_offset_
bm::deserializer< bvector_type, bm::decoder > | deserial_
bm::operation_deserializer< bvector_type > | op_deserial_
bm::rank_compressor< bvector_type > | rsc_compressor_
bvector_type | not_null_mask_bv_
bvector_type | rsc_mask_bv_
bm::heap_vector< size_t, alloc_type, true > | off_vect_
bm::heap_vector< unsigned, alloc_type, true > | off32_vect_
rlen_vector_type | remap_rlen_vect_
bv_ref_vector_type | bv_ref_
| reference vector
bv_ref_vector_type * | bv_ref_ptr_ = 0
| external ref bit-vect
bool | idx_range_set_ = false
size_type | idx_range_from_
size_type | idx_range_to_

## Detailed Description

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

sparse vector de-serializer

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

Definition at line 326 of file bmsparsevec_serial.h.

## Member Typedef Documentation

## alloc_type

template<typename SV>

typedef bvector_type::allocator_type bm::sparse_vector_deserializer< SV >::alloc_type

protected

Definition at line 427 of file bmsparsevec_serial.h.

## allocator_pool_type

template<typename SV>

typedef bvector_type::allocator_type::allocator_pool_type bm::sparse_vector_deserializer< SV >::allocator_pool_type

Definition at line 334 of file bmsparsevec_serial.h.

## bv_ref_vector_type

template<typename SV>

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

Examples
  rscsample05.cpp.

Definition at line 335 of file bmsparsevec_serial.h.

## bvector_type

template<typename SV>

typedef SV::bvector_type bm::sparse_vector_deserializer< SV >::bvector_type

Definition at line 329 of file bmsparsevec_serial.h.

## bvector_type_const_ptr

template<typename SV>

typedef const bvector_type* bm::sparse_vector_deserializer< SV >::bvector_type_const_ptr

Definition at line 330 of file bmsparsevec_serial.h.

## bvector_type_ptr

template<typename SV>

typedef bvector_type* bm::sparse_vector_deserializer< SV >::bvector_type_ptr

Definition at line 331 of file bmsparsevec_serial.h.

## size_type

template<typename SV>

typedef SV::size_type bm::sparse_vector_deserializer< SV >::size_type

Definition at line 333 of file bmsparsevec_serial.h.

## value_type

template<typename SV>

typedef SV::value_type bm::sparse_vector_deserializer< SV >::value_type

Definition at line 332 of file bmsparsevec_serial.h.

## Constructor & Destructor Documentation

## sparse_vector_deserializer()

template<typename SV>

bm::sparse_vector_deserializer< SV >::sparse_vector_deserializer | ( |  | ) |

Definition at line 1156 of file bmsparsevec_serial.h.

References alloc_, not_null_mask_bv_, pool_, rsc_mask_bv_, and temp_block_.

## ~sparse_vector_deserializer()

template<typename SV>

bm::sparse_vector_deserializer< SV >::~sparse_vector_deserializer | ( |  | ) |

Definition at line 1166 of file bmsparsevec_serial.h.

References alloc_, and temp_block_.

## Member Function Documentation

## clear_xor_compression()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::clear_xor_compression | ( |  | ) |

protected

unset XOR compression vectors

Definition at line 1195 of file bmsparsevec_serial.h.

References bv_ref_, deserial_, and op_deserial_.

Referenced by deserialize_range(), deserialize_sv(), and set_xor_ref().

## deserialize() [1/3]

template<typename SV>

void bm::sparse_vector_deserializer< SV >::deserialize | ( | SV & | sv,
|  | const unsigned char * | buf,
|  | bool | clear_sv = true )

Deserialize sparse vector

Parameters

  sv | - [out] target sparse vector to populate
  buf | - input BLOB source memory pointer
  clear_sv | - if true clears the target vector (sv)

See also
  deserialize_range

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

Definition at line 1222 of file bmsparsevec_serial.h.

References BM_ASSERT, deserialize_sv(), and idx_range_set_.

Referenced by deserialize_df0(), deserialize_df2(), main(), SDemo2(), and bm::sparse_vector_deserialize().

## deserialize() [2/3]

template<typename SV>

void bm::sparse_vector_deserializer< SV >::deserialize | ( | SV & | sv,
|  | const unsigned char * | buf,
|  | const bvector_type & | mask_bv )

inline

Deserialize sparse vector using address mask vector Address mask defines (by set bits) which vector elements to be extracted from the compressed BLOB

Parameters

  sv | - [out] target sparse vector to populate
  buf | - source memory pointer
  mask_bv | - AND mask bit-vector (address gather vector)

Definition at line 409 of file bmsparsevec_serial.h.

## deserialize() [3/3]

template<typename SV>

void bm::sparse_vector_deserializer< SV >::deserialize | ( | SV & | sv,
|  | const unsigned char * | buf,
|  | size_type | from,
|  | size_type | to )

inline

Better use deserialize_range()

See also
  deserialize_range

Definition at line 392 of file bmsparsevec_serial.h.

## deserialize_planes()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::deserialize_planes | ( | SV & | sv,
|  | unsigned | planes,
|  | const unsigned char * | buf,
|  | const bvector_type * | mask_bv = 0 )

protected

deserialize bit-vector planes

Definition at line 1472 of file bmsparsevec_serial.h.

References BM_ASSERT, bv_ref_, bv_ref_ptr_, deserial_, idx_range_from_, idx_range_set_, idx_range_to_, is_final_, off_vect_, bm::bvector< Alloc >::opt_compress, pool_, bm::READONLY, remap_buf_ptr_, temp_block_, and bm::conditional< b >::test().

Referenced by deserialize_range(), and deserialize_sv().

## deserialize_range()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::deserialize_range | ( | SV & | sv,
|  | const unsigned char * | buf,
|  | size_type | from,
|  | size_type | to,
|  | bool | clear_sv = true )

Deserialize sparse vector for the range [from, to]

Parameters

  sv | - [out] target sparse vector to populate
  buf | - input BLOB source memory pointer
  from | - start vector index for deserialization range
  to | - end vector index for deserialization range
  clear_sv | - if true clears the target vector

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

Definition at line 1261 of file bmsparsevec_serial.h.

References bv_ref_, clear_xor_compression(), deserialize_planes(), idx_range_from_, idx_range_set_, idx_range_to_, load_header(), load_null_plane(), load_planes_off_table(), load_remap(), remap_buf_ptr_, setup_xor_compression(), sv_size_, and bm::conditional< b >::test().

Referenced by bm::sparse_vector_deserializer< sparse_vector_u32 >::deserialize(), and main().

## deserialize_structure()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::deserialize_structure | ( | SV & | sv,
|  | const unsigned char * | buf )

Load serialization descriptor, create vectors but DO NOT perform full deserialization

Parameters

  sv | - [out] target sparse vector to populate
  buf | - source memory pointer

Definition at line 1235 of file bmsparsevec_serial.h.

References BM_ASSERT, load_header(), load_planes_off_table(), and off_vect_.

Referenced by deserialize_df2().

## deserialize_sv()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::deserialize_sv | ( | SV & | sv,
|  | const unsigned char * | buf,
|  | const bvector_type * | mask_bv,
|  | bool | clear_sv )

protected

Definition at line 1333 of file bmsparsevec_serial.h.

References BM_ASSERT, bv_ref_, clear_xor_compression(), deserialize_planes(), idx_range_from_, idx_range_set_, idx_range_to_, load_header(), load_null_plane(), load_planes_off_table(), load_remap(), not_null_mask_bv_, bm::bvector< Alloc >::opt_compress, remap_buf_ptr_, rsc_compressor_, rsc_mask_bv_, setup_xor_compression(), sv_size_, and bm::conditional< b >::test().

Referenced by deserialize(), and bm::sparse_vector_deserializer< sparse_vector_u32 >::deserialize().

## load_header()

template<typename SV>

unsigned bm::sparse_vector_deserializer< SV >::load_header | ( | bm::decoder & | dec,
|  | SV & | sv,
|  | unsigned char & | matr_s_ser )

protected

Deserialize header/version and other common info.

Returns
  number of bit-planes

Definition at line 1417 of file bmsparsevec_serial.h.

References BM_ASSERT, digest_offset_, bm::decoder::get_64(), bm::decoder_base::get_8(), raise_invalid_64bit(), raise_invalid_bitdepth(), raise_invalid_header(), and sv_size_.

Referenced by deserialize_range(), deserialize_structure(), and deserialize_sv().

## load_null_plane()

template<typename SV>

int bm::sparse_vector_deserializer< SV >::load_null_plane | ( | SV & | sv,
|  | int | planes,
|  | const unsigned char * | buf,
|  | const bvector_type * | mask_bv )

protected

load NULL bit-plane (returns new planes count)

Definition at line 1559 of file bmsparsevec_serial.h.

References BM_ASSERT, bv_ref_, bv_ref_ptr_, deserial_, idx_range_from_, idx_range_set_, idx_range_to_, is_final_, off_vect_, bm::bvector< Alloc >::opt_compress, bm::READONLY, remap_buf_ptr_, temp_block_, and bm::conditional< b >::test().

Referenced by deserialize_range(), and deserialize_sv().

## load_planes_off_table()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::load_planes_off_table | ( | const unsigned char * | buf,
|  | bm::decoder & | dec,
|  | unsigned | planes )

protected

load offset table

Definition at line 1631 of file bmsparsevec_serial.h.

References bm::bit_in< TDecoder >::bic_decode_u32_cm(), BM_ASSERT, deserial_, digest_offset_, bm::decoder::get_32(), bm::decoder::get_64(), bm::decoder_base::get_8(), off32_vect_, off_vect_, plane_digest_bv_, and temp_block_.

Referenced by deserialize_range(), deserialize_structure(), and deserialize_sv().

## load_remap()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::load_remap | ( | SV & | sv,
|  | const unsigned char * | remap_buf_ptr )

protected

load string remap dict

Definition at line 1703 of file bmsparsevec_serial.h.

References BM_ASSERT, BMRESTRICT, bm::bit_in< TDecoder >::gamma(), bm::decoder::get_16(), bm::decoder::get_32(), bm::decoder::get_64(), bm::decoder_base::get_8(), bm::decoder_base::memcpy(), raise_invalid_format(), raise_missing_remap_matrix(), and remap_rlen_vect_.

Referenced by deserialize_range(), and deserialize_sv().

## raise_invalid_64bit()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::raise_invalid_64bit | ( |  | ) |

static protected

throw error on incorrect deserialization

Definition at line 1808 of file bmsparsevec_serial.h.

Referenced by load_header().

## raise_invalid_bitdepth()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::raise_invalid_bitdepth | ( |  | ) |

static protected

throw error on incorrect deserialization

Definition at line 1820 of file bmsparsevec_serial.h.

Referenced by load_header().

## raise_invalid_format()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::raise_invalid_format | ( |  | ) |

static protected

throw error on incorrect deserialization

Definition at line 1832 of file bmsparsevec_serial.h.

Referenced by load_remap().

## raise_invalid_header()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::raise_invalid_header | ( |  | ) |

static protected

throw error on incorrect deserialization

Definition at line 1796 of file bmsparsevec_serial.h.

Referenced by load_header().

## raise_missing_remap_matrix()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::raise_missing_remap_matrix | ( |  | ) |

static protected

throw error on incorrect deserialization

Definition at line 1844 of file bmsparsevec_serial.h.

Referenced by load_remap().

## set_finalization()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::set_finalization | ( | bm::finalization | is_final | ) |

Set deserialization finalization to force deserialized vectors into READONLY (or READWRITE) mode.

Performance impact: Turning ON finalization will make deserialization a lit slower, because each bit-vector will be re-converted into new mode (READONLY). Following (search) operations may perform a bit faster.

Parameters

  is_final | - finalization code (use bm::finalization::READONLY to produce an immutable vector)

Definition at line 1176 of file bmsparsevec_serial.h.

References is_final_.

Referenced by SDemo2().

## set_xor_ref()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::set_xor_ref | ( | bv_ref_vector_type * | bv_ref_ptr | ) |

Set external XOR reference vectors (data frame referenece vectors).

Parameters

  bv_ref_ptr | - external reference vector if NULL - resets the use of reference

Definition at line 1185 of file bmsparsevec_serial.h.

References bv_ref_ptr_, and clear_xor_compression().

Referenced by deserialize_df2().

## setup_xor_compression()

template<typename SV>

void bm::sparse_vector_deserializer< SV >::setup_xor_compression | ( |  | ) |

protected

setup deserializers

Definition at line 1205 of file bmsparsevec_serial.h.

References bv_ref_, bv_ref_ptr_, deserial_, and op_deserial_.

Referenced by deserialize_range(), and deserialize_sv().

## Field Documentation

## alloc_

template<typename SV>

alloc_type bm::sparse_vector_deserializer< SV >::alloc_

protected

Definition at line 483 of file bmsparsevec_serial.h.

Referenced by sparse_vector_deserializer(), and ~sparse_vector_deserializer().

## bv_ref_

template<typename SV>

bv_ref_vector_type bm::sparse_vector_deserializer< SV >::bv_ref_

protected

reference vector

Definition at line 501 of file bmsparsevec_serial.h.

Referenced by clear_xor_compression(), deserialize_planes(), deserialize_range(), deserialize_sv(), load_null_plane(), and setup_xor_compression().

## bv_ref_ptr_

template<typename SV>

bv_ref_vector_type* bm::sparse_vector_deserializer< SV >::bv_ref_ptr_ = 0

protected

external ref bit-vect

Definition at line 502 of file bmsparsevec_serial.h.

Referenced by deserialize_planes(), load_null_plane(), set_xor_ref(), and setup_xor_compression().

## deserial_

template<typename SV>

bm::deserializer<bvector_type, bm::decoder> bm::sparse_vector_deserializer< SV >::deserial_

protected

Definition at line 491 of file bmsparsevec_serial.h.

Referenced by clear_xor_compression(), deserialize_planes(), load_null_plane(), load_planes_off_table(), and setup_xor_compression().

## digest_offset_

template<typename SV>

bm::id64_t bm::sparse_vector_deserializer< SV >::digest_offset_

protected

Definition at line 489 of file bmsparsevec_serial.h.

Referenced by load_header(), and load_planes_off_table().

## idx_range_from_

template<typename SV>

size_type bm::sparse_vector_deserializer< SV >::idx_range_from_

protected

Definition at line 506 of file bmsparsevec_serial.h.

Referenced by deserialize_planes(), deserialize_range(), deserialize_sv(), and load_null_plane().

## idx_range_set_

template<typename SV>

bool bm::sparse_vector_deserializer< SV >::idx_range_set_ = false

protected

Definition at line 505 of file bmsparsevec_serial.h.

Referenced by deserialize(), deserialize_planes(), deserialize_range(), deserialize_sv(), and load_null_plane().

## idx_range_to_

template<typename SV>

size_type bm::sparse_vector_deserializer< SV >::idx_range_to_

protected

Definition at line 507 of file bmsparsevec_serial.h.

Referenced by deserialize_planes(), deserialize_range(), deserialize_sv(), and load_null_plane().

## is_final_

template<typename SV>

bm::finalization bm::sparse_vector_deserializer< SV >::is_final_ = bm::finalization::UNDEFINED

protected

Definition at line 481 of file bmsparsevec_serial.h.

Referenced by deserialize_planes(), load_null_plane(), and set_finalization().

## not_null_mask_bv_

template<typename SV>

bvector_type bm::sparse_vector_deserializer< SV >::not_null_mask_bv_

protected

Definition at line 494 of file bmsparsevec_serial.h.

Referenced by deserialize_sv(), and sparse_vector_deserializer().

## off32_vect_

template<typename SV>

bm::heap_vector<unsigned, alloc_type, true> bm::sparse_vector_deserializer< SV >::off32_vect_

protected

Definition at line 497 of file bmsparsevec_serial.h.

Referenced by load_planes_off_table().

## off_vect_

template<typename SV>

bm::heap_vector<size_t, alloc_type, true> bm::sparse_vector_deserializer< SV >::off_vect_

protected

Definition at line 496 of file bmsparsevec_serial.h.

Referenced by deserialize_planes(), deserialize_structure(), load_null_plane(), and load_planes_off_table().

## op_deserial_

template<typename SV>

bm::operation_deserializer<bvector_type> bm::sparse_vector_deserializer< SV >::op_deserial_

protected

Definition at line 492 of file bmsparsevec_serial.h.

Referenced by clear_xor_compression(), and setup_xor_compression().

## plane_digest_bv_

template<typename SV>

bvector_type bm::sparse_vector_deserializer< SV >::plane_digest_bv_

protected

Definition at line 487 of file bmsparsevec_serial.h.

Referenced by load_planes_off_table().

## pool_

template<typename SV>

allocator_pool_type bm::sparse_vector_deserializer< SV >::pool_

protected

Definition at line 485 of file bmsparsevec_serial.h.

Referenced by deserialize_planes(), and sparse_vector_deserializer().

## remap_buf_ptr_

template<typename SV>

const unsigned char* bm::sparse_vector_deserializer< SV >::remap_buf_ptr_ = 0

protected

Definition at line 482 of file bmsparsevec_serial.h.

Referenced by deserialize_planes(), deserialize_range(), deserialize_sv(), and load_null_plane().

## remap_rlen_vect_

template<typename SV>

rlen_vector_type bm::sparse_vector_deserializer< SV >::remap_rlen_vect_

protected

Definition at line 498 of file bmsparsevec_serial.h.

Referenced by load_remap().

## rsc_compressor_

template<typename SV>

bm::rank_compressor<bvector_type> bm::sparse_vector_deserializer< SV >::rsc_compressor_

protected

Definition at line 493 of file bmsparsevec_serial.h.

Referenced by deserialize_sv().

## rsc_mask_bv_

template<typename SV>

bvector_type bm::sparse_vector_deserializer< SV >::rsc_mask_bv_

protected

Definition at line 495 of file bmsparsevec_serial.h.

Referenced by deserialize_sv(), and sparse_vector_deserializer().

## sv_size_

template<typename SV>

bm::id64_t bm::sparse_vector_deserializer< SV >::sv_size_

protected

Definition at line 488 of file bmsparsevec_serial.h.

Referenced by deserialize_range(), deserialize_sv(), and load_header().

## temp_block_

template<typename SV>

bm::word_t* bm::sparse_vector_deserializer< SV >::temp_block_ = 0

protected

Definition at line 484 of file bmsparsevec_serial.h.

Referenced by deserialize_planes(), load_null_plane(), load_planes_off_table(), sparse_vector_deserializer(), and ~sparse_vector_deserializer().

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

- bmsparsevec_serial.h