BitMagic-C++
Public Types | Public Member Functions | Protected Types | Protected Attributes
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 >:
Collaboration graph
[legend]

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

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 More...
 
ptr_vector_type plane_ptrs_
 pointers on serialized bit-planes More...
 
sizet_vector_type plane_size_
 serialized plane size More...
 

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 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 bm::sparse_vector_serial_layout< SV >::buf_.

Referenced by main(), and SDemo1().

◆ capacity()

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

◆ 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 bm::sparse_vector_serial_layout< SV >::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

◆ get_plane()

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

◆ 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 bm::sparse_vector_serial_layout< SV >::buf_, bm::sparse_vector_serial_layout< SV >::capacity(), and bm::sparse_vector_serial_layout< SV >::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 bm::sparse_vector_serial_layout< SV >::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 bm::sparse_vector_serial_layout< SV >::plane_ptrs_, and bm::sparse_vector_serial_layout< SV >::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

◆ 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

◆ plane_ptrs_

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

◆ plane_size_

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

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