BitMagic-C++
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE > Class Template Reference

sparse vector for strings with compression using bit transposition method More...

#include <bmstrsparsevec.h>

Inheritance diagram for bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >:
Inheritance graph
[legend]
Collaboration diagram for bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >:
Collaboration graph
[legend]

Data Structures

class  back_insert_iterator
 Back insert iterator implements buffered insert, faster than generic access assignment. More...
 
class  const_iterator
 Const iterator to do quick traverse of the sparse vector. More...
 
class  const_reference
 Reference class to access elements via common [] operator. More...
 
struct  is_remap_support
 
struct  is_rsc_support
 
class  reference
 Reference class to access elements via common [] operator. More...
 
struct  statistics
 

Public Types

enum  octet_plains { sv_octet_plains = MAX_STR_SIZE }
 
typedef BV bvector_type
 
typedef bvector_typebvector_type_ptr
 
typedef const bvector_typebvector_type_const_ptr
 
typedef CharType value_type
 
typedef CharType * value_type_prt
 
typedef bvector_type::size_type size_type
 
typedef BV::allocator_type allocator_type
 
typedef bvector_type::allocation_policy allocation_policy_type
 
typedef bvector_type::enumerator bvector_enumerator_type
 
typedef allocator_type::allocator_pool_type allocator_pool_type
 
typedef bm::basic_bmatrix< BV > bmatrix_type
 
typedef base_sparse_vector< CharType, BV, MAX_STR_SIZE > parent_type
 
typedef bm::heap_matrix< unsigned char, MAX_STR_SIZE, 256, typename bvector_type::allocator_typeplane_octet_matrix_type
 Matrix of character remappings. More...
 
typedef plane_octet_matrix_type remap_matrix_type
 
typedef bm::heap_matrix< size_t, MAX_STR_SIZE, 256, typename bvector_type::allocator_typeoctet_freq_matrix_type
 Matrix of character frequencies (for optimal code remap) More...
 
- Public Types inherited from bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >
enum  bit_plains
 
enum  vector_capacity
 
typedef CharType value_type
 
typedef BV bvector_type
 
typedef BV::size_type size_type
 
typedef bvector_typebvector_type_ptr
 
typedef const bvector_typebvector_type_const_ptr
 
typedef const value_typeconst_reference
 
typedef BV::allocator_type allocator_type
 
typedef bvector_type::allocation_policy allocation_policy_type
 
typedef bvector_type::enumerator bvector_enumerator_type
 
typedef allocator_type::allocator_pool_type allocator_pool_type
 
typedef bm::basic_bmatrix< BV > bmatrix_type
 

Public Member Functions

 str_sparse_vector (bm::null_support null_able=bm::no_null, allocation_policy_type ap=allocation_policy_type(), size_type bv_max_size=bm::id_max, const allocator_type &alloc=allocator_type())
 Sparse vector constructor. More...
 
 str_sparse_vector (const str_sparse_vector &str_sv)
 
str_sparse_vector< CharType, BV, MAX_STR_SIZE > & operator= (const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &str_sv)
 
 str_sparse_vector (str_sparse_vector< CharType, BV, MAX_STR_SIZE > &&str_sv) BMNOEXCEPT
 
str_sparse_vector< CharType, BV, MAX_STR_SIZE > & operator= (str_sparse_vector< CharType, BV, MAX_STR_SIZE > &&str_sv) BMNOEXCEPT
 
void sync (bool force)
 syncronize internal structures More...
 
bool equal (const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &sv, bm::null_support null_able=bm::use_null) const BMNOEXCEPT
 check if another sparse vector has the same content and size More...
 
size_type effective_size () const BMNOEXCEPT
 size of sparse vector (may be different for RSC) More...
 
String element access
const const_reference operator[] (size_type idx) const
 Operator to get read access to an element. More...
 
reference operator[] (size_type idx)
 Operator to get write access to an element. More...
 
void set (size_type idx, const value_type *str)
 set specified element with bounds checking and automatic resize More...
 
void set_null (size_type idx)
 set NULL status for the specified element Vector is resized automatically More...
 
void insert (size_type idx, const value_type *str)
 insert the specified element More...
 
template<typename StrType >
void insert (size_type idx, const StrType &str)
 insert STL string More...
 
void erase (size_type idx)
 erase the specified element More...
 
size_type get (size_type idx, value_type *str, size_type buf_size) const BMNOEXCEPT
 get specified element More...
 
template<typename StrType >
void assign (size_type idx, const StrType &str)
 set specified element with bounds checking and automatic resize More...
 
