NCBI C++ ToolKit
Classes | Enumerations | Functions
bvector<> serialization
+ Collaboration diagram for bvector<> serialization:

Classes

class  bm::serializer< BV >
 Bit-vector serialization class. More...
 
class  bm::deseriaizer_base< DEC, BLOCK_IDX >
 Base deserialization class. More...
 
class  bm::deserializer< BV, DEC >
 Deserializer for bit-vector. More...
 
class  bm::serial_stream_iterator< DEC, BLOCK_IDX >
 Serialization stream iterator. More...
 
class  bm::operation_deserializer< BV >
 Deserializer, performs logical operations between bit-vector and serialized bit-vector. More...
 

Enumerations

enum  bm::serialization_flags { bm::BM_NO_BYTE_ORDER = 1 , bm::BM_NO_GAP_LENGTH = (1 << 1) }
 Bit mask flags for serialization algorithm. More...
 

Functions

template<class BV >
size_t bm::serialize (const BV &bv, unsigned char *buf, bm::word_t *temp_block=0, unsigned serialization_flags=0)
 Saves bitvector into memory. More...
 
template<class BV >
size_t bm::serialize (BV &bv, unsigned char *buf, unsigned serialization_flags=0)
 Saves bitvector into memory. Allocates temporary memory block for bvector. More...
 
template<class BV >
size_t bm::deserialize (BV &bv, const unsigned char *buf, bm::word_t *temp_block=0, const bm::bv_ref_vector< BV > *ref_vect=0)
 Bitvector deserialization from a memory BLOB. More...
 
template<class BV >
void bm::deserialize_range (BV &bv, const unsigned char *buf, typename BV::size_type from, typename BV::size_type to, const bm::bv_ref_vector< BV > *ref_vect=0)
 Bitvector range deserialization from a memory BLOB. More...
 

Detailed Description

Serialization for bvector<> container

Enumeration Type Documentation

◆ serialization_flags

Bit mask flags for serialization algorithm.

Enumerator
BM_NO_BYTE_ORDER 

save no byte-order info (save some space)

BM_NO_GAP_LENGTH 

save no GAP info (save some space)

Definition at line 3023 of file bmserial.h.

Function Documentation

◆ deserialize()

template<class BV >
size_t bm::deserialize ( BV &  bv,
const unsigned char *  buf,
bm::word_t temp_block = 0,
const bm::bv_ref_vector< BV > *  ref_vect = 0 
)

Bitvector deserialization from a memory BLOB.

Parameters
bv- target bvector
buf- pointer on memory which keeps serialized bvector
temp_block- pointer on temporary block, if NULL bvector allocates own.
ref_vect- [in] optional pointer to a list of reference vectors used for XOR compression.
Returns
Number of bytes consumed by deserializer.

Function deserializes bitvector from memory block containig results of previous serialization. Function does not remove bits which are currently set. Effectively it is OR logical operation between the target bit-vector and serialized one.

See also
deserialize_range

Definition at line 3137 of file bmserial.h.

References bm::BigEndian, BM_ASSERT, bm::BM_HM_NO_BO, buf, bm::globals< T >::byte_order(), bm::deserializer< BV, DEC >::deserialize(), bm::decoder_base::get_8(), bm::LittleEndian, and bm::deserializer< BV, DEC >::set_ref_vectors().

Referenced by BlockLevelTest(), CheckRangeDeserial(), SBDB_BvStore_Id< TBV >::ComputeBitCountMap(), bm::compressed_collection_deserializer< CBC >::deserialize(), CBDB_BvStore< TBV >::Deserialize(), bm::operation_deserializer< BV >::deserialize_xor(), DesrializationTest2(), CMergeBitsetBlob< BV >::GetMergeBuffer(), GroupByTest(), LoadBVDump(), bm::LoadBVector(), CBDB_RangeMap< TBV >::LoadFreeList(), CBDB_MatrixBvStore< TBV, TM >::LoadMatrixDescriptions(), LoadVectors(), MutationOperationsTest(), CObjectIStream::ReadCompressedBitString(), ResizeTest(), s_SetBSFromOS(), SerializationCompressionLevelsTest(), SerializationOperation(), SerializationTest(), SparseSerializationTest(), StressTest(), CBVector_data::x_CreateBitVector(), and CSparseGraph::x_ReadMap().

◆ deserialize_range()

