svsample02.cpp File Reference

Example: sparse_vector<> serialization. More...

`#include <iostream>`
`#include <vector>`
`#include <assert.h>`
`#include "bm.h"`
`#include "bmsparsevec.h"`
`#include "bmsparsevec_serial.h"`
`#include "bmundef.h"`
Include dependency graph for svsample02.cpp:

Go to the source code of this file.

## Typedefs

typedef bm::sparse_vector< unsigned, bm::bvector<> > | sparse_vector_u32
typedef bm::sparse_vector< int, bm::bvector<> > | sparse_vector_i32
typedef bm::sparse_vector_serializer< sparse_vector_u32 > | sv_serializer_type
typedef bm::sparse_vector_deserializer< sparse_vector_u32 > | sv_deserializer_type

## Functions

static void | SDemo1 ()
| Demo 1 Simple one function call serialization.
static void | SDemo2 ()
| Demo 2.
int | main (void)

## Detailed Description

Example: sparse_vector<> serialization.

Definition in file svsample02.cpp.

## Typedef Documentation

## sparse_vector_i32

typedef bm::sparse_vector<int, bm::bvector<> > sparse_vector_i32

Definition at line 50 of file svsample02.cpp.

## sparse_vector_u32

typedef bm::sparse_vector<unsigned, bm::bvector<> > sparse_vector_u32

Definition at line 49 of file svsample02.cpp.

## sv_deserializer_type

typedef bm::sparse_vector_deserializer<sparse_vector_u32> sv_deserializer_type

Examples
  svsample02.cpp.

Definition at line 53 of file svsample02.cpp.

## sv_serializer_type

typedef bm::sparse_vector_serializer<sparse_vector_u32> sv_serializer_type

Examples
  svsample02.cpp.

Definition at line 52 of file svsample02.cpp.

## Function Documentation

## main()

int main | ( | void |  | ) |

Definition at line 205 of file svsample02.cpp.

References SDemo1(), and SDemo2().

## SDemo1()

void SDemo1 | ( |  | ) |

static

Demo 1 Simple one function call serialization.

Examples
  svsample02.cpp.

Definition at line 59 of file svsample02.cpp.

References bm::sparse_vector_serial_layout< SV >::buf(), bm::sparse_vector< Val, BV >::equal(), bm::sparse_vector< Val, BV >::optimize(), bm::sparse_vector< Val, BV >::push_back(), bm::sparse_vector_serial_layout< SV >::size(), bm::sparse_vector_deserialize(), and bm::sparse_vector_serialize().

Referenced by main().

## SDemo2()

void SDemo2 | ( |  | ) |

static

Demo 2.

- Reuseable serializer/deserilaizer classes
- Shows serializarion with XOR compression enabled

Reusable serializer is better (works faster) when we need to serialize/deserialize a bunch of vectors use of serializer also offers a better control on serialization options (like XOR compression)

Examples
  svsample02.cpp.

Definition at line 106 of file svsample02.cpp.

References BM_DECLARE_TEMP_BLOCK, bm::sparse_vector< Val, BV >::calc_stat(), bm::sparse_vector_serial_layout< SV >::data(), bm::sparse_vector_deserializer< SV >::deserialize(), bm::sparse_vector_serializer< SV >::disable_xor_compression(), bm::sparse_vector_serializer< SV >::enable_xor_compression(), bm::sparse_vector< Val, BV >::equal(), bm::sparse_vector< Val, BV >::is_ro(), bm::sparse_vector_serializer< SV >::is_xor_ref(), bm::sparse_vector< Val, BV >::optimize(), bm::READONLY, bm::sparse_vector_serializer< SV >::serialize(), bm::sparse_vector< Val, BV >::set(), bm::sparse_vector_deserializer< SV >::set_finalization(), bm::sparse_vector_serial_layout< SV >::size(), and bm::use_null.

Referenced by main().