BitMagic-C++
rscsample05.cpp File Reference

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"
Include dependency graph for rscsample05.cpp:

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_typesparse_vector_u16
typedef bm::sparse_vector< unsigned, bvector_typesparse_vector_u32
typedef bm::rsc_sparse_vector< unsigned, sparse_vector_u32rsc_sparse_vector_u32
typedef bm::sparse_vector_serializer< rsc_sparse_vector_u32csv_serializer_type
typedef bm::sparse_vector_serializer< sparse_vector_u16sv16_serializer_type
typedef bm::sparse_vector_deserializer< rsc_sparse_vector_u32csv_deserializer_type
typedef bm::sparse_vector_deserializer< sparse_vector_u16sv16_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)

Detailed Description

Example: collaborative compression (XOR compression).

Definition in file rscsample05.cpp.

Typedef Documentation

◆ csv_deserializer_type

◆ csv_serializer_type

◆ rsc_sparse_vector_u32

Definition at line 53 of file rscsample05.cpp.

◆ sparse_vector_u16

Examples
rscsample05.cpp.

Definition at line 51 of file rscsample05.cpp.

◆ sparse_vector_u32

Definition at line 52 of file rscsample05.cpp.

◆ sv16_deserializer_type

◆ sv16_serializer_type

Function Documentation

◆ copy_buffer()

template<typename SVLay>
unsigned char * copy_buffer ( unsigned char * buf_ptr,
const SVLay & sv_lay )

Copy buffer content into the buffer.

Examples
rscsample05.cpp.

Definition at line 134 of file rscsample05.cpp.

Referenced by serialize_df0(), and serialize_df2().

◆ deserialize_df0()

void deserialize_df0 ( sample_data_frame & df,
const std::vector< unsigned char > & buf,
csv_deserializer_type & csv_dser,
sv16_deserializer_type & sv16_dser )
static

Simple (individual) de-serialization of vectors in the data-frame.

Examples
rscsample05.cpp.

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().

◆ deserialize_df2()

◆ fill_test_data()

◆ main()

◆ raw_data_size()

◆ serialize_df0()

void serialize_df0 ( const sample_data_frame & df,
std::vector< unsigned char > & buf,
csv_serializer_type & csv_ser,
sv16_serializer_type & sv16_ser )
static

◆ serialize_df2()

◆ test_data()

void test_data ( sample_data_frame & df)
static

paranoiya check to make sure data frame matches pre-generated values

Examples
rscsample05.cpp.

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().