Example of how to partially de-serialize bm::rsc_sparse_vector<> container
- See also
- bm::rsc_sparse_vector
-
bm::rsc_sparse_vector<>::back_insert_iterator
#include <iostream>
#include <vector>
using namespace std;
template<
typename SV>
void PrintSV(
const SV& sv)
{
auto sz = sv.size();
cout << "size() = " << sz << " : ";
for (typename SV::size_type i = 0; i < sz; ++i)
{
if (sv.is_null(i))
cout << "NULL";
else
cout << sv.get(i);
cout << ", ";
}
cout << endl;
}
{
try
{
{
bit = 10;
bit = 11;
bit = 13;
bit = 14;
bit.add_null(2);
bit = 256;
bit.flush();
}
{
}
const unsigned char* buf = sv_lay.
buf();
{
bv_mask.set(0);
bv_mask.set(1);
}
{
}
}
catch(std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}
sparse vector de-serializer
sparse vector with runtime compression using bit transposition method
#define BM_DECLARE_TEMP_BLOCK(x)
const unsigned char * buf() const
Return serialization buffer pointer.
Sparse constainer sparse_vector<> for integer types using bit-transposition transform.
void add_null() BMNOEXCEPT
add NULL (no-value) to the container
Serialization for sparse_vector<>
Compressed sparse container rsc_sparse_vector<> for integer types.
layout class for serialization buffer structure
bm::sparse_vector< unsigned, bm::bvector<> > sparse_vector_u32
void serialize(const SV &sv, sparse_vector_serial_layout< SV > &sv_layout)
Serialize sparse vector into a memory buffer(s) structure.
back_insert_iterator get_back_inserter()
void deserialize(SV &sv, const unsigned char *buf)
void set_bookmarks(bool enable, unsigned bm_interval=256)
Add skip-markers for faster range deserialization.
SV::bvector_type bvector_type
Rank-Select compressed sparse vector.
void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, statistics *stat=0)
run memory optimization for all vector plains
bm::rsc_sparse_vector< unsigned, sparse_vector_u32 > rsc_sparse_vector_u32
void sync(bool force)
Re-calculate prefix sum table used for rank search.
void PrintSV(const SV &sv)
Print sparse vector content.
void deserialize_range(SV &sv, const unsigned char *buf, size_type from, size_type to)
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.