BitMagic-C++
bm::sparse_vector_serial_layout< SV > Struct Template Reference

layout class for serialization buffer structure More...

#include <bmsparsevec_serial.h>

Collaboration diagram for bm::sparse_vector_serial_layout< SV >:

Public Types

typedef SV::value_type value_type
typedef SV::bvector_type bvector_type
typedef bvector_type::allocator_type allocator_type
typedef serializer< bvector_type >::buffer buffer_type

Public Member Functions

 sparse_vector_serial_layout () BMNOEXCEPT
 ~sparse_vector_serial_layout ()
unsigned char * reserve (size_t capacity)
 resize capacity
size_t size () const BMNOEXCEPT
 return current serialized size
void resize (size_t ssize)
 Set new serialized size.
size_t capacity () const BMNOEXCEPT
 return serialization buffer capacity
void freemem () BMNOEXCEPT
 free memory
void set_plane (unsigned i, unsigned char *ptr, size_t buf_size) BMNOEXCEPT
 Set plane output pointer and size.
const unsigned char * get_plane (unsigned i) const BMNOEXCEPT
 Get plane pointer.
const unsigned char * buf () const BMNOEXCEPT
 Return serialization buffer pointer.
const unsigned char * data () const BMNOEXCEPT
 Return serialization buffer pointer.
void resize_slices (unsigned new_slices_size)
 Resize for the target number of plains / bit-slices.

Protected Types

typedef bm::heap_vector< unsigned char *, allocator_type, true > ptr_vector_type
typedef bm::heap_vector< size_t, allocator_type, true > sizet_vector_type

Protected Attributes

buffer_type buf_
 serialization buffer
ptr_vector_type plane_ptrs_
 pointers on serialized bit-planes
sizet_vector_type plane_size_
 serialized plane size

Detailed Description

template<class SV>
struct bm::sparse_vector_serial_layout< SV >

layout class for serialization buffer structure

Class keeps a memory block sized for the target sparse vector BLOB. This class also provides acess to bit-plane memory, so it becomes possible to use parallel storage methods to save bit-planes into different storage shards.

Examples
inv_list.cpp, rscsample01.cpp, rscsample02.cpp, rscsample05.cpp, strsvsample03.cpp, strsvsample05.cpp, svsample02.cpp, and svsample08.cpp.

Definition at line 57 of file bmsparsevec_serial.h.

Member Typedef Documentation

◆ allocator_type

template<class SV>
typedef bvector_type::allocator_type bm::sparse_vector_serial_layout< SV >::allocator_type

Definition at line 61 of file bmsparsevec_serial.h.

◆ buffer_type

template<class SV>
typedef serializer<bvector_type>::buffer bm::sparse_vector_serial_layout< SV >::buffer_type

Definition at line 62 of file bmsparsevec_serial.h.

◆ bvector_type

template<class SV>
typedef SV::bvector_type bm::sparse_vector_serial_layout< SV >::bvector_type

Definition at line 60 of file bmsparsevec_serial.h.

◆ ptr_vector_type

template<class SV>
typedef bm::heap_vector<unsigned char*, allocator_type, true> bm::sparse_vector_serial_layout< SV >::ptr_vector_type
protected

Definition at line 123 of file bmsparsevec_serial.h.

◆ sizet_vector_type

template<class SV>
typedef bm::heap_vector<size_t, allocator_type, true> bm::sparse_vector_serial_layout< SV >::sizet_vector_type
protected

Definition at line 124 of file bmsparsevec_serial.h.

◆ value_type

template<class SV>
typedef SV::value_type bm::sparse_vector_serial_layout< SV >::value_type

Definition at line 59 of file bmsparsevec_serial.h.

Constructor & Destructor Documentation

◆ sparse_vector_serial_layout()

template<class SV>
bm::sparse_vector_serial_layout< SV >::sparse_vector_serial_layout ( )
inline

Definition at line 64 of file bmsparsevec_serial.h.

References BMNOEXCEPT.

◆ ~sparse_vector_serial_layout()

template<class SV>
bm::sparse_vector_serial_layout< SV >::~sparse_vector_serial_layout ( )
inline

Definition at line 66 of file bmsparsevec_serial.h.

Member Function Documentation

◆ buf()

template<class SV>
const unsigned char * bm::sparse_vector_serial_layout< SV >::buf ( ) const
inline

