BitMagic-C++
|
Serialization for bvector<> container. More...
Data Structures | |
class | bm::serializer< BV > |
Bit-vector serialization class. More... | |
class | bm::deseriaizer_base< DEC > |
Base deserialization class. More... | |
class | bm::deserializer< BV, DEC > |
Deserializer for bit-vector. More... | |
class | bm::serial_stream_iterator< DEC > |
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) |
Bitvector deserialization from memory. More... | |
Serialization for bvector<> container.
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 1792 of file bmserial.h.
size_t bm::deserialize | ( | BV & | bv, |
const unsigned char * | buf, | ||
bm::word_t * | temp_block = 0 |
||
) |
Bitvector deserialization from memory.
bv | - target bvector |
buf | - pointer on memory which keeps serialized bvector |
temp_block | - pointer on temporary block, if NULL bvector allocates own. |
Function deserializes bitvector from memory block containig results of previous serialization. Function does not remove bits which are currently set. Effectively it means OR logical operation between current bitset and previously serialized one.
Definition at line 1900 of file bmserial.h.
References bm::BigEndian, BM_ASSERT, bm::BM_HM_NO_BO, bm::deserializer< BV, DEC >::deserialize(), bm::decoder_base::get_8(), and bm::LittleEndian.
Referenced by convert_bv2bvs(), DemoAND(), DemoOR(), DemoSUB(), DemoXOR(), bm::compressed_collection_deserializer< CBC >::deserialize(), and main().
size_t bm::serialize | ( | BV & | bv, |
unsigned char * | buf, | ||
unsigned | serialization_flags = 0 |
||
) |
Saves bitvector into memory. Allocates temporary memory block for bvector.
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_flags | Flags controlling serilization (bit-mask) (use OR-ed serialization flags) |
Definition at line 1874 of file bmserial.h.
References bm::serialize().
Referenced by bm::serializer< bvector_type >::optimize_serialize_destroy(), and bm::serializer< bvector_type >::serialize().
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.
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_flags | Flags controlling serilization (bit-mask) (use OR-ed 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 1840 of file bmserial.h.
References bm::BM_NO_BYTE_ORDER, bm::BM_NO_GAP_LENGTH, bm::serializer< BV >::byte_order_serialization(), bm::serializer< BV >::gap_length_serialization(), and bm::serializer< BV >::serialize().
Referenced by bm::serialize().