BitMagic-C++
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_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
 back_insert_iterator (const back_insert_iterator &bi) BMNOEXCEPT
back_insert_iterator & operator= (const back_insert_iterator &bi)
 ~back_insert_iterator ()
back_insert_iterator & operator= (const value_type *v)
 push value to the vector
template<typename StrType>
back_insert_iterator & operator= (const StrType &v)
 push value to the vector
back_insert_iterator & operator* ()
 noop
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
void add_null (size_type count)
 add a series of consequitve NULLs (no-value) to the container
bool empty () const BMNOEXCEPT
 return true if insertion buffer is empty
void flush ()
 flush the accumulated buffer

Protected Types

typedef bvector_type::block_idx_type block_idx_type

Protected Member Functions

size_type add_value (const value_type *v)
 add value to the buffer without changing the NULL vector

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.

Definition at line 264 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 276 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 275 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 330 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 274 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 278 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 268 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 279 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 280 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 273 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 270 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 271 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 272 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 1877 of file bmstrsparsevec.h.

References flush().

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 1914 of file bmstrsparsevec.h.

References add_null(), and add_value().

Referenced by operator=(), and operator=().

◆ 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

Definition at line 1933 of file bmstrsparsevec.h.

References add_value().

Referenced by add().

◆ 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>
str_sparse_vector< CharType, BV, MAX_STR_SIZE >::back_insert_iterator::size_type 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
Returns
index of added value in the internal buffer

Definition at line 1953 of file bmstrsparsevec.h.

References BM_ASSERT, and flush().

Referenced by add(), and add_null().

◆ 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

return true if insertion buffer is empty

Definition at line 1886 of file bmstrsparsevec.h.

References BMNOEXCEPT.

◆ 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

Definition at line 1895 of file bmstrsparsevec.h.

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

Referenced by add_value(), operator=(), and ~back_insert_iterator().

◆ 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 309 of file bmstrsparsevec.h.

References back_insert_iterator().

◆ 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 311 of file bmstrsparsevec.h.

References back_insert_iterator().

◆ 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

noop

Definition at line 313 of file bmstrsparsevec.h.

References back_insert_iterator().

◆ 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 287 of file bmstrsparsevec.h.

References back_insert_iterator(), BM_ASSERT, and flush().

◆ operator=() [2/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 303 of file bmstrsparsevec.h.

References add(), and back_insert_iterator().

◆ operator=() [3/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 297 of file bmstrsparsevec.h.

References add(), and back_insert_iterator().


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