template<class BV >
void bm::deserialize_range ( BV &  bv,
const unsigned char *  buf,
typename BV::size_type  from,
typename BV::size_type  to,
const bm::bv_ref_vector< BV > *  ref_vect = 0 
)

Bitvector range deserialization from a memory BLOB.

Parameters
bv- target bvector
buf- pointer on memory which keeps serialized bvector
from- bit-vector index to deserialize from
to- bit-vector index to deserialize to
ref_vect- [in] optional pointer to a list of reference vectors used for XOR compression.

Function deserializes bitvector from memory block containig results of previous serialization. Function does not remove bits which are currently set. Effectively it is OR logical operation between the target bit-vector and serialized one.

See also
deserialize

Definition at line 3200 of file bmserial.h.

References bm::BigEndian, BM_ASSERT, bm::BM_HM_NO_BO, buf, bm::globals< T >::byte_order(), bm::deserializer< BV, DEC >::deserialize(), bm::decoder_base::get_8(), bm::LittleEndian, bm::deserializer< BV, DEC >::set_range(), and bm::deserializer< BV, DEC >::set_ref_vectors().

Referenced by CheckRangeDeserial(), and bm::operation_deserializer< bvector_type >::deserialize_range().

◆ serialize() [1/2]

template<class BV >
size_t bm::serialize ( BV &  bv,
unsigned char *  buf,
unsigned  serialization_flags = 0 
)

Saves bitvector into memory. Allocates temporary memory block for bvector.

Parameters
bv- source bvecor
buf- pointer on target memory area. No range checking in the function. It is responsibility of programmer to allocate sufficient amount of memory using information from calc_stat function.
serialization_flagsFlags controlling serilization (bit-mask) (use OR-ed serialization flags)

Definition at line 3105 of file bmserial.h.

References buf, and bm::serialize().

◆ serialize() [2/2]

template<class BV >
size_t bm::serialize ( const BV &  bv,
unsigned char *  buf,
bm::word_t temp_block = 0,
unsigned  serialization_flags = 0 
)

Saves bitvector into memory.

Function serializes content of the bitvector into memory. Serialization adaptively uses compression(variation of GAP encoding) when it is benefitial.

Parameters
bv- source bvecor
buf- pointer on target memory area. No range checking in the function. It is responsibility of programmer to allocate sufficient amount of memory using information from calc_stat function.
temp_block- pointer on temporary memory block. Cannot be 0; If you want to save memory across multiple bvectors allocate temporary block using allocate_tempblock and pass it to serialize. (Serialize does not deallocate temp_block.)
serialization_flagsFlags controlling serilization (bit-mask) (use OR-ed serialization flags)
Returns
Size of serialization block.
See also
calc_stat, serialization_flags

Serialization format:


| HEADER | BLOCKS |

Header structure:
  BYTE : Serialization header (bit mask of BM_HM_*)
  BYTE : Byte order ( 0 - Big Endian, 1 - Little Endian)
  INT16: Reserved (0)
  INT16: Reserved Flags (0)

Definition at line 3071 of file bmserial.h.

References bm::BM_NO_BYTE_ORDER, bm::BM_NO_GAP_LENGTH, buf, bm::serializer< BV >::byte_order_serialization(), bm::serializer< BV >::gap_length_serialization(), and bm::serializer< BV >::serialize().

Referenced by BlockLevelTest(), BV_Serialize(), DesrializationTest2(), CMergeBitsetBlob< BV >::GetMergeBuffer(), LoadBVDump(), LoadVectors(), MutationOperationsTest(), bm::serializer< BV >::optimize_serialize_destroy(), ResizeTest(), CAsnCacheTestApplication::Run(), s_GetMD5Tag(), s_SetOSFromBS(), CBDB_ExtBlobStore< TBV >::Save(), bm::SaveBVector(), SerializationOperation(), SerializationTest(), bm::serialize(), bm::serializer< BV >::serialize(), CBVector_data::SetBitVector(), CObjectOStreamAsn::WriteBitString(), CObjectOStreamAsnBinary::WriteBitString(), CObjectOStreamJson::WriteBitString(), CObjectOStreamXml::WriteBitString(), CBDB_BvStore< TBV >::WriteVector(), CBDB_BvSplitDictStore< Key, Dictionary, BvStore, BV >::x_SerializeBitVector(), and CSparseGraph::x_WriteMap().

Modified on Fri Sep 20 14:58:20 2024 by modify_doxy.py rev. 669887