Return serialization buffer pointer.

Examples
rscsample01.cpp, rscsample02.cpp, strsvsample03.cpp, strsvsample05.cpp, svsample02.cpp, and svsample08.cpp.

Definition at line 108 of file bmsparsevec_serial.h.

References BMNOEXCEPT, and buf_.

Referenced by main(), and SDemo1().

◆ capacity()

template<class SV>
size_t bm::sparse_vector_serial_layout< SV >::capacity ( ) const
inline

return serialization buffer capacity

Definition at line 91 of file bmsparsevec_serial.h.

References BMNOEXCEPT, and buf_.

Referenced by reserve(), and bm::sparse_vector_serializer< SV >::serialize().

◆ data()

template<class SV>
const unsigned char * bm::sparse_vector_serial_layout< SV >::data ( ) const
inline

Return serialization buffer pointer.

Examples
inv_list.cpp, and svsample02.cpp.

Definition at line 110 of file bmsparsevec_serial.h.

References BMNOEXCEPT, and buf_.

Referenced by SDemo2(), write_as_rsc_svector(), and write_as_svector().

◆ freemem()

template<class SV>
void bm::sparse_vector_serial_layout< SV >::freemem ( )
inline

free memory

Definition at line 94 of file bmsparsevec_serial.h.

References BMNOEXCEPT, and buf_.

Referenced by reserve().

◆ get_plane()

template<class SV>
const unsigned char * bm::sparse_vector_serial_layout< SV >::get_plane ( unsigned i) const
inline

Get plane pointer.

Definition at line 104 of file bmsparsevec_serial.h.

References BMNOEXCEPT, and plane_ptrs_.

Referenced by bm::sparse_vector_serializer< SV >::serialize().

◆ reserve()

template<class SV>
unsigned char * bm::sparse_vector_serial_layout< SV >::reserve ( size_t capacity)
inline

resize capacity

Parameters
capacity- new capacity
Returns
new buffer or 0 if failed

Definition at line 73 of file bmsparsevec_serial.h.

References buf_, capacity(), and freemem().

Referenced by bm::sparse_vector_serializer< SV >::serialize().

◆ resize()

template<class SV>
void bm::sparse_vector_serial_layout< SV >::resize ( size_t ssize)
inline

Set new serialized size.

Definition at line 88 of file bmsparsevec_serial.h.

References buf_.

Referenced by bm::sparse_vector_serializer< SV >::serialize().

◆ resize_slices()

template<class SV>
void bm::sparse_vector_serial_layout< SV >::resize_slices ( unsigned new_slices_size)
inline

Resize for the target number of plains / bit-slices.

Definition at line 113 of file bmsparsevec_serial.h.

References plane_ptrs_, and plane_size_.

Referenced by bm::sparse_vector_serializer< SV >::serialize().

◆ set_plane()

template<class SV>
void bm::sparse_vector_serial_layout< SV >::set_plane ( unsigned i,
unsigned char * ptr,
size_t buf_size )
inline

Set plane output pointer and size.

Definition at line 97 of file bmsparsevec_serial.h.

References BMNOEXCEPT, plane_ptrs_, and plane_size_.

Referenced by bm::sv_serialization_plan_builder< SV >::build_plan(), and bm::sparse_vector_serializer< SV >::serialize().

◆ size()

template<class SV>
size_t bm::sparse_vector_serial_layout< SV >::size ( ) const
inline

Field Documentation

◆ buf_

template<class SV>
buffer_type bm::sparse_vector_serial_layout< SV >::buf_
protected

serialization buffer

Definition at line 127 of file bmsparsevec_serial.h.

Referenced by buf(), capacity(), data(), freemem(), reserve(), resize(), and size().

◆ plane_ptrs_

template<class SV>
ptr_vector_type bm::sparse_vector_serial_layout< SV >::plane_ptrs_
protected

pointers on serialized bit-planes

Definition at line 128 of file bmsparsevec_serial.h.

Referenced by get_plane(), resize_slices(), and set_plane().

◆ plane_size_

template<class SV>
sizet_vector_type bm::sparse_vector_serial_layout< SV >::plane_size_
protected

serialized plane size

Definition at line 129 of file bmsparsevec_serial.h.

Referenced by resize_slices(), and set_plane().


The documentation for this struct was generated from the following file: