BitMagic-C++
Public Types | Public Member Functions | Protected Types | Protected Member Functions
bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator Class Reference

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, MAX_STR_SIZE > str_sparse_vector_type
 
typedef str_sparse_vector_typestr_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
 
 back_insert_iterator (const back_insert_iterator &bi) BMNOEXCEPT
 
back_insert_iteratoroperator= (const back_insert_iterator &bi)
 
 ~back_insert_iterator ()
 
back_insert_iteratoroperator= (const value_type *v)
 push value to the vector More...
 
template<typename StrType >
back_insert_iteratoroperator= (const StrType &v)
 push value to the vector More...
 
back_insert_iteratoroperator* ()
 noop More...
 
back_insert_iteratoroperator++ ()
 noop More...
 
back_insert_iteratoroperator++ (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...
 

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...
 

Detailed Description

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

Back insert iterator implements buffered insert, faster than generic access assignment.

Limitations for buffered inserter:

  1. Do not use more than one inserter (into one vector) at the same time
  2. Use method flush() at the end to send the rest of accumulated buffer flush is happening automatically on destruction, but if flush produces an exception (for whatever reason) it will be an exception in destructor. As such, explicit flush() is safer way to finilize the sparse vector load.
Examples:
strsvsample03.cpp.

Definition at line 315 of file bmstrsparsevec.h.

Member Typedef Documentation

◆ allocator_pool_type

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

Definition at line 327 of file bmstrsparsevec.h.

◆ allocator_type

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

Definition at line 326 of file bmstrsparsevec.h.

◆ block_idx_type

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

Definition at line 381 of file bmstrsparsevec.h.

◆ bvector_type

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

Definition at line 325 of file bmstrsparsevec.h.

◆ difference_type

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::difference_type

Definition at line 329 of file bmstrsparsevec.h.

◆ iterator_category

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef std::output_iterator_tag bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::iterator_category

Definition at line 319 of file bmstrsparsevec.h.

◆ pointer

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::pointer

Definition at line 330 of file bmstrsparsevec.h.

◆ reference

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::reference

Definition at line 331 of file bmstrsparsevec.h.

◆ size_type

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

Definition at line 324 of file bmstrsparsevec.h.

◆ str_sparse_vector_type

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

Definition at line 321 of file bmstrsparsevec.h.

◆ str_sparse_vector_type_ptr

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
typedef str_sparse_vector_type* bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::str_sparse_vector_type_ptr

Definition at line 322 of file bmstrsparsevec.h.

◆ value_type

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

Definition at line 323 of file bmstrsparsevec.h.

Constructor & Destructor Documentation

◆ back_insert_iterator() [1/3]

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

◆ back_insert_iterator() [2/3]

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::back_insert_iterator ( str_sparse_vector_type sv)

◆ back_insert_iterator() [3/3]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::back_insert_iterator ( const back_insert_iterator bi)

◆ ~back_insert_iterator()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::~back_insert_iterator ( )

Definition at line 2118 of file bmstrsparsevec.h.

Member Function Documentation

◆ add()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::add ( const value_type v)

add value to the container

Definition at line 2156 of file bmstrsparsevec.h.

◆ add_null() [1/2]

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

add NULL (no-value) to the container

Examples:
strsvsample04.cpp, and strsvsample06.cpp.

Definition at line 2177 of file bmstrsparsevec.h.

Referenced by main().

◆ add_null() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::add_null ( size_type  count)

add a series of consequitve NULLs (no-value) to the container

◆ add_value()

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::add_value ( const value_type v)
protected

add value to the buffer without changing the NULL vector

Parameters
v- value to push back

Definition at line 2197 of file bmstrsparsevec.h.

References BM_ASSERT.

◆ empty()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::empty ( ) const
protected

return true if insertion buffer is empty

Definition at line 2127 of file bmstrsparsevec.h.

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

◆ flush()

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

flush the accumulated buffer

Examples:
strsvsample03.cpp, and xsample05.cpp.

Definition at line 2136 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::empty(), and bm::set_block_shift.

Referenced by main().

◆ operator*()

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

noop

Definition at line 360 of file bmstrsparsevec.h.

◆ operator++() [1/2]

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

noop

Definition at line 362 of file bmstrsparsevec.h.

◆ operator++() [2/2]

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
back_insert_iterator& bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::operator++ ( int  )
inline

◆ operator=() [1/3]

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

Definition at line 338 of file bmstrsparsevec.h.

References BM_ASSERT.

◆ operator=() [2/3]

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

push value to the vector

Definition at line 348 of file bmstrsparsevec.h.

References bm::bv_statistics::add().

◆ operator=() [3/3]

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

push value to the vector

Definition at line 354 of file bmstrsparsevec.h.

References bm::bv_statistics::add().


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