template<typename StrType >
void push_back (const StrType &str)
 push back a string More...
 
void push_back (const value_type *str)
 push back a string (zero terminated) More...
 
template<typename StrType >
void get (size_type idx, StrType &str) const
 get specified string element Template method expects an STL-compatible type basic_string<> More...
 
void swap (str_sparse_vector &str_sv) BMNOEXCEPT
 
Element comparison functions
int compare (size_type idx, const value_type *str) const BMNOEXCEPT
 Compare vector element with argument lexicographically. More...
 
unsigned common_prefix_length (size_type idx1, size_type idx2) const BMNOEXCEPT
 Find size of common prefix between two vector elements in octets. More...
 
Clear
void clear_all (bool free_mem) BMNOEXCEPT
 resize to zero, free memory More...
 
void clear () BMNOEXCEPT
 resize to zero, free memory More...
 
str_sparse_vector< CharType, BV, MAX_STR_SIZE > & clear_range (size_type left, size_type right, bool set_null=false)
 clear range (assign bit 0 for all plains) More...
 
Memory optimization/compression
void optimize (bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics *stat=0)
 run memory optimization for all vector plains More...
 
void calc_stat (struct str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics *st) const BMNOEXCEPT
 Calculates memory statistics. More...
 
Iterator access
const_iterator begin () const BMNOEXCEPT
 Provide const iterator access to container content. More...
 
const_iterator end () const BMNOEXCEPT
 Provide const iterator access to the end. More...
 
const_iterator get_const_iterator (size_type idx) const BMNOEXCEPT
 Get const_itertor re-positioned to specific element. More...
 
back_insert_iterator get_back_inserter ()
 Provide back insert iterator Back insert iterator implements buffered insertion, which is faster, than random access or push_back. More...
 
Export content to C-style
template<typename CharMatrix >
size_type decode (CharMatrix &cmatr, size_type idx_from, size_type dec_size, bool zero_mem=true) const
 Bulk export strings to a C-style matrix of chars. More...
 
template<typename CharMatrix >
size_type decode_substr (CharMatrix &cmatr, size_type idx_from, size_type dec_size, unsigned substr_from, unsigned substr_to, bool zero_mem=true) const
 Bulk export strings to a C-style matrix of chars. More...
 
template<typename CharMatrix >
void import (CharMatrix &cmatr, size_type idx_from, size_type imp_size)
 Bulk import of strings from a C-style matrix of chars. More...
 
template<typename CharMatrix >
void import_back (CharMatrix &cmatr, size_type imp_size)
 Bulk push-back import of strings from a C-style matrix of chars. More...
 
Merge, split, partition data
void copy_range (const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &sv, size_type left, size_type right, bm::null_support splice_null=bm::use_null)
 copy range of values from another sparse vector More...
 
- Public Member Functions inherited from bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >
 base_sparse_vector ()
 
 base_sparse_vector (bm::null_support null_able, allocation_policy_type ap, size_type bv_max_size, const allocator_type &alloc)
 
 base_sparse_vector (const base_sparse_vector< CharType, BV, MAX_SIZE > &bsv)
 
 base_sparse_vector (base_sparse_vector< CharType, BV, MAX_SIZE > &&bsv) BMNOEXCEPT
 
void swap (base_sparse_vector< CharType, BV, MAX_SIZE > &bsv) BMNOEXCEPT
 
size_type size () const BMNOEXCEPT
 
void resize (size_type new_size)
 
void clear_range (size_type left, size_type right, bool set_null)
 
void clear_all (bool free_mem=true) BMNOEXCEPT
 resize to zero, free memory More...
 
bool empty () const BMNOEXCEPT
 
void optimize (bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename bvector_type::statistics *stat=0)
 run memory optimization for all bit-vector rows More...
 
void calc_stat (typename bvector_type::statistics *st) const BMNOEXCEPT
 Calculates memory statistics. More...
 
bool equal (const base_sparse_vector< CharType, BV, MAX_SIZE > &sv, bm::null_support null_able=bm::use_null) const BMNOEXCEPT
 check if another sparse vector has the same content and size More...
 
bool is_nullable () const BMNOEXCEPT
 check if container supports NULL(unassigned) values More...
 
bm::null_support get_null_support () const BMNOEXCEPT
 check if container supports NULL(unassigned) values More...
 
const bvector_typeget_null_bvector () const BMNOEXCEPT
 Get bit-vector of assigned values or NULL (if not constructed that way) More...
 
bool is_null (size_type idx) const BMNOEXCEPT
 test if specified element is NULL More...
 
