Go to the documentation of this file. 1 #ifndef BMSTRSPARSEVEC__H__INCLUDED__
2 #define BMSTRSPARSEVEC__H__INCLUDED__
32 #ifndef BM__H__INCLUDED__
35 # error missing include (bm.h or bm64.h)
55 template<
typename CharType,
typename BV,
unsigned MAX_STR_SIZE>
81 bm::heap_matrix<
unsigned char,
99 : str_sv_(str_sv), idx_(idx)
104 str_sv_.get(idx_, buf_, MAX_STR_SIZE);
109 {
return bool(*
this) == bool(ref); }
114 mutable CharType buf_[MAX_STR_SIZE];
126 : str_sv_(str_sv), idx_(idx)
131 str_sv_.get(idx_, buf_, MAX_STR_SIZE);
144 str_sv_.set(idx_, str);
148 {
return bool(*
this) == bool(ref); }
153 mutable CharType buf_[MAX_STR_SIZE];
192 {
return (pos_ == it.pos_) && (sv_ == it.sv_); }
196 {
return pos_ < it.pos_; }
198 {
return pos_ <= it.pos_; }
200 {
return pos_ > it.pos_; }
202 {
return pos_ >= it.pos_; }
209 { this->
advance();
return *
this; }
238 typedef
bm::heap_matrix<CharType,
290 this->flush(); sv_ = bi.sv_;
298 { this->add(v);
return *
this; }
302 template<
typename StrType>
305 this->add(v.c_str());
return *
this;
342 n_buf_size = 1024 * 8
344 typedef bm::heap_matrix<CharType,
458 template<
typename StrType>
461 this->
insert(idx, str.c_str());
493 template<
typename StrType>
496 if (idx >= this->
size())
509 CharType ch = str[i];
514 ch = CharType(remap_value);
531 template<
typename StrType>
547 template<
typename StrType>
551 for (
unsigned i = 0; i < MAX_STR_SIZE; ++i)
559 unsigned char remap_value = remap_row[unsigned(ch)];
566 ch = CharType(remap_value);
828 template<
typename CharMatrix>
831 bool zero_mem =
true)
const
840 if (max_sz < dec_size)
847 for (
unsigned i = 0; i < MAX_STR_SIZE; ++i)
850 for (
unsigned k = i * 8; k < (i * 8) + 8; ++k, ++bi)
857 for ( ;en.
valid(); ++en )
862 typename CharMatrix::value_type* str = cmatr.row(idx);
870 for (
unsigned i = 0; i < dec_size; ++i)
872 typename CharMatrix::value_type* str = cmatr.row(i);
888 template<
typename CharMatrix>
893 if (idx_from < this->
size_)
896 this->
clear_range(idx_from, idx_from + imp_size - 1);
909 template<
typename CharMatrix>
945 void sync(
bool force);
973 template<
typename CharMatrix>
976 bool set_not_null =
true)
980 unsigned max_str_size = 0;
982 for (
unsigned j = 0; j < imp_size; ++j)
984 typename CharMatrix::value_type* str = cmatr.row(j);
986 for (i = 0; i < MAX_STR_SIZE; ++i)
991 max_str_size = (i > max_str_size) ? i : max_str_size;
1000 str[i] = CharType(remap_value);
1003 if (i == MAX_STR_SIZE)
1009 for (
unsigned i = 0; i < max_str_size; ++i)
1011 for (
unsigned bi = 0; bi < 8; ++bi)
1013 unsigned n_bits = 0;
1015 for (
size_type j = 0; j < imp_size; ++j)
1017 typename CharMatrix::value_type* str = cmatr.row(j);
1029 unsigned plain = i*8 + bi;
1041 size_type idx_to = idx_from + imp_size - 1;
1046 bv_null->set_range(idx_from, idx_to);
1048 if (idx_to >= this->
size())
1049 this->
size_ = idx_to+1;
1104 *idx_from = from; *idx_to = to;
return true;
1121 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1134 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1138 remap_flags_(str_sv.remap_flags_),
1139 remap_matrix1_(str_sv.remap_matrix1_),
1140 remap_matrix2_(str_sv.remap_matrix2_)
1145 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1149 parent_type::swap(str_sv);
1151 remap_matrix1_.swap(str_sv.remap_matrix1_);
1152 remap_matrix2_.swap(str_sv.remap_matrix2_);
1157 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1161 if (idx >= this->size())
1162 this->size_ = idx+1;
1163 set_value(idx, str);
1168 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1172 if (idx >= this->size())
1174 this->size_ = idx+1;
1175 set_value(idx, str);
1178 insert_value(idx, str);
1184 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1188 if (idx >= this->size_)
1190 this->erase_column(idx);
1196 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1201 bv_null->clear_bit_no_check(idx);
1202 if (idx >= this->size_)
1204 this->size_ = idx + 1;
1210 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1214 set_value_no_null(idx, str);
1217 bv_null->set_bit_no_check(idx);
1222 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1226 for (
unsigned i = 0; i < MAX_STR_SIZE; ++i)
1228 CharType ch = str[i];
1231 this->clear_value_plains_from(i*8, idx);
1237 unsigned char remap_value = remap_matrix2_.get(i,
unsigned(ch));
1241 this->clear_value_plains_from(i*8, idx);
1244 ch = CharType(remap_value);
1246 this->bmatr_.set_octet(idx, i, (
unsigned char)ch);
1252 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1256 insert_value_no_null(idx, str);
1257 this->insert_null(idx,
true);
1262 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1266 for (
unsigned i = 0; i < MAX_STR_SIZE; ++i)
1268 CharType ch = str[i];
1271 this->insert_clear_value_plains_from(i*8, idx);
1277 unsigned char remap_value = remap_matrix2_.get(i,
unsigned(ch));
1281 this->insert_clear_value_plains_from(i*8, idx);
1284 ch = CharType(remap_value);
1286 this->bmatr_.insert_octet(idx, i, (
unsigned char)ch);
1293 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1299 for (; i < MAX_STR_SIZE; ++i)
1305 CharType ch = CharType(this->bmatr_.get_octet(idx, i));
1315 remap_matrix1_.remap(str, i);
1322 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1329 parent_type::optimize(temp_block, opt_mode, &stbv);
1337 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1344 parent_type::calc_stat(&stbv);
1356 size_t remap_mem_usage =
sizeof(remap_flags_);
1357 remap_mem_usage += remap_matrix1_.get_buffer().mem_usage();
1358 remap_mem_usage += remap_matrix2_.get_buffer().mem_usage();
1360 st->memory_used += remap_mem_usage;
1363 st->max_serialize_mem += remap_mem_usage;
1369 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1376 for (
unsigned i = 0; i < MAX_STR_SIZE; ++i)
1378 CharType ch = str[i];
1379 if (remap_flags_ && ch)
1381 unsigned char remap_value = remap_matrix2_.get(i,
unsigned(ch));
1386 ch = CharType(remap_value);
1389 res = this->bmatr_.compare_octet(idx, i, ch);
1398 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1403 for (; i < MAX_STR_SIZE; ++i)
1405 CharType ch1 = CharType(this->bmatr_.get_octet(idx1, i));
1406 CharType ch2 = CharType(this->bmatr_.get_octet(idx2, i));
1424 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1437 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1442 for (
int i = MAX_STR_SIZE-1; i >= 0; --i)
1444 unsigned octet_plain = unsigned(i) * unsigned(
sizeof(CharType)) * 8;
1445 for (
unsigned j = 0; j <
sizeof(CharType) * 8; ++j)
1447 if (this->bmatr_.row(octet_plain+j))
1448 return unsigned(i)+1;
1456 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1460 octet_matrix.init();
1461 octet_matrix.set_zero();
1465 for (
unsigned i = 0; i < MAX_STR_SIZE; ++i)
1467 unsigned char* row = octet_matrix.row(i);
1472 unsigned char ch = this->bmatr_.get_octet(j, i);
1482 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1488 octet_remap_matrix1.init();
1489 octet_remap_matrix1.set_zero();
1490 octet_remap_matrix2.init();
1491 octet_remap_matrix2.set_zero();
1493 for (
unsigned i = 0; i < octet_occupancy_matrix.rows(); ++i)
1495 const unsigned char* row = octet_occupancy_matrix.row(i);
1496 unsigned char* remap_row1 = octet_remap_matrix1.row(i);
1497 unsigned char* remap_row2 = octet_remap_matrix2.row(i);
1499 for (
unsigned j = 1; j < octet_occupancy_matrix.cols(); ++j)
1504 remap_row1[count] = (
unsigned char)j;
1505 remap_row2[j] = (
unsigned char)count;
1515 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1520 remap_matrix2_.init();
1521 remap_matrix2_.set_zero();
1523 for (
unsigned i = 0; i < remap_matrix1_.rows(); ++i)
1525 const unsigned char* remap_row1 = remap_matrix1_.row(i);
1526 unsigned char* remap_row2 = remap_matrix2_.row(i);
1527 for (
unsigned j = 1; j < remap_matrix1_.cols(); ++j)
1531 unsigned count = remap_row1[j];
1532 remap_row2[count] = (
unsigned char)j;
1541 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1548 for (
unsigned i = 0; i < buf_size; ++i)
1550 CharType ch = str[i];
1556 const unsigned char* remap_row = octet_remap_matrix2.row(i);
1557 unsigned char remap_value = remap_row[unsigned(ch)];
1562 sv_str[i] = CharType(remap_value);
1569 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1577 for (
unsigned i = 0; i < buf_size; ++i)
1579 CharType ch = sv_str[i];
1585 const unsigned char* remap_row = octet_remap_matrix1.row(i);
1586 unsigned char remap_value = remap_row[unsigned(ch)];
1591 str[i] = CharType(remap_value);
1598 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1619 const unsigned buffer_size = 1024 * 8;
1621 typedef bm::heap_matrix<CharType,
1626 remap_buffer_type cmatr(
true);
1632 this->
import(cmatr, i, dsize);
1639 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1644 recalc_remap_matrix2();
1650 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1660 if (remap_flags_ != sv.remap_flags_)
1665 b = remap_matrix1_.get_buffer().equal(sv.remap_matrix1_.get_buffer());
1668 b = remap_matrix2_.get_buffer().equal(sv.remap_matrix2_.get_buffer());
1672 return parent_type::equal(sv, null_able);
1677 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1691 this->copy_range_plains(sv, left, right, splice_null);
1692 this->resize(sv.
size());
1698 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1704 return it_type(
this);
1709 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1712 parent_type::clear();
1717 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1719 const char* err_msg)
1722 throw std::range_error(err_msg);
1730 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1732 const char* err_msg)
1736 err_msg =
"Unknown/incomparable dictionary character";
1737 throw std::domain_error(err_msg);
1749 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1756 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1759 : sv_(it.sv_), pos_(it.pos_), pos_in_buf_(~
size_type(0))
1764 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1772 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1781 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1789 if (!buf_matrix_.is_init())
1792 size_type d = sv_->decode(buf_matrix_, pos_, buffer_matrix_type::n_rows);
1799 return buf_matrix_.row(pos_in_buf_);
1804 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1810 pos_ = (!sv_ || pos >= sv_->size()) ?
bm::id_max : pos;
1816 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1824 if (pos_ >= sv_->size())
1831 if (pos_in_buf_ >= buffer_matrix_type::n_rows)
1841 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1843 : sv_(0), bv_null_(0), pos_in_buf_(~
size_type(0)), prev_nb_(0)
1848 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1856 bv_null_ = sv_->get_null_bvect();
1860 bv_null_ = 0; prev_nb_ = 0;
1866 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1869 : sv_(bi.sv_), bv_null_(bi.bv_null_), pos_in_buf_(~
size_type(0)), prev_nb_(bi.prev_nb_)
1876 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1884 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1889 return (pos_in_buf_ == ~
size_type(0) || !sv_);
1894 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1900 sv_->import_no_check(buf_matrix_, sv_->size(), pos_in_buf_+1,
false);
1906 sv_->optimize_block(prev_nb_);
1913 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1926 bv_null_->set_bit_no_check(sz + buf_idx);
1932 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1935 this->add_value(
"");
1940 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1945 this->add_value(
"");
1951 template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1960 if (!buf_matrix_.is_init())
1963 buf_matrix_.set_zero();
1966 if (pos_in_buf_ >= buffer_matrix_type::n_rows-1)
1970 buf_matrix_.set_zero();
1976 value_type* r = buf_matrix_.row(pos_in_buf_);
1977 for (
unsigned i = 0; i < buffer_matrix_type::n_columns; ++i)
void flush()
flush the accumulated buffer
unsigned char * init_remap_buffer()
bool is_remap() const BMNOEXCEPT
Get remapping status (true|false)
void insert(size_type idx, const StrType &str)
insert STL string
Constants, tables and typedefs.
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
str_sparse_vector< CharType, BV, MAX_STR_SIZE > str_sparse_vector_type
bvector_type::allocator_type allocator_type
size_t max_serialize_mem
estimated maximum memory for serialization
allocator_type::allocator_pool_type allocator_pool_type
bmatrix_type bmatr_
bit-transposed matrix
sparse vector de-serializer
str_sparse_vector_type::size_type size_type
bool empty() const BMNOEXCEPT
return true if insertion buffer is empty
plain_octet_matrix_type remap_matrix2_
octet remap table 2
allocator_type::allocator_pool_type allocator_pool_type
str_sparse_vector_type::bvector_type bvector_type
void clear_value_plains_from(unsigned plain_idx, size_type idx)
size_type size_internal() const
optmode
Optimization mode Every next level means additional checks (better compression vs time)
const value_type * operator*() const BMNOEXCEPT
Get current position (value)
back_insert_iterator & operator++(int)
noop
bm::heap_matrix< CharType, 1024, MAX_STR_SIZE, allocator_type > buffer_matrix_type
reference & operator=(const reference &ref)
size_type get(size_type idx, value_type *str, size_type buf_size) const BMNOEXCEPT
get specified element
bvector_type_ptr plain(unsigned i) BMNOEXCEPT
get access to bit-plain as is (can return NULL)
void push_back(const StrType &str)
push back a string
unsigned char get_octet(size_type pos, size_type octet_idx) const BMNOEXCEPT
size_t bit_blocks
Number of bit blocks.
void resize_internal(size_type sz)
Base class for bit-transposed sparse vector construction.
void invalidate() BMNOEXCEPT
Invalidate current iterator.
do not support NULL values
const unsigned char * get_remap_buffer() const
allocator_type::allocator_pool_type allocator_pool_type
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
str_sparse_vector_type::value_type value_type
void insert_value_no_null(size_type idx, const value_type *str)
insert value without checking boundaries or support of NULL
static void throw_bad_value(const char *err_msg)
throw domain error
void set_value(size_type idx, const value_type *str)
set value without checking boundaries
void get(size_type idx, StrType &str) const
get specified string element Template method expects an STL-compatible type basic_string<>
const_iterator begin() const BMNOEXCEPT
Provide const iterator access to container content
const_reference(const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &str_sv, size_type idx) BMNOEXCEPT
void insert_value(size_type idx, const value_type *str)
insert value without checking boundaries
input set is sorted (ascending order)
bvector_type::block_idx_type block_idx_type
const_iterator get_const_iterator(size_type idx) const BMNOEXCEPT
Get const_itertor re-positioned to specific element.
void calc_stat(struct str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics *st) const BMNOEXCEPT
Calculates memory statistics.
bm::heap_matrix< unsigned char, MAX_STR_SIZE, 256, typename bvector_type::allocator_type > plain_octet_matrix_type
Constant iterator designed to enumerate "ON" bits.
#define BM_ASSERT_THROW(x, xerrcode)
size_type effective_vector_max() const
get effective string length used in vector
bvector_type::block_idx_type block_idx_type
back_insert_iterator & operator=(const value_type *v)
push value to the vector
const_iterator & operator++() BMNOEXCEPT
Advance to the next available value.
bvector_type::enumerator bvector_enumerator_type
Algorithms for bvector<> (main include)
size_t gap_blocks
Number of GAP blocks.
bool operator==(const const_reference &ref) const BMNOEXCEPT
reference operator[](size_type idx)
Operator to get write access to an element
base_sparse_vector< CharType, BV, MAX_STR_SIZE > parent_type
back_insert_iterator & operator*()
noop
size_t gap_cap_overhead
gap memory overhead between length and capacity
void push_back(const value_type *str)
push back a string (zero terminated)
bool empty() const
return true if vector is empty
const typedef bvector_type * bvector_type_const_ptr
void set_null(size_type idx)
set NULL status for the specified element Vector is resized automatically
const typedef value_type & const_reference
BV::allocator_type allocator_type
void advance() BMNOEXCEPT
advance iterator forward by one
friend class str_sparse_vector
support "non-assigned" or "NULL" logic
size_type size() const
return size of the vector
Reference class to access elements via common [] operator.
sparse vector for strings with compression using bit transposition method
bool operator!=(const const_iterator &it) const BMNOEXCEPT
bool is_null() const BMNOEXCEPT
void xor_swap(W &x, W &y) BMNOEXCEPT
XOR swap two scalar variables.
bool valid() const BMNOEXCEPT
Checks if iterator is still valid. Analog of != 0 comparison for pointers.
void clear_range(size_type left, size_type right, bool set_null)
bvector_type_const_ptr get_row(size_type i) const BMNOEXCEPT
bvector_type * get_null_bvect()
unsigned remap_flags_
remapping status
back_insert_iterator & operator=(const StrType &v)
push value to the vector
void set_octet(size_type pos, size_type octet_idx, unsigned char octet)
str_sparse_vector< CharType, BV, MAX_STR_SIZE > & operator=(const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &str_sv)
back_insert_iterator get_back_inserter()
Provide back insert iterator Back insert iterator implements buffered insertion, which is faster,...
compress blocks when possible (GAP/prefix sum)
int compare(size_type idx, const value_type *str) const BMNOEXCEPT
Compare vector element with argument lexicographically.
const_iterator & operator++(int) BMNOEXCEPT
Advance to the next available value.
size_t remap_size() const
Reference class to access elements via common [] operator.
size_type size_
array size
bvector_type::allocator_type allocator_type
str_sparse_vector_type::size_type size_type
bvector_type * bvector_type_ptr
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.
void resize(size_type new_size)
void sync(bool force)
syncronize internal structures
static bool is_compressed() BMNOEXCEPT
trait if sparse vector is "compressed" (false)
const_iterator end() const BMNOEXCEPT
Provide const iterator access to the end
unsigned bit_list(T w, B *bits) BMNOEXCEPT
Unpacks word into list of ON bit indexes.
bvector_type::allocation_policy allocation_policy_type
bool is_null(size_type idx) const BMNOEXCEPT
test if specified element is NULL
bvector_type::size_type size_type
Const iterator to do quick traverse of the sparse vector.
void swap(str_sparse_vector &str_sv) BMNOEXCEPT
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)
void add(const value_type *v)
add value to the container
plain_octet_matrix_type remap_matrix1_
octet remap table 1
long long difference_type
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)
void go_to(size_type pos) BMNOEXCEPT
re-position to a specified position
bvector_type_ptr construct_row(size_type row)
size_t ptr_sub_blocks
Number of sub-blocks.
str_sparse_vector(str_sparse_vector< CharType, BV, MAX_STR_SIZE > &&str_sv) BMNOEXCEPT
Basic dense bit-matrix class.
const_reference operator[](size_type idx) const
Operator to get read access to an element
bool operator==(const reference &ref) const BMNOEXCEPT
bool operator>(const const_iterator &it) const BMNOEXCEPT
bool operator>=(const const_iterator &it) const BMNOEXCEPT
void copy_from(const base_sparse_vector< CharType, BV, MAX_SIZE > &bsv)
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
static bool find_rank(size_type rank, size_type &pos) BMNOEXCEPT
find position of compressed element by its rank
bool operator<(const const_iterator &it) const BMNOEXCEPT
bool valid() const BMNOEXCEPT
Returns true if iterator is at a valid position.
bool resolve_range(size_type from, size_type to, size_type *idx_from, size_type *idx_to) const
bool operator==(const const_iterator &it) const BMNOEXCEPT
const value_type * value() const BMNOEXCEPT
Get current position (value)
bool is_null() const BMNOEXCEPT
Get NULL status.
bool remap_tosv(value_type *sv_str, size_type buf_size, const value_type *str) const BMNOEXCEPT
reference & operator=(const value_type *str)
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.
void clear() BMNOEXCEPT
resize to zero, free memory
size_t bv_count
Number of bit-vectors.
void import_no_check(CharMatrix &cmatr, size_type idx_from, size_type imp_size, bool set_not_null=true)
size_type effective_max_str() const BMNOEXCEPT
get effective string length used in vector Calculate and returns efficiency, how close are we to the ...
basic bit-matrix class and utilities
str_sparse_vector_type::bvector_type bvector_type
const unsigned set_block_shift
Back insert iterator implements buffered insert, faster than generic access assignment.
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 pos() const BMNOEXCEPT
Current position (index) in the vector.
void swap(base_sparse_vector< CharType, BV, MAX_SIZE > &bsv) BMNOEXCEPT
void insert(size_type idx, const value_type *str)
insert the specified element
static void throw_range_error(const char *err_msg)
throw range error
std::output_iterator_tag iterator_category
size_t memory_used
memory usage for all blocks and service tables
str_sparse_vector_type * str_sparse_vector_type_ptr
reference(str_sparse_vector< CharType, BV, MAX_STR_SIZE > &str_sv, size_type idx) BMNOEXCEPT
null_support
NULL-able value support.
void resize(size_type sz)
resize vector
unsigned common_prefix_length(size_type idx1, size_type idx2) const BMNOEXCEPT
Find size of common prefix between two vector elements in octets.
Utilities for bit transposition (internal) (experimental!)
const_iterator() BMNOEXCEPT
void recalc_remap_matrix2()
size_type effective_size() const BMNOEXCEPT
size of sparse vector (may be different for RSC)
void set_value_no_null(size_type idx, const value_type *str)
set value without checking boundaries or support of NULL
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
str_sparse_vector_type::value_type value_type
void add_null()
add NULL (no-value) to the container
str_sparse_vector< CharType, BV, MAX_STR_SIZE > str_sparse_vector_type
std::input_iterator_tag iterator_category
void calc_octet_stat(plain_octet_matrix_type &octet_matrix) const BMNOEXCEPT
void import_back(CharMatrix &cmatr, size_type imp_size)
Bulk push-back import of strings from a C-style matrix of chars.
void set(size_type idx, const value_type *str)
set specified element with bounds checking and automatic resize
size_type add_value(const value_type *v)
add value to the buffer without changing the NULL vector
Structure with statistical information about memory allocation footprint, serialization projection,...
void assign(size_type idx, const StrType &str)
set specified element with bounds checking and automatic resize
bool is_null() const BMNOEXCEPT
void remap_from(const str_sparse_vector &str_sv)
Build remapping profile and load content from another sparse vector.
void add(const bv_statistics &st) BMNOEXCEPT
Sum data from another sttructure.
static size_type max_str()
get maximum string length capacity
back_insert_iterator & operator++()
noop
Statistical information about bitset's memory allocation details.
void erase(size_type idx)
erase the specified element
back_insert_iterator() BMNOEXCEPT
bm::basic_bmatrix< BV > bmatrix_type
bool operator<=(const const_iterator &it) const BMNOEXCEPT
str_sparse_vector_type * str_sparse_vector_type_ptr