|
BitMagic-C++
|
Example: collaborative compression (XOR compression). More...
#include <iostream>#include <vector>#include <cassert>#include "bm.h"#include "bmsparsevec.h"#include "bmsparsevec_compr.h"#include "bmsparsevec_serial.h"
Go to the source code of this file.
Data Structures | |
| struct | sample_data_frame |
| sample data-frame structure with multiple bm vectors More... | |
Typedefs | |
| typedef bm::sparse_vector< unsigned short, bvector_type > | sparse_vector_u16 |
| typedef bm::sparse_vector< unsigned, bvector_type > | sparse_vector_u32 |
| typedef bm::rsc_sparse_vector< unsigned, sparse_vector_u32 > | rsc_sparse_vector_u32 |
| typedef bm::sparse_vector_serializer< rsc_sparse_vector_u32 > | csv_serializer_type |
| typedef bm::sparse_vector_serializer< sparse_vector_u16 > | sv16_serializer_type |
| typedef bm::sparse_vector_deserializer< rsc_sparse_vector_u32 > | csv_deserializer_type |
| typedef bm::sparse_vector_deserializer< sparse_vector_u16 > | sv16_deserializer_type |
Functions | |
| size_t | raw_data_size (const sample_data_frame &df) |
| Estimate raw data size. | |
| static void | fill_test_data (sample_data_frame &df) |
| generate some data just to illustrate the case | |
| static void | test_data (sample_data_frame &df) |
| paranoiya check to make sure data frame matches pre-generated values | |
| template<typename SVLay> | |
| unsigned char * | copy_buffer (unsigned char *buf_ptr, const SVLay &sv_lay) |
| Copy buffer content into the buffer. | |
| static void | serialize_df0 (const sample_data_frame &df, std::vector< unsigned char > &buf, csv_serializer_type &csv_ser, sv16_serializer_type &sv16_ser) |
| serialize with disabled XOR compression | |
| static void | deserialize_df0 (sample_data_frame &df, const std::vector< unsigned char > &buf, csv_deserializer_type &csv_dser, sv16_deserializer_type &sv16_dser) |
| Simple (individual) de-serialization of vectors in the data-frame. | |
| static void | serialize_df2 (const sample_data_frame &df, std::vector< unsigned char > &buf, csv_serializer_type &csv_ser, sv16_serializer_type &sv16_ser) |
| Data frame serialization using collaborative method (XOR compression). | |
| static void | deserialize_df2 (sample_data_frame &df, const std::vector< unsigned char > &buf, csv_deserializer_type &csv_dser, sv16_deserializer_type &sv16_dser) |
| Collaborative de-serialization of vectors in the data-frame. | |
| int | main (void) |
Example: collaborative compression (XOR compression).
Definition in file rscsample05.cpp.
Definition at line 57 of file rscsample05.cpp.
Definition at line 55 of file rscsample05.cpp.
| typedef bm::rsc_sparse_vector<unsigned, sparse_vector_u32 > rsc_sparse_vector_u32 |
Definition at line 53 of file rscsample05.cpp.
| typedef bm::sparse_vector<unsigned short, bvector_type> sparse_vector_u16 |
Definition at line 51 of file rscsample05.cpp.
| typedef bm::sparse_vector<unsigned, bvector_type> sparse_vector_u32 |
Definition at line 52 of file rscsample05.cpp.
Definition at line 58 of file rscsample05.cpp.
Definition at line 56 of file rscsample05.cpp.
| unsigned char * copy_buffer | ( | unsigned char * | buf_ptr, |
| const SVLay & | sv_lay ) |
Copy buffer content into the buffer.
Definition at line 134 of file rscsample05.cpp.
Referenced by serialize_df0(), and serialize_df2().
|
static |
Simple (individual) de-serialization of vectors in the data-frame.
Definition at line 202 of file rscsample05.cpp.
References sample_data_frame::csv1, sample_data_frame::csv2, sample_data_frame::csv3, bm::sparse_vector_deserializer< SV >::deserialize(), and sample_data_frame::sv0.
Referenced by main().
|
static |
Collaborative de-serialization of vectors in the data-frame.
Definition at line 345 of file rscsample05.cpp.
References bm::bv_ref_vector< BV >::add_vectors(), sample_data_frame::csv1, sample_data_frame::csv2, sample_data_frame::csv3, bm::sparse_vector_deserializer< SV >::deserialize(), bm::sparse_vector_deserializer< SV >::deserialize_structure(), bm::base_sparse_vector< Val, BV, MAX_SIZE >::get_bmatrix(), bm::rsc_sparse_vector< Val, SV >::get_bmatrix(), bm::sparse_vector_deserializer< SV >::set_xor_ref(), and sample_data_frame::sv0.
Referenced by main().
|
static |
generate some data just to illustrate the case
Definition at line 95 of file rscsample05.cpp.
References sample_data_frame::csv1, sample_data_frame::csv2, sample_data_frame::csv3, bm::rsc_sparse_vector< Val, SV >::set(), bm::sparse_vector< Val, BV >::set(), sample_data_frame::sv0, and bm::rsc_sparse_vector< Val, SV >::sync().
Referenced by main().
| int main | ( | void | ) |
Definition at line 444 of file rscsample05.cpp.
References deserialize_df0(), deserialize_df2(), fill_test_data(), raw_data_size(), serialize_df0(), serialize_df2(), and test_data().
|
inline |
Estimate raw data size.
Definition at line 78 of file rscsample05.cpp.
References sample_data_frame::csv1, sample_data_frame::csv2, sample_data_frame::csv3, bm::rsc_sparse_vector< Val, SV >::get(), bm::sparse_vector< Val, BV >::get(), bm::rsc_sparse_vector< Val, SV >::size(), bm::sparse_vector< Val, BV >::size(), and sample_data_frame::sv0.
Referenced by main().
|
static |
serialize with disabled XOR compression
Definition at line 144 of file rscsample05.cpp.
References copy_buffer(), sample_data_frame::csv1, sample_data_frame::csv2, sample_data_frame::csv3, bm::sparse_vector_serializer< SV >::serialize(), bm::sparse_vector_serializer< SV >::set_xor_ref(), bm::sparse_vector_serial_layout< SV >::size(), and sample_data_frame::sv0.
Referenced by main().
|
static |
Data frame serialization using collaborative method (XOR compression).
Definition at line 244 of file rscsample05.cpp.
References bm::bv_ref_vector< BV >::add_sparse_vector(), bm::sparse_vector_serializer< SV >::compute_sim_model(), copy_buffer(), sample_data_frame::csv1, sample_data_frame::csv2, sample_data_frame::csv3, bm::sparse_vector_serializer< SV >::serialize(), bm::sparse_vector_serializer< SV >::set_sim_model(), bm::sparse_vector_serializer< SV >::set_xor_ref(), bm::sparse_vector_serial_layout< SV >::size(), and sample_data_frame::sv0.
Referenced by main().
|
static |
paranoiya check to make sure data frame matches pre-generated values
Definition at line 113 of file rscsample05.cpp.
References sample_data_frame::csv1, sample_data_frame::csv2, sample_data_frame::csv3, bm::rsc_sparse_vector< Val, SV >::get(), bm::sparse_vector< Val, BV >::get(), and sample_data_frame::sv0.
Referenced by main().