1#ifndef BMSTRSPARSEVEC__H__INCLUDED__
2#define BMSTRSPARSEVEC__H__INCLUDED__
32#ifndef BM__H__INCLUDED__
35# error missing include (bm.h or bm64.h)
55template<
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;
1121template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1134template<
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_)
1145template<
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_);
1157template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1161 if (idx >= this->size())
1162 this->size_ = idx+1;
1163 set_value(idx, str);
1168template<
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);
1184template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1188 if (idx >= this->size_)
1190 this->erase_column(idx);
1196template<
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;
1210template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1214 set_value_no_null(idx, str);
1217 bv_null->set_bit_no_check(idx);
1222template<
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);
1252template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1256 insert_value_no_null(idx, str);
1257 this->insert_null(idx,
true);
1262template<
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);
1293template<
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);
1322template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1329 parent_type::optimize(temp_block, opt_mode, &stbv);
1337template<
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;
1369template<
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);
1398template<
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));
1424template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1437template<
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;
1456template<
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);
1482template<
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;
1515template<
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;
1541template<
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);
1569template<
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);
1598template<
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);
1639template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1644 recalc_remap_matrix2();
1650template<
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);
1677template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1691 this->copy_range_plains(sv, left, right, splice_null);
1692 this->resize(sv.
size());
1698template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1704 return it_type(
this);
1709template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1712 parent_type::clear();
1717template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1719 const char* err_msg)
1722 throw std::range_error(err_msg);
1730template<
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);
1749template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1756template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1759: sv_(it.sv_), pos_(it.pos_), pos_in_buf_(~
size_type(0))
1764template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1772template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1781template<
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_);
1804template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1810 pos_ = (!sv_ || pos >= sv_->size()) ?
bm::id_max : pos;
1816template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1824 if (pos_ >= sv_->size())
1831 if (pos_in_buf_ >= buffer_matrix_type::n_rows)
1841template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1843: sv_(0), bv_null_(0), pos_in_buf_(~
size_type(0)), prev_nb_(0)
1848template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1856 bv_null_ = sv_->get_null_bvect();
1860 bv_null_ = 0; prev_nb_ = 0;
1866template<
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_)
1876template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1884template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1889 return (pos_in_buf_ == ~
size_type(0) || !sv_);
1894template<
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_);
1913template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1926 bv_null_->set_bit_no_check(sz + buf_idx);
1932template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1935 this->add_value(
"");
1940template<
class CharType,
class BV,
unsigned MAX_STR_SIZE>
1945 this->add_value(
"");
1951template<
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)
Algorithms for bvector<> (main include)
basic bit-matrix class and utilities
Constants, tables and typedefs.
#define BM_ASSERT_THROW(x, xerrcode)
Utilities for bit transposition (internal) (experimental!)
Base class for bit-transposed sparse vector construction.
void swap(base_sparse_vector< CharType, BV, MAX_SIZE > &bsv) BMNOEXCEPT
void copy_from(const base_sparse_vector< CharType, BV, MAX_SIZE > &bsv)
void clear_range(size_type left, size_type right, bool set_null)
void resize(size_type new_size)
bvector_type * get_null_bvect()
const value_type & const_reference
bool is_null(size_type idx) const BMNOEXCEPT
test if specified element is NULL
bvector_type::block_idx_type block_idx_type
bvector_type_ptr plain(unsigned i) BMNOEXCEPT
void clear_value_plains_from(unsigned plain_idx, size_type idx)
Basic dense bit-matrix class.
bvector_type_ptr construct_row(size_type row)
void set_octet(size_type pos, size_type octet_idx, unsigned char octet)
unsigned char get_octet(size_type pos, size_type octet_idx) const BMNOEXCEPT
bvector_type_const_ptr get_row(size_type i) const BMNOEXCEPT
Constant iterator designed to enumerate "ON" bits.
bool valid() const BMNOEXCEPT
Checks if iterator is still valid.
optmode
Optimization mode Every next level means additional checks (better compression vs time)
@ opt_compress
compress blocks when possible (GAP/prefix sum)
sparse vector de-serializer
Back insert iterator implements buffered insert, faster than generic access assignment.
allocator_type::allocator_pool_type allocator_pool_type
back_insert_iterator & operator=(const StrType &v)
push value to the vector
bool empty() const BMNOEXCEPT
return true if insertion buffer is empty
str_sparse_vector< CharType, BV, MAX_STR_SIZE > str_sparse_vector_type
back_insert_iterator & operator*()
noop
back_insert_iterator & operator++(int)
noop
void add(const value_type *v)
add value to the container
void add_null()
add NULL (no-value) to the container
back_insert_iterator() BMNOEXCEPT
str_sparse_vector_type::value_type value_type
back_insert_iterator & operator=(const value_type *v)
push value to the vector
void flush()
flush the accumulated buffer
str_sparse_vector_type * str_sparse_vector_type_ptr
str_sparse_vector_type::bvector_type bvector_type
bvector_type::allocator_type allocator_type
void add_null(size_type count)
add a series of consequitve NULLs (no-value) to the container
bvector_type::block_idx_type block_idx_type
str_sparse_vector_type::size_type size_type
size_type add_value(const value_type *v)
add value to the buffer without changing the NULL vector
back_insert_iterator & operator++()
noop
std::output_iterator_tag iterator_category
Const iterator to do quick traverse of the sparse vector.
str_sparse_vector< CharType, BV, MAX_STR_SIZE > str_sparse_vector_type
const_iterator & operator++(int) BMNOEXCEPT
Advance to the next available value.
const_iterator & operator++() BMNOEXCEPT
Advance to the next available value.
void go_to(size_type pos) BMNOEXCEPT
re-position to a specified position
const value_type * value() const BMNOEXCEPT
Get current position (value)
str_sparse_vector_type::size_type size_type
std::input_iterator_tag iterator_category
size_type pos() const BMNOEXCEPT
Current position (index) in the vector.
bool operator>=(const const_iterator &it) const BMNOEXCEPT
allocator_type::allocator_pool_type allocator_pool_type
void invalidate() BMNOEXCEPT
Invalidate current iterator.
bool operator<=(const const_iterator &it) const BMNOEXCEPT
bvector_type::allocator_type allocator_type
bm::heap_matrix< CharType, 1024, MAX_STR_SIZE, allocator_type > buffer_matrix_type
bool operator!=(const const_iterator &it) const BMNOEXCEPT
str_sparse_vector_type::value_type value_type
bool operator==(const const_iterator &it) const BMNOEXCEPT
bool operator>(const const_iterator &it) const BMNOEXCEPT
void advance() BMNOEXCEPT
advance iterator forward by one
const_iterator() BMNOEXCEPT
friend class str_sparse_vector
bool is_null() const BMNOEXCEPT
Get NULL status.
bool operator<(const const_iterator &it) const BMNOEXCEPT
long long difference_type
const value_type * operator*() const BMNOEXCEPT
Get current position (value)
bool valid() const BMNOEXCEPT
Returns true if iterator is at a valid position.
str_sparse_vector_type * str_sparse_vector_type_ptr
str_sparse_vector_type::bvector_type bvector_type
Reference class to access elements via common [] operator.
bool operator==(const const_reference &ref) const BMNOEXCEPT
bool is_null() const BMNOEXCEPT
const_reference(const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &str_sv, size_type idx) BMNOEXCEPT
Reference class to access elements via common [] operator.
reference(str_sparse_vector< CharType, BV, MAX_STR_SIZE > &str_sv, size_type idx) BMNOEXCEPT
bool operator==(const reference &ref) const BMNOEXCEPT
reference & operator=(const value_type *str)
bool is_null() const BMNOEXCEPT
reference & operator=(const reference &ref)
sparse vector for strings with compression using bit transposition method
void insert(size_type idx, const StrType &str)
insert STL string
void erase(size_type idx)
erase the specified element
void insert_value(size_type idx, const value_type *str)
insert value without checking boundaries
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
static bool find_rank(size_type rank, size_type &pos) BMNOEXCEPT
find position of compressed element by its rank
size_type effective_vector_max() const
get effective string length used in vector
void recalc_remap_matrix2()
bool is_remap() const BMNOEXCEPT
Get remapping status (true|false)
bool remap_tosv(value_type *sv_str, size_type buf_size, const value_type *str) const BMNOEXCEPT
bm::heap_matrix< unsigned char, MAX_STR_SIZE, 256, typename bvector_type::allocator_type > plain_octet_matrix_type
void remap_from(const str_sparse_vector &str_sv)
Build remapping profile and load content from another sparse vector.
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)
size_t remap_size() const
static void throw_range_error(const char *err_msg)
throw range error
void resize_internal(size_type sz)
base_sparse_vector< CharType, BV, MAX_STR_SIZE > parent_type
size_type size_internal() const
str_sparse_vector< CharType, BV, MAX_STR_SIZE > & operator=(const str_sparse_vector< CharType, BV, MAX_STR_SIZE > &str_sv)
void clear() BMNOEXCEPT
resize to zero, free memory
bvector_type::allocation_policy allocation_policy_type
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
back_insert_iterator get_back_inserter()
Provide back insert iterator Back insert iterator implements buffered insertion, which is faster,...
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
unsigned common_prefix_length(size_type idx1, size_type idx2) const BMNOEXCEPT
Find size of common prefix between two vector elements in octets.
int compare(size_type idx, const value_type *str) const BMNOEXCEPT
Compare vector element with argument lexicographically.
bool empty() const
return true if vector is empty
const_reference operator[](size_type idx) const
Operator to get read access to an element
void swap(str_sparse_vector &str_sv) BMNOEXCEPT
void calc_stat(struct str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics *st) const BMNOEXCEPT
Calculates memory statistics.
const_iterator end() const BMNOEXCEPT
Provide const iterator access to the end
void push_back(const StrType &str)
push back a string
void calc_octet_stat(plain_octet_matrix_type &octet_matrix) const BMNOEXCEPT
const_iterator get_const_iterator(size_type idx) const BMNOEXCEPT
Get const_itertor re-positioned to specific element.
bvector_type::size_type size_type
bool resolve_range(size_type from, size_type to, size_type *idx_from, size_type *idx_to) const
unsigned remap_flags_
remapping status
str_sparse_vector(str_sparse_vector< CharType, BV, MAX_STR_SIZE > &&str_sv) BMNOEXCEPT
size_type size() const
return size of the vector
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 sync(bool force)
syncronize internal structures
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
allocator_type::allocator_pool_type allocator_pool_type
bm::basic_bmatrix< BV > bmatrix_type
void insert(size_type idx, const value_type *str)
insert the specified element
void import_back(CharMatrix &cmatr, size_type imp_size)
Bulk push-back import of strings from a C-style matrix of chars.
void push_back(const value_type *str)
push back a string (zero terminated)
BV::allocator_type allocator_type
static size_type max_str()
get maximum string length capacity
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 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
static bool is_compressed() BMNOEXCEPT
trait if sparse vector is "compressed" (false)
const unsigned char * get_remap_buffer() const
size_type effective_size() const BMNOEXCEPT
size of sparse vector (may be different for RSC)
size_type get(size_type idx, value_type *str, size_type buf_size) const BMNOEXCEPT
get specified element
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
void insert_value_no_null(size_type idx, const value_type *str)
insert value without checking boundaries or support of NULL
reference operator[](size_type idx)
Operator to get write access to an element
static void throw_bad_value(const char *err_msg)
throw domain error
void get(size_type idx, StrType &str) const
get specified string element Template method expects an STL-compatible type basic_string<>
bvector_type::enumerator bvector_enumerator_type
size_type effective_max_str() const BMNOEXCEPT
get effective string length used in vector Calculate and returns efficiency, how close are we to the ...
void resize(size_type sz)
resize vector
const bvector_type * bvector_type_const_ptr
unsigned char * init_remap_buffer()
plain_octet_matrix_type remap_matrix2_
octet remap table 2
void import_no_check(CharMatrix &cmatr, size_type idx_from, size_type imp_size, bool set_not_null=true)
const_iterator begin() const BMNOEXCEPT
Provide const iterator access to container content
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.
bvector_type * bvector_type_ptr
plain_octet_matrix_type remap_matrix1_
octet remap table 1
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 assign(size_type idx, const StrType &str)
set specified element with bounds checking and automatic resize
unsigned bit_list(T w, B *bits) BMNOEXCEPT
Unpacks word into list of ON bit indexes.
null_support
NULL-able value support.
@ BM_SORTED
input set is sorted (ascending order)
@ use_null
support "non-assigned" or "NULL" logic
@ no_null
do not support NULL values
void xor_swap(W &x, W &y) BMNOEXCEPT
XOR swap two scalar variables.
const unsigned set_block_shift
Structure with statistical information about memory allocation footprint, serialization projection,...
size_t gap_cap_overhead
gap memory overhead between length and capacity
size_t ptr_sub_blocks
Number of sub-blocks.
size_t gap_blocks
Number of GAP blocks.
size_t bit_blocks
Number of bit blocks.
size_t bv_count
Number of bit-vectors.
size_t max_serialize_mem
estimated maximum memory for serialization
size_t memory_used
memory usage for all blocks and service tables
void add(const bv_statistics &st) BMNOEXCEPT
Sum data from another sttructure.
Statistical information about bitset's memory allocation details.