BitMagic-C++
|
sparse vector for strings with compression using bit transposition method More...
#include <bmstrsparsevec.h>
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 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. | |
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 | |
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 | |
size_type | effective_size () const BMNOEXCEPT |
size of sparse vector (may be different for RSC) | |
String element access | |
reference | operator[] (size_type idx) |
Operator to get write access to an element | |
const_reference | operator[] (size_type idx) const |
Operator to get read access to an element | |
void | set (size_type idx, const value_type *str) |
set specified element with bounds checking and automatic resize | |
void | set_null (size_type idx) |
set NULL status for the specified element Vector is resized automatically | |
void | insert (size_type idx, const value_type *str) |
insert the specified element | |
template<typename StrType > | |
void | insert (size_type idx, const StrType &str) |
insert STL string | |
void | erase (size_type idx) |
erase the specified element | |
size_type | get (size_type idx, value_type *str, size_type buf_size) const BMNOEXCEPT |
get specified element | |
template<typename StrType > | |
void | assign (size_type idx, const StrType &str) |
set specified element with bounds checking and automatic resize | |
template<typename StrType > | |
void | push_back (const StrType &str) |
push back a string | |
void | push_back (const value_type *str) |
push back a string (zero terminated) | |
template<typename StrType > | |
void | get (size_type idx, StrType &str) const |
get specified string element Template method expects an STL-compatible type basic_string<> | |
void | swap (str_sparse_vector &str_sv) BMNOEXCEPT |
Element comparison functions <br> | |
int | compare (size_type idx, const value_type *str) const BMNOEXCEPT |
Compare vector element with argument lexicographically. | |
unsigned | common_prefix_length (size_type idx1, size_type idx2) const BMNOEXCEPT |
Find size of common prefix between two vector elements in octets. | |
Clear <br> | |
void | clear () BMNOEXCEPT |
resize to zero, free memory | |
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) | |
Memory optimization/compression <br> | |
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 | |
void | calc_stat (struct str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics *st) const BMNOEXCEPT |
Calculates memory statistics. | |
Iterator access | |
const_iterator | begin () const BMNOEXCEPT |
Provide const iterator access to container content | |
const_iterator | end () const BMNOEXCEPT |
Provide const iterator access to the end | |
const_iterator | get_const_iterator (size_type idx) const BMNOEXCEPT |
Get const_itertor re-positioned to specific element. | |
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. | |
Export content to C-style <br> | |
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. | |
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. | |
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. | |
Merge, split, partition data <br> | |
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 | |
![]() | |
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 () BMNOEXCEPT |
resize to zero, free memory | |
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 | |
void | calc_stat (typename bvector_type::statistics *st) const BMNOEXCEPT |
Calculates memory statistics. | |
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 | |
bool | is_nullable () const BMNOEXCEPT |
check if container supports NULL(unassigned) values | |
const bvector_type * | get_null_bvector () const BMNOEXCEPT |
Get bit-vector of assigned values or NULL (if not constructed that way) | |
bool | is_null (size_type idx) const BMNOEXCEPT |
test if specified element is NULL | |
bvector_type_ptr | get_plain (unsigned i) |
get access to bit-plain, function checks and creates a plain | |
bvector_type_const_ptr | get_plain (unsigned i) const BMNOEXCEPT |
get read-only access to bit-plain | |
unsigned | effective_plains () const BMNOEXCEPT |
Number of effective bit-plains in the value type. | |
bvector_type_ptr | plain (unsigned i) BMNOEXCEPT |
get access to bit-plain as is (can return NULL) | |
bvector_type_const_ptr | plain (unsigned i) const BMNOEXCEPT |
bvector_type * | get_null_bvect () |
void | free_plain (unsigned i) |
free memory in bit-plain | |
bm::id64_t | get_plains_mask (unsigned element_idx) const BMNOEXCEPT |
const bmatrix_type & | get_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 | |
Various traits <br> | |
static bool | is_compressed () BMNOEXCEPT |
trait if sparse vector is "compressed" (false) | |
![]() | |
static unsigned | plains () BMNOEXCEPT |
get total number of bit-plains in the vector | |
static unsigned | stored_plains () BMNOEXCEPT |
Number of stored bit-plains (value plains + extra. | |
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 | |
void | set_value_no_null (size_type idx, const value_type *str) |
set value without checking boundaries or support of NULL | |
void | insert_value (size_type idx, const value_type *str) |
insert value without checking boundaries | |
void | insert_value_no_null (size_type idx, const value_type *str) |
insert value without checking boundaries or support of NULL | |
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 |
![]() | |
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 | |
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. | |
Static Protected Member Functions | |
Errors and exceptions <br> | |
static void | throw_range_error (const char *err_msg) |
throw range error | |
static void | throw_bad_value (const char *err_msg) |
throw domain error | |
![]() | |
static unsigned | value_bits () BMNOEXCEPT |
Number of total bit-plains in the value type. | |
static unsigned | null_plain () BMNOEXCEPT |
plain index for the "NOT NULL" flags plain | |
Protected Attributes | |
unsigned | remap_flags_ |
remapping status | |
plain_octet_matrix_type | remap_matrix1_ |
octet remap table 1 | |
plain_octet_matrix_type | remap_matrix2_ |
octet remap table 2 | |
![]() | |
bmatrix_type | bmatr_ |
bit-transposed matrix | |
size_type | size_ |
array size | |
unsigned | effective_plains_ |
Friends | |
template<class SVect > | |
class | sparse_vector_serializer |
template<class SVect > | |
class | sparse_vector_deserializer |
Size, etc <br> | |
size_type | size () const |
return size of the vector | |
bool | empty () const |
return true if vector is empty | |
void | resize (size_type sz) |
resize vector | |
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. | |
size_type | effective_vector_max () const |
get effective string length used in vector | |
static size_type | max_str () |
get maximum string length capacity | |
remapping, succinct utilities | |
Remapping implements reduction of dit-depth thus improves search performance. Remapping limits farther modifications of sparse vector. | |
bool | is_remap () const BMNOEXCEPT |
Get remapping status (true|false) | |
void | remap_from (const str_sparse_vector &str_sv) |
Build remapping profile and load content from another sparse vector. | |
void | calc_octet_stat (plain_octet_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 (plain_octet_matrix_type &octet_remap_matrix1, plain_octet_matrix_type &octet_remap_matrix2, const plain_octet_matrix_type &octet_occupancy_matrix) |
static bool | remap_tosv (value_type *BMRESTRICT sv_str, size_type buf_size, const value_type *BMRESTRICT str, const plain_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 plain_octet_matrix_type &BMRESTRICT octet_remap_matrix1) BMNOEXCEPT |
Additional Inherited Members | |
![]() | |
typedef bvector_type::block_idx_type | block_idx_type |
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.
Definition at line 56 of file bmstrsparsevec.h.
typedef bvector_type::allocation_policy bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::allocation_policy_type |
Definition at line 65 of file bmstrsparsevec.h.
typedef allocator_type::allocator_pool_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::allocator_pool_type |
Definition at line 67 of file bmstrsparsevec.h.
typedef BV::allocator_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::allocator_type |
Definition at line 64 of file bmstrsparsevec.h.
typedef bm::basic_bmatrix<BV> bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatrix_type |
Definition at line 68 of file bmstrsparsevec.h.
typedef bvector_type::enumerator bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bvector_enumerator_type |
Definition at line 66 of file bmstrsparsevec.h.
typedef BV bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bvector_type |
Definition at line 59 of file bmstrsparsevec.h.
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.
typedef bvector_type* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::bvector_type_ptr |
Definition at line 60 of file bmstrsparsevec.h.
typedef base_sparse_vector<CharType, BV, MAX_STR_SIZE> bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::parent_type |
Definition at line 69 of file bmstrsparsevec.h.
typedef bm::heap_matrix<unsigned char, MAX_STR_SIZE, 256, typename bvector_type::allocator_type> bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::plain_octet_matrix_type |
Definition at line 85 of file bmstrsparsevec.h.
typedef bvector_type::size_type bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_type |
Definition at line 63 of file bmstrsparsevec.h.
typedef CharType bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::value_type |
Definition at line 62 of file bmstrsparsevec.h.
enum bm::str_sparse_vector::octet_plains |
Enumerator | |
---|---|
sv_octet_plains |
Definition at line 75 of file bmstrsparsevec.h.
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.
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 |
Definition at line 1122 of file bmstrsparsevec.h.
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 1135 of file bmstrsparsevec.h.
|
inline |
move-ctor
Definition at line 397 of file bmstrsparsevec.h.
References 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_, and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::swap().
|
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
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> |
Definition at line 494 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().
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
Definition at line 1700 of file bmstrsparsevec.h.
Referenced by main().
|
static |
Definition at line 1483 of file bmstrsparsevec.h.
References BM_ASSERT.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_from().
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::calc_octet_stat | ( | plain_octet_matrix_type & | octet_matrix | ) | const |
Calculate flags which octets are present on each byte-plain.
Definition at line 1457 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_from().
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::calc_stat | ( | struct str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics * | st | ) | const |
Calculates memory statistics.
Function fills statistics structure containing information about how this vector uses memory and estimation of max. amount of memory bvector needs to serialize itself.
st | - pointer on statistics structure to be filled in. |
Definition at line 1338 of file bmstrsparsevec.h.
References bm::bv_statistics::bit_blocks, BM_ASSERT, bm::bv_statistics::bv_count, bm::bv_statistics::gap_blocks, bm::bv_statistics::gap_cap_overhead, bm::bv_statistics::max_serialize_mem, bm::bv_statistics::memory_used, and bm::bv_statistics::ptr_sub_blocks.
Referenced by main().
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear | ( | ) |
resize to zero, free memory
Definition at line 1710 of file bmstrsparsevec.h.
|
inline |
clear range (assign bit 0 for all plains)
left | - interval start |
right | - interval end (closed interval) |
set_null | - set cleared values to unassigned (NULL) |
Definition at line 620 of file bmstrsparsevec.h.
References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_range(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set_null().
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import(), and main().
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.
Definition at line 1399 of file bmstrsparsevec.h.
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.
idx | - vactor element index |
str | - argument to compare with |
Definition at line 1370 of file bmstrsparsevec.h.
References BM_ASSERT.
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.
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 1678 of file bmstrsparsevec.h.
References 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 >::size(), and bm::xor_swap().
|
inline |
Bulk export strings to a C-style matrix of chars.
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 |
Definition at line 829 of file bmstrsparsevec.h.
References BM_ASSERT, bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatr_, 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_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size(), and bm::bvector< Alloc >::iterator_base::valid().
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_from().
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.
Definition at line 1439 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_vector_max().
|
inline |
size of sparse vector (may be different for RSC)
Definition at line 968 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size().
|
inline |
get effective string length used in vector
Definition at line 664 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_max_str().
|
inline |
return true if vector is empty
Definition at line 642 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size().
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::flush(), main(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_from().
|
inline |
Provide const iterator access to the end
Definition at line 709 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::const_iterator(), and bm::id_max.
Referenced by main().
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
sv | - sparse vector for comparison |
null_able | - flag to consider NULL vector in comparison (default) or compare only value content plains |
Definition at line 1651 of file bmstrsparsevec.h.
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::erase | ( | size_type | idx | ) |
erase the specified element
idx | - element index |
Definition at line 1185 of file bmstrsparsevec.h.
References BM_ASSERT.
Referenced by main().
|
static |
find position of compressed element by its rank
Definition at line 1426 of file bmstrsparsevec.h.
References BM_ASSERT.
|
inline |
get specified string element Template method expects an STL-compatible type basic_string<>
idx | - element index (vector auto-resized if needs to) |
str | - string to get [out] |
Definition at line 548 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_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_, and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::throw_bad_value().
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
idx | - element index |
str | - string buffer |
buf_size | - string buffer size |
Definition at line 1295 of file bmstrsparsevec.h.
Referenced by check_sparse(), main(), and main().
|
inline |
Provide back insert iterator Back insert iterator implements buffered insertion, which is faster, than random access or push_back.
Definition at line 721 of file bmstrsparsevec.h.
Referenced by main().
|
inline |
Get const_itertor re-positioned to specific element.
idx | - position in the sparse vector |
Definition at line 714 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::const_iterator().
|
inlineprotected |
Definition at line 1090 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_.
|
inline |
Bulk import of strings from a C-style matrix of chars.
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 889 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_.
|
inline |
Bulk push-back import of strings from a C-style matrix of chars.
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 910 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size().
|
inlineprotected |
Definition at line 974 of file bmstrsparsevec.h.
References bm::bit_list(), BM_ASSERT, bm::BM_SORTED, bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::bmatr_, bm::basic_bmatrix< BV >::construct_row(), bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_null_bvect(), bm::basic_bmatrix< BV >::get_row(), bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::plain(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix2_, bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size(), bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_, and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::throw_bad_value().
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_back().
|
inlineprotected |
Definition at line 1092 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_.
|
inline |
insert STL string
idx | - element index (vector auto-resized if needs to) |
str | - STL string to set |
Definition at line 459 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::insert().
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::insert | ( | size_type | idx, |
const value_type * | str | ||
) |
insert the specified element
idx | - element index (vector auto-resized if needs to) |
str | - string to set (zero terminated) |
Definition at line 1169 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::insert(), insertion_sort(), and main().
|
protected |
insert value without checking boundaries
Definition at line 1253 of file bmstrsparsevec.h.
|
protected |
insert value without checking boundaries or support of NULL
Definition at line 1263 of file bmstrsparsevec.h.
References BM_ASSERT.
|
inlinestatic |
trait if sparse vector is "compressed" (false)
Definition at line 735 of file bmstrsparsevec.h.
|
inline |
Get remapping status (true|false)
Definition at line 750 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_from().
|
inlinestatic |
get maximum string length capacity
Definition at line 652 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::sv_octet_plains.
|
inline |
copy assignmment operator
Definition at line 385 of file bmstrsparsevec.h.
References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::copy_from(), 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_.
|
inline |
move assignmment operator
Definition at line 406 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::swap().
|
inline |
Operator to get write access to an element
Definition at line 424 of file bmstrsparsevec.h.
|
inline |
Operator to get read access to an element
Definition at line 427 of file bmstrsparsevec.h.
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
temp_block | - pre-allocated memory block to avoid unnecessary re-allocs |
opt_mode | - requested compression depth |
stat | - memory allocation statistics after optimization |
Definition at line 1323 of file bmstrsparsevec.h.
References bm::bv_statistics::add().
|
inline |
push back a string
str | - string to set (STL class with size() support, like basic_string) |
Definition at line 532 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_.
|
inline |
push back a string (zero terminated)
str | - string to set |
Definition at line 538 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set(), and bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::recalc_remap_matrix2 | ( | ) |
re-calculate remap matrix2 based on matrix1
Definition at line 1516 of file bmstrsparsevec.h.
References BM_ASSERT.
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_from | ( | const str_sparse_vector< CharType, BV, MAX_STR_SIZE > & | str_sv | ) |
Build remapping profile and load content from another sparse vector.
str_sv | - source sparse vector (assumed it is not remapped) |
Definition at line 1600 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::build_octet_remap(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::calc_octet_stat(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::empty(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::is_remap().
|
static |
remap string from internal code to external (ASCII) system
Definition at line 1570 of file bmstrsparsevec.h.
|
inlineprotected |
Definition at line 1089 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix1_.
|
static |
remap string from external (ASCII) system to matrix internal code
Definition at line 1542 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_tosv().
|
inline |
remap string from external (ASCII) system to matrix internal code
Definition at line 786 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_matrix2_, and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_tosv().
|
inline |
resize vector
sz | - new size |
Definition at line 647 of file bmstrsparsevec.h.
References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::resize().
Referenced by generate_string_set(), generate_string_set(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::resize_internal().
|
inlineprotected |
Definition at line 1087 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::resize().
|
inlineprotected |
Definition at line 1101 of file bmstrsparsevec.h.
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
idx | - element index (vector auto-resized if needs to) |
str | - string to set (zero terminated) |
Definition at line 1158 of file bmstrsparsevec.h.
Referenced by main(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::push_back().
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
idx | - element index (vector auto-resized if needs to) |
Definition at line 1197 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::clear_range(), and main().
|
inlineprotected |
Definition at line 1097 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_flags_.
|
protected |
set value without checking boundaries
Definition at line 1211 of file bmstrsparsevec.h.
|
protected |
set value without checking boundaries or support of NULL
Definition at line 1223 of file bmstrsparsevec.h.
References BM_ASSERT.
|
inline |
return size of the vector
Definition at line 637 of file bmstrsparsevec.h.
References bm::base_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::assign(), check_sparse(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::copy_range(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::effective_size(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::empty(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_back(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check(), main(), main(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size_internal().
|
inlineprotected |
Definition at line 1086 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::size().
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::swap | ( | str_sparse_vector< CharType, BV, MAX_STR_SIZE > & | str_sv | ) |
Swap content
Definition at line 1146 of file bmstrsparsevec.h.
References bm::xor_swap().
Referenced by main(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator=().
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::sync | ( | bool | force | ) |
syncronize internal structures
Definition at line 1640 of file bmstrsparsevec.h.
|
staticprotected |
throw domain error
Definition at line 1731 of file bmstrsparsevec.h.
References BM_ASSERT_THROW.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check().
|
staticprotected |
|
friend |
Definition at line 1109 of file bmstrsparsevec.h.
|
friend |
Definition at line 1108 of file bmstrsparsevec.h.
|
protected |
remapping status
Definition at line 1112 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::assign(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::copy_range(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::is_remap(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator=(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::set_remap(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::str_sparse_vector().
|
protected |
octet remap table 1
Definition at line 1113 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::copy_range(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::decode(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::get_remap_buffer(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::init_remap_buffer(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator=(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_size(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::str_sparse_vector().
|
protected |
octet remap table 2
Definition at line 1114 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::assign(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::copy_range(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::import_no_check(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::operator=(), bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::remap_tosv(), and bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::str_sparse_vector().