BitMagic-C++
Data Structures | Typedefs | Functions
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::bvector bvector_type
 
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. More...
 
static void fill_test_data (sample_data_frame &df)
 generate some data just to illustrate the case More...
 
static void test_data (sample_data_frame &df)
 paranoiya check to make sure data frame matches pre-generated values More...
 
template<typename SVLay >
unsigned char * copy_buffer (unsigned char *buf_ptr, const SVLay &sv_lay)
 Copy buffer content into the buffer. More...
 
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 More...
 
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. More...
 
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) More...
 
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. More...
 
int main (void)
  More...
 

Detailed Description

Example: collaborative compression (XOR compression)

Definition in file rscsample05.cpp.

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

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

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

◆ fill_test_data()

static void fill_test_data ( sample_data_frame df)
static

◆ main()

int main ( void  )

◆ raw_data_size()

size_t raw_data_size ( const sample_data_frame df)
inline

◆ serialize_df0()

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

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

◆ test_data()

static 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::sparse_vector< Val, BV >::get(), bm::rsc_sparse_vector< Val, SV >::get(), and sample_data_frame::sv0.

Referenced by main().