bvector_type_ptr get_plain (unsigned i)
 get access to bit-plain, function checks and creates a plain More...
 
bvector_type_const_ptr get_plain (unsigned i) const BMNOEXCEPT
 get read-only access to bit-plain More...
 
unsigned effective_plains () const BMNOEXCEPT
 Number of effective bit-plains in the value type. More...
 
bvector_type_ptr plain (unsigned i) BMNOEXCEPT
 get access to bit-plain as is (can return NULL) More...
 
bvector_type_const_ptr plain (unsigned i) const BMNOEXCEPT
 
bvector_typeget_null_bvect ()
 
void free_plain (unsigned i)
 free memory in bit-plain More...
 
bm::id64_t get_plains_mask (unsigned element_idx) const BMNOEXCEPT
 
const bmatrix_typeget_bmatrix () const BMNOEXCEPT
 

Static Public Member Functions

static bool find_rank (size_type rank, size_type &pos) BMNOEXCEPT
 find position of compressed element by its rank More...
 
Various traits
static bool is_compressed () BMNOEXCEPT
 trait if sparse vector is "compressed" (false) More...
 
- Static Public Member Functions inherited from bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >
static unsigned plains () BMNOEXCEPT
 get total number of bit-plains in the vector More...
 
static unsigned stored_plains () BMNOEXCEPT
 Number of stored bit-plains (value plains + extra. More...
 

Protected Member Functions

template<typename CharMatrix >
void import_no_check (CharMatrix &cmatr, size_type idx_from, size_type imp_size, bool set_not_null=true)
 
void set_value (size_type idx, const value_type *str)
 set value without checking boundaries More...
 
void set_value_no_null (size_type idx, const value_type *str)
 set value without checking boundaries or support of NULL More...
 
void insert_value (size_type idx, const value_type *str)
 insert value without checking boundaries More...
 
void insert_value_no_null (size_type idx, const value_type *str)
 insert value without checking boundaries or support of NULL More...
 
size_type size_internal () const
 
void resize_internal (size_type sz)
 
size_t remap_size () const
 
const unsigned char * get_remap_buffer () const
 
unsigned char * init_remap_buffer ()
 
void set_remap ()
 
bool resolve_range (size_type from, size_type to, size_type *idx_from, size_type *idx_to) const
 
const remap_matrix_typeget_remap_matrix () const
 
remap_matrix_typeget_remap_matrix ()
 
- Protected Member Functions inherited from bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >
void copy_from (const base_sparse_vector< CharType, BV, MAX_SIZE > &bsv)
 
void clear_value_plains_from (unsigned plain_idx, size_type idx)
 
void insert_clear_value_plains_from (unsigned plain_idx, size_type idx)
 
void erase_column (size_type idx)
 
void insert_null (size_type idx, bool not_null)
 
void optimize_block (block_idx_type nb)
 optimize block in all matrix plains More...
 
void copy_range_plains (const base_sparse_vector< CharType, BV, MAX_SIZE > &bsv, typename base_sparse_vector< CharType, BV, MAX_SIZE >::size_type left, typename base_sparse_vector< CharType, BV, MAX_SIZE >::size_type right, bm::null_support splice_null)
 Perform copy_range() on a set of plains. More...
 

Static Protected Member Functions

Errors and exceptions
static void throw_range_error (const char *err_msg)
 throw range error More...
 
static void throw_bad_value (const char *err_msg)
 throw domain error More...
 
- Static Protected Member Functions inherited from bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >
static unsigned value_bits () BMNOEXCEPT
 Number of total bit-plains in the value type. More...
 
static unsigned null_plain () BMNOEXCEPT
 plain index for the "NOT NULL" flags plain More...
 

Protected Attributes

unsigned remap_flags_
 remapping status More...
 
plane_octet_matrix_type remap_matrix1_
 octet remap table 1 More...
 
plane_octet_matrix_type remap_matrix2_
 octet remap table 2 More...
 
- Protected Attributes inherited from bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >
bmatrix_type bmatr_
 bit-transposed matrix More...
 
size_type size_
 array size More...
 
unsigned effective_plains_
 

Friends

template<class SVect >
class sparse_vector_serializer
 
template<class SVect >
class sparse_vector_deserializer
 

Size, etc

size_type size () const
 return size of the vector More...
 
bool empty () const
 return true if vector is empty More...
 
void resize (size_type sz)
 resize vector More...
 
size_type effective_max_str () const BMNOEXCEPT
 get effective string length used in vector Calculate and returns efficiency, how close are we to the reserved maximum. More...
 
size_type effective_vector_max () const
 get effective string length used in vector More...
 
void sync_size () BMNOEXCEPT
 recalculate size to exclude tail NULL elements After this call size() will return the true size of the vector More...
 
static size_type max_str ()
 get maximum string length capacity More...
 

Char remapping, succinct utilities

Remapping runs character usage analysis (frequency analysis) based on that implements reduction of dit-depth thus improves search performance and memory usage (both RAM and serialized).

Remapping limits farther modifications of sparse vector. (Use remapped vector as read-only).

bool is_remap () const BMNOEXCEPT
 Get character remapping status (true|false) More...
 
void remap_from (const str_sparse_vector &str_sv)
 Build remapping profile and load content from another sparse vector Remapped vector likely saves memory (both RAM and disk) but should not be modified (should be read-only). More...
 
void remap ()
 Build remapping profile and re-load content to save memory. More...
 
void calc_octet_stat (octet_freq_matrix_type &octet_matrix) const BMNOEXCEPT
 
bool remap_tosv (value_type *sv_str, size_type buf_size, const value_type *str) const BMNOEXCEPT
 
void recalc_remap_matrix2 ()
 
static void build_octet_remap (plane_octet_matrix_type &octet_remap_matrix1, plane_octet_matrix_type &octet_remap_matrix2, octet_freq_matrix_type &octet_occupancy_matrix)
 
static bool remap_tosv (value_type *BMRESTRICT sv_str, size_type buf_size, const value_type *BMRESTRICT str, const plane_octet_matrix_type &BMRESTRICT octet_remap_matrix2) BMNOEXCEPT
 
static bool remap_fromsv (value_type *BMRESTRICT str, size_type buf_size, const value_type *BMRESTRICT sv_str, const plane_octet_matrix_type &BMRESTRICT octet_remap_matrix1) BMNOEXCEPT
 

Additional Inherited Members

- Protected Types inherited from bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >
typedef bvector_type::block_idx_type block_idx_type
 

Detailed Description

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
class bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >

sparse vector for strings with compression using bit transposition method

Initial string is bit-transposed into bit-planes so collection may use less memory due to prefix sum (GAP) compression in bit-plains.

Examples:
strsvsample01.cpp, strsvsample02.cpp, strsvsample03.cpp, strsvsample04.cpp, strsvsample05.cpp, strsvsample06.cpp, and xsample05.cpp.

Definition at line 56 of file bmstrsparsevec.h.

Member Typedef Documentation

◆ allocation_policy_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef bvector_type::allocation_policy bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::allocation_policy_type

Definition at line 66 of file bmstrsparsevec.h.

◆ allocator_pool_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef allocator_type::allocator_pool_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::allocator_pool_type

Definition at line 68 of file bmstrsparsevec.h.

◆ allocator_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef BV::allocator_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::allocator_type

Definition at line 65 of file bmstrsparsevec.h.

◆ bmatrix_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef bm::basic_bmatrix<BV> bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatrix_type

Definition at line 69 of file bmstrsparsevec.h.

◆ bvector_enumerator_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef bvector_type::enumerator bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bvector_enumerator_type

Definition at line 67 of file bmstrsparsevec.h.

◆ bvector_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef BV bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bvector_type

Definition at line 59 of file bmstrsparsevec.h.

◆ bvector_type_const_ptr

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef const bvector_type* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bvector_type_const_ptr

Definition at line 61 of file bmstrsparsevec.h.

◆ bvector_type_ptr

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef bvector_type* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bvector_type_ptr

Definition at line 60 of file bmstrsparsevec.h.

◆ octet_freq_matrix_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef bm::heap_matrix<size_t, MAX_STR_SIZE, 256, typename bvector_type::allocator_type> bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::octet_freq_matrix_type

Matrix of character frequencies (for optimal code remap)

Definition at line 101 of file bmstrsparsevec.h.

◆ parent_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef base_sparse_vector<CharType, BV, MAX_STR_SIZE> bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::parent_type

Definition at line 70 of file bmstrsparsevec.h.

◆ plane_octet_matrix_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef bm::heap_matrix<unsigned char, MAX_STR_SIZE, 256, typename bvector_type::allocator_type> bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::plane_octet_matrix_type

Matrix of character remappings.

Definition at line 90 of file bmstrsparsevec.h.

◆ remap_matrix_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef plane_octet_matrix_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix_type

Definition at line 91 of file bmstrsparsevec.h.

◆ size_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef bvector_type::size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_type

Definition at line 64 of file bmstrsparsevec.h.

◆ value_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef CharType bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::value_type

Definition at line 62 of file bmstrsparsevec.h.

◆ value_type_prt

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef CharType* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::value_type_prt

Definition at line 63 of file bmstrsparsevec.h.

Member Enumeration Documentation

◆ octet_plains

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
enum bm::str_sparse_vector::octet_plains
Enumerator
sv_octet_plains 

Definition at line 76 of file bmstrsparsevec.h.

Constructor & Destructor Documentation

◆ str_sparse_vector() [1/3]

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::str_sparse_vector ( bm::null_support  null_able = bm::no_null,
allocation_policy_type  ap = allocation_policy_type(),
size_type  bv_max_size = bm::id_max,
const allocator_type alloc = allocator_type() 
)

Sparse vector constructor.

Parameters
null_able- defines if vector supports NULL values flag by default it is OFF, use bm::use_null to enable it
ap- allocation strategy for underlying bit-vectors Default allocation policy uses BM_BIT setting (fastest access)
bv_max_size- maximum possible size of underlying bit-vectors Please note, this is NOT size of svector itself, it is dynamic upper limit which should be used very carefully if we surely know the ultimate size
alloc- allocator for bit-vectors
See also
bvector<>
bm::bvector<>::allocation_policy
bm::startegy

Definition at line 1282 of file bmstrsparsevec.h.

◆ str_sparse_vector() [2/3]

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::str_sparse_vector ( const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &  str_sv)

copy-ctor

Definition at line 1295 of file bmstrsparsevec.h.

◆ str_sparse_vector() [3/3]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::str_sparse_vector ( str_sparse_vector< CharType, BV, MAX_STR_SIZE > &&  str_sv)
inline

Member Function Documentation

◆ assign()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename StrType >
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::assign ( size_type  idx,
const StrType &  str 
)
inline

set specified element with bounds checking and automatic resize

This is an equivalent of set() method, but templetized to be more compatible with the STL std::string and the likes

Parameters
idx- element index (vector auto-resized if needs to)
str- input string expected an STL class with size() support, like basic_string<> or vector<char>
Examples:
strsvsample01.cpp, and strsvsample04.cpp.

Definition at line 545 of file bmstrsparsevec.h.

References BM_ASSERT, bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatr_, bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_value_plains_from(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix2_, bm::basic_bmatrix< BV >::set_octet(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size(), and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.

Referenced by main(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::push_back().

◆ begin()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::begin ( ) const

Provide const iterator access to container content.

Examples:
strsvsample01.cpp, strsvsample02.cpp, strsvsample04.cpp, and strsvsample06.cpp.

Definition at line 1908 of file bmstrsparsevec.h.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_vector_max(), and main().

◆ build_octet_remap()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::build_octet_remap ( plane_octet_matrix_type octet_remap_matrix1,
plane_octet_matrix_type octet_remap_matrix2,
octet_freq_matrix_type octet_occupancy_matrix 
)
static

◆ calc_octet_stat()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::calc_octet_stat ( octet_freq_matrix_type octet_matrix) const

◆ calc_stat()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::calc_stat ( struct str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics st) const

◆ clear()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear ( )
inline

resize to zero, free memory

Definition at line 665 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_all().

◆ clear_all()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_all ( bool  free_mem)

◆ clear_range()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
str_sparse_vector<CharType, BV, MAX_STR_SIZE>& bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_range ( size_type  left,
size_type  right,
bool  set_null = false 
)
inline

clear range (assign bit 0 for all plains)

Parameters
left- interval start
right- interval end (closed interval)
set_null- set cleared values to unassigned (NULL)
Examples:
strsvsample04.cpp.

Definition at line 674 of file bmstrsparsevec.h.

References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_range().

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import(), and main().

◆ common_prefix_length()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
unsigned bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::common_prefix_length ( size_type  idx1,
size_type  idx2 
) const

Find size of common prefix between two vector elements in octets.

Returns
size of common prefix

Definition at line 1577 of file bmstrsparsevec.h.

References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatr_, and bm::basic_bmatrix< BV >::get_octet().

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get().

◆ compare()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
int bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::compare ( size_type  idx,
const value_type str 
) const

Compare vector element with argument lexicographically.

NOTE: for a re-mapped container, input string may have no correct remapping, in this case we have an ambiguity (we know it is not equal (0) but LT or GT?). Behavior is undefined.

Parameters
idx- vactor element index
str- argument to compare with
Returns
0 - equal, < 0 - vect[i] < str, >0 otherwise

Definition at line 1530 of file bmstrsparsevec.h.

References BM_ASSERT, bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatr_, bm::basic_bmatrix< BV >::get_octet(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_, and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get().

◆ copy_range()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::copy_range ( const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &  sv,
size_type  left,
size_type  right,
bm::null_support  splice_null = bm::use_null 
)

copy range of values from another sparse vector

Copy [left..right] values from the source vector, clear everything outside the range.

Parameters
sv- source vector
left- index from in losed diapason of [left..right]
right- index to in losed diapason of [left..right]
splice_null- "use_null" copy range for NULL vector or do not copy it

Definition at line 1886 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_all(), bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::copy_range_plains(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix2_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::resize(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size(), and bm::xor_swap().

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_back().

◆ decode()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename CharMatrix >
size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode ( CharMatrix &  cmatr,
size_type  idx_from,
size_type  dec_size,
bool  zero_mem = true 
) const
inline

Bulk export strings to a C-style matrix of chars.

Parameters
cmatr- dest matrix (bm::heap_matrix)
idx_from- index in the sparse vector to export from
dec_size- decoding size (matrix column allocation should match)
zero_mem- set to false if target array is pre-initialized with 0s to avoid performance penalty
Returns
number of actually exported elements (can be less than requested)

Definition at line 907 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode_substr().

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_from().

◆ decode_substr()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename CharMatrix >
size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode_substr ( CharMatrix &  cmatr,
size_type  idx_from,
size_type  dec_size,
unsigned  substr_from,
unsigned  substr_to,
bool  zero_mem = true 
) const
inline

Bulk export strings to a C-style matrix of chars.

Parameters
cmatr- dest matrix (bm::heap_matrix)
idx_from- index in the sparse vector to export from
dec_size- decoding size (matrix column allocation should match)
substr_from- sub-string position from
substr_to- sub-string position to
zero_mem- set to false if target array is pre-initialized with 0s to avoid performance penalty
Returns
number of actually exported elements (can be less than requested)

Decoder functor

< target array for reverse transpose

< bit-plane mask

< i

< SV read offset

Definition at line 931 of file bmstrsparsevec.h.

References BM_ASSERT, bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatr_, BMNOEXCEPT2, BMRESTRICT, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::end(), bm::for_each_bit_range_no_check(), bm::basic_bmatrix< BV >::get_row(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_, and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size().

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode().

◆ effective_max_str()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_max_str ( ) const

get effective string length used in vector Calculate and returns efficiency, how close are we to the reserved maximum.

Returns
current string length maximum

Definition at line 1617 of file bmstrsparsevec.h.

References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatr_, and bm::basic_bmatrix< BV >::row().

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_vector_max(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::max_str().

◆ effective_size()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_size ( ) const
inline

size of sparse vector (may be different for RSC)

Definition at line 1123 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size().

◆ effective_vector_max()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_vector_max ( ) const
inline

◆ empty()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::empty ( ) const
inline

◆ end()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
const_iterator bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::end ( ) const
inline

Provide const iterator access to the end.

Examples:
strsvsample01.cpp, strsvsample02.cpp, strsvsample04.cpp, and strsvsample06.cpp.

Definition at line 770 of file bmstrsparsevec.h.

References bm::id_max.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode_substr(), and main().

◆ equal()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::equal ( const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &  sv,
bm::null_support  null_able = bm::use_null 
) const

check if another sparse vector has the same content and size

Parameters
sv- sparse vector for comparison
null_able- flag to consider NULL vector in comparison (default) or compare only value content plains
Returns
true, if it is the same

Definition at line 1859 of file bmstrsparsevec.h.

References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::equal(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_, and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix2_.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_back().

◆ erase()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::erase ( size_type  idx)

◆ find_rank()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::find_rank ( size_type  rank,
size_type pos 
)
static

find position of compressed element by its rank

Definition at line 1604 of file bmstrsparsevec.h.

References BM_ASSERT.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_back().

◆ get() [1/2]

template<class CharType , class BV , unsigned MAX_STR_SIZE>
str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get ( size_type  idx,
value_type str,
size_type  buf_size 
) const

get specified element

Parameters
idx- element index
str- string buffer
buf_size- string buffer size
Returns
string length
Examples:
strsvsample05.cpp, and xsample05.cpp.

Definition at line 1455 of file bmstrsparsevec.h.

References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatr_, bm::basic_bmatrix< BV >::get_octet(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_, and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_.

Referenced by check_sparse(), and main().

◆ get() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename StrType >
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get ( size_type  idx,
StrType &  str 
) const
inline

◆ get_back_inserter()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
back_insert_iterator bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_back_inserter ( )
inline

Provide back insert iterator Back insert iterator implements buffered insertion, which is faster, than random access or push_back.

Examples:
strsvsample03.cpp, strsvsample04.cpp, strsvsample05.cpp, strsvsample06.cpp, and xsample05.cpp.

Definition at line 782 of file bmstrsparsevec.h.

Referenced by main().

◆ get_const_iterator()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
const_iterator bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_const_iterator ( size_type  idx) const
inline

Get const_itertor re-positioned to specific element.

Parameters
idx- position in the sparse vector

Definition at line 775 of file bmstrsparsevec.h.

◆ get_remap_buffer()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
const unsigned char* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_remap_buffer ( ) const
inlineprotected

◆ get_remap_matrix() [1/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
const remap_matrix_type* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_remap_matrix ( ) const
inlineprotected

◆ get_remap_matrix() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
remap_matrix_type* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_remap_matrix ( )
inlineprotected

◆ import()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename CharMatrix >
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import ( CharMatrix &  cmatr,
size_type  idx_from,
size_type  imp_size 
)
inline

Bulk import of strings from a C-style matrix of chars.

Parameters
cmatr- source matrix (bm::heap_matrix) [in/out] parameter gets modified(corrupted) in the process
idx_from- destination index in the sparse vector
imp_size- import size (number or rows to import)

Definition at line 1044 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_range(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check(), and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.

◆ import_back()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename CharMatrix >
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_back ( CharMatrix &  cmatr,
size_type  imp_size 
)
inline

Bulk push-back import of strings from a C-style matrix of chars.

Parameters
cmatr- source matrix (bm::heap_matrix) [in/out] parameter gets modified(corrupted) in the process
imp_size- import size (number or rows to import)

Definition at line 1065 of file bmstrsparsevec.h.

References BMNOEXCEPT, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::copy_range(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::equal(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::find_rank(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::sync(), and bm::use_null.

◆ import_no_check()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename CharMatrix >
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check ( CharMatrix &  cmatr,
size_type  idx_from,
size_type  imp_size,
bool  set_not_null = true 
)
inlineprotected

◆ init_remap_buffer()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
unsigned char* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::init_remap_buffer ( )
inlineprotected

◆ insert() [1/2]

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::insert ( size_type  idx,
const value_type str 
)

◆ insert() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename StrType >
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::insert ( size_type  idx,
const StrType &  str 
)
inline

insert STL string

Parameters
idx- element index (vector auto-resized if needs to)
str- STL string to set

Definition at line 510 of file bmstrsparsevec.h.

References BMNOEXCEPT, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::erase(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::insert().

◆ insert_value()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::insert_value ( size_type  idx,
const value_type str 
)
protected

◆ insert_value_no_null()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::insert_value_no_null ( size_type  idx,
const value_type str 
)
protected

◆ is_compressed()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
static bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::is_compressed ( )
inlinestatic

trait if sparse vector is "compressed" (false)

Definition at line 796 of file bmstrsparsevec.h.

◆ is_remap()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::is_remap ( ) const
inline

◆ max_str()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
static size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::max_str ( )
inlinestatic

◆ operator=() [1/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
str_sparse_vector<CharType, BV, MAX_STR_SIZE>& bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator= ( const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &  str_sv)
inline

◆ operator=() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
str_sparse_vector<CharType, BV, MAX_STR_SIZE>& bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator= ( str_sparse_vector< CharType, BV, MAX_STR_SIZE > &&  str_sv)
inline

move assignmment operator

Definition at line 458 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::swap().

◆ operator[]() [1/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
const const_reference bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator[] ( size_type  idx) const
inline

Operator to get read access to an element.

Definition at line 475 of file bmstrsparsevec.h.

◆ operator[]() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
reference bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator[] ( size_type  idx)
inline

◆ optimize()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::optimize ( bm::word_t temp_block = 0,
typename bvector_type::optmode  opt_mode = bvector_type::opt_compress,
typename str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics stat = 0 
)

run memory optimization for all vector plains

Parameters
temp_block- pre-allocated memory block to avoid unnecessary re-allocs
opt_mode- requested compression depth
stat- memory allocation statistics after optimization
Examples:
strsvsample01.cpp, strsvsample02.cpp, strsvsample03.cpp, strsvsample05.cpp, strsvsample06.cpp, and xsample05.cpp.

Definition at line 1483 of file bmstrsparsevec.h.

References bm::bv_statistics::add(), and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::optimize().

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_vector_max(), and main().

◆ push_back() [1/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<typename StrType >
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::push_back ( const StrType &  str)
inline

push back a string

Parameters
str- string to set (STL class with size() support, like basic_string)
Examples:
strsvsample01.cpp, and strsvsample04.cpp.

Definition at line 583 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::assign(), and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.

Referenced by main().

◆ push_back() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::push_back ( const value_type str)
inline

push back a string (zero terminated)

Parameters
str- string to set

Definition at line 589 of file bmstrsparsevec.h.

References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.

◆ recalc_remap_matrix2()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::recalc_remap_matrix2 ( )

◆ remap()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap ( )

◆ remap_from()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_from ( const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &  str_sv)

◆ remap_fromsv()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_fromsv ( value_type *BMRESTRICT  str,
size_type  buf_size,
const value_type *BMRESTRICT  sv_str,
const plane_octet_matrix_type &BMRESTRICT  octet_remap_matrix1 
)
static

remap string from internal code to external (ASCII) system

Returns
true if remapping was ok, false if found incorrect value for the plain

Definition at line 1752 of file bmstrsparsevec.h.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_tosv().

◆ remap_size()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
size_t bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_size ( ) const
inlineprotected

◆ remap_tosv() [1/2]

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_tosv ( value_type *BMRESTRICT  sv_str,
size_type  buf_size,
const value_type *BMRESTRICT  str,
const plane_octet_matrix_type &BMRESTRICT  octet_remap_matrix2 
)
static

remap string from external (ASCII) system to matrix internal code

Returns
true if remapping was ok, false if found incorrect value for the plain

Definition at line 1724 of file bmstrsparsevec.h.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::is_remap(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_tosv().

◆ remap_tosv() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_tosv ( value_type sv_str,
size_type  buf_size,
const value_type str 
) const
inline

◆ resize()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::resize ( size_type  sz)
inline

◆ resize_internal()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::resize_internal ( size_type  sz)
inlineprotected

◆ resolve_range()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::resolve_range ( size_type  from,
size_type  to,
size_type idx_from,
size_type idx_to 
) const
inlineprotected

Definition at line 1256 of file bmstrsparsevec.h.

◆ set()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set ( size_type  idx,
const value_type str 
)

set specified element with bounds checking and automatic resize

Parameters
idx- element index (vector auto-resized if needs to)
str- string to set (zero terminated)
Examples:
strsvsample01.cpp, strsvsample04.cpp, and strsvsample06.cpp.

Definition at line 1318 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set_value(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size(), and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.

Referenced by main().

◆ set_null()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set_null ( size_type  idx)

set NULL status for the specified element Vector is resized automatically

Parameters
idx- element index (vector auto-resized if needs to)
Examples:
strsvsample04.cpp.

Definition at line 1357 of file bmstrsparsevec.h.

References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_null_bvect(), and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.

Referenced by main(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator[]().

◆ set_remap()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set_remap ( )
inlineprotected

◆ set_value()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set_value ( size_type  idx,
const value_type str 
)
protected

◆ set_value_no_null()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set_value_no_null ( size_type  idx,
const value_type str 
)
protected

◆ size()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size ( ) const
inline

◆ size_internal()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_internal ( ) const
inlineprotected

◆ swap()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::swap ( str_sparse_vector< CharType, BV, MAX_STR_SIZE > &  str_sv)

◆ sync()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::sync ( bool  force)

◆ sync_size()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::sync_size ( )

recalculate size to exclude tail NULL elements After this call size() will return the true size of the vector

Definition at line 2232 of file bmstrsparsevec.h.

References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_null_bvector(), and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_vector_max().

◆ throw_bad_value()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::throw_bad_value ( const char *  err_msg)
staticprotected

◆ throw_range_error()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::throw_range_error ( const char *  err_msg)
staticprotected

throw range error

Definition at line 1926 of file bmstrsparsevec.h.

References BM_ASSERT_THROW.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check().

Friends And Related Function Documentation

◆ sparse_vector_deserializer

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<class SVect >
friend class sparse_vector_deserializer
friend

Definition at line 1269 of file bmstrsparsevec.h.

◆ sparse_vector_serializer

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
template<class SVect >
friend class sparse_vector_serializer
friend

Definition at line 1268 of file bmstrsparsevec.h.

Field Documentation

◆ remap_flags_

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
unsigned bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_
protected

◆ remap_matrix1_

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
plane_octet_matrix_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_
protected

◆ remap_matrix2_

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
plane_octet_matrix_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix2_
protected

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