BitMagic-C++
|
Back insert iterator implements buffered insert, faster than generic access assignment. More...
#include <bmstrsparsevec.h>
Public Types | |
typedef std::output_iterator_tag | iterator_category |
typedef str_sparse_vector< CharType, BV, STR_SIZE > | str_sparse_vector_type |
typedef str_sparse_vector_type * | str_sparse_vector_type_ptr |
typedef str_sparse_vector_type::value_type | value_type |
typedef str_sparse_vector_type::size_type | size_type |
typedef str_sparse_vector_type::bvector_type | bvector_type |
typedef bvector_type::allocator_type | allocator_type |
typedef allocator_type::allocator_pool_type | allocator_pool_type |
typedef void | difference_type |
typedef void | pointer |
typedef void | reference |
Public Member Functions | |
back_insert_iterator () BMNOEXCEPT | |
back_insert_iterator (str_sparse_vector_type *sv) BMNOEXCEPT | |
More... | |
back_insert_iterator (const back_insert_iterator &bi) BMNOEXCEPT | |
back_insert_iterator & | operator= (const back_insert_iterator &bi) |
More... | |
~back_insert_iterator () | |
void | set_optimize (typename bvector_type::optmode opt_mode) BMNOEXCEPT |
Set optimization on load option (deafult: false) More... | |
void | set_remap (bool flag) BMNOEXCEPT |
Method to configure back inserter to collect statistics on optimal character codes. More... | |
unsigned | get_remap () const BMNOEXCEPT |
Get curent remap state flags. More... | |
back_insert_iterator & | operator= (const value_type *v) |
push value to the vector More... | |
template<typename StrType > | |
back_insert_iterator & | operator= (const StrType &v) |
push value to the vector More... | |
back_insert_iterator & | operator* () |
noop More... | |
back_insert_iterator & | operator++ () |
noop More... | |
back_insert_iterator & | operator++ (int) |
noop More... | |
void | add (const value_type *v) |
add value to the container More... | |
void | add_null () |
add NULL (no-value) to the container More... | |
void | add_null (size_type count) |
add a series of consequitve NULLs (no-value) to the container More... | |
void | flush () |
flush the accumulated buffer. More... | |
const octet_freq_matrix_type & | get_octet_matrix () const noexcept |
Get octet frequence matrix. More... | |
Protected Types | |
typedef bvector_type::block_idx_type | block_idx_type |
Protected Member Functions | |
bool | empty () const BMNOEXCEPT |
return true if insertion buffer is empty More... | |
void | add_value (const value_type *v) |
add value to the buffer without changing the NULL vector More... | |
void | add_remap_stat (const value_type *v) |
account new value as remap statistics More... | |
void | flush_impl () |
More... | |
Protected Attributes | |
str_sparse_vector_type * | sv_ |
More... | |
bvector_type * | bv_null_ |
!< pointer on the parent vector More... | |
buffer_matrix_type | buf_matrix_ |
!< not NULL vector pointer More... | |
size_type | pos_in_buf_ |
!< value buffer More... | |
block_idx_type | prev_nb_ = 0 |
!< buffer position More... | |
bvector_type::optmode | opt_mode_ = bvector_type::opt_compress |
!< previous block added More... | |
unsigned | remap_flags_ = 0 |
target remapping More... | |
octet_freq_matrix_type | omatrix_ |
octet frequency matrix More... | |
Friends | |
class | str_sparse_vector |
Back insert iterator implements buffered insert, faster than generic access assignment.
Limitations for buffered inserter:
Definition at line 339 of file bmstrsparsevec.h.
void bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::add | ( | const value_type * | v | ) |
add value to the container
Definition at line 2699 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::operator=().
void bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::add_null |
add NULL (no-value) to the container
Definition at line 2718 of file bmstrsparsevec.h.
Referenced by main().
void bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::add_null | ( | size_type | count | ) |
add a series of consequitve NULLs (no-value) to the container
|
protected |
account new value as remap statistics
Definition at line 2738 of file bmstrsparsevec.h.
References BM_ASSERT, and bm::str_sparse_vector< CharType, BV, STR_SIZE >::remap_flags_.
|
protected |
add value to the buffer without changing the NULL vector
v | - value to push back |
Definition at line 2778 of file bmstrsparsevec.h.
References BM_ASSERT, bm::str_sparse_vector< CharType, BV, STR_SIZE >::remap_flags_, and bm::str_sparse_vector< CharType, BV, STR_SIZE >::resize().
|
protected |
return true if insertion buffer is empty
Definition at line 2656 of file bmstrsparsevec.h.
void bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::flush |
flush the accumulated buffer.
It is important to call flush at the end, before destruction of the inserter. Flush may throw exceptions, which will be possible to intercept. Otherwise inserter is flushed in the destructor.
Definition at line 2665 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::remap_flags_.
Referenced by main().
|
protected |
Definition at line 2679 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::empty(), and bm::set_block_shift.
Referenced by bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::operator=().
|
inlinenoexcept |
Get octet frequence matrix.
Definition at line 433 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::omatrix_.
|
inline |
Get curent remap state flags.
Definition at line 392 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::remap_flags_.
|
inline |
noop
Definition at line 407 of file bmstrsparsevec.h.
|
inline |
noop
Definition at line 409 of file bmstrsparsevec.h.
|
inline |
noop
Definition at line 411 of file bmstrsparsevec.h.
|
inline |
Definition at line 362 of file bmstrsparsevec.h.
References BM_ASSERT, bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::buf_matrix_, bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::flush_impl(), and bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::sv_.
|
inline |
push value to the vector
Definition at line 401 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::add().
|
inline |
push value to the vector
Definition at line 395 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::add().
|
inline |
Set optimization on load option (deafult: false)
Definition at line 376 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::opt_mode_.
|
inline |
Method to configure back inserter to collect statistics on optimal character codes.
This methos makes back inserter slower, but can be used to accelerate later remap() of the sparse vector. Use flush at the end to apply the remapping. By default inserter does not collect additional statistics.
Important! You should NOT use intermediate flush if you set remapping!
Definition at line 389 of file bmstrsparsevec.h.
References bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::remap_flags_.
Referenced by main().
|
protected |
!< not NULL vector pointer
Definition at line 466 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::operator=().
|
protected |
!< pointer on the parent vector
Definition at line 465 of file bmstrsparsevec.h.
|
protected |
octet frequency matrix
Definition at line 473 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::get_octet_matrix(), and bm::str_sparse_vector< CharType, BV, STR_SIZE >::remap().
|
protected |
!< previous block added
Definition at line 470 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::set_optimize().
|
protected |
!< value buffer
Definition at line 467 of file bmstrsparsevec.h.
|
protected |
!< buffer position
Definition at line 468 of file bmstrsparsevec.h.
|
protected |
target remapping
Definition at line 472 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::get_remap(), bm::str_sparse_vector< CharType, BV, STR_SIZE >::remap(), and bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::set_remap().
|
protected |
Definition at line 464 of file bmstrsparsevec.h.
Referenced by bm::str_sparse_vector< CharType, BV, STR_SIZE >::back_insert_iterator::operator=().