BitMagic-C++
Public Types | Public Member Functions | Protected Types
bm::rsc_sparse_vector< Val, SV >::back_insert_iterator Class Reference

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

#include <bmsparsevec_compr.h>

Public Types

typedef std::output_iterator_tag iterator_category
 
typedef rsc_sparse_vector< Val, SV > rsc_sparse_vector_type
 
typedef rsc_sparse_vector_typersc_sparse_vector_type_ptr
 
typedef rsc_sparse_vector_type::value_type value_type
 
typedef rsc_sparse_vector_type::size_type size_type
 
typedef rsc_sparse_vector_type::bvector_type bvector_type
 
typedef void difference_type
 
typedef void pointer
 
typedef void reference
 

Public Member Functions

back_insert_iteratoroperator= (value_type 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 (value_type v)
 add value to the container More...
 
void add_null () BMNOEXCEPT
 add NULL (no-value) to the container More...
 
void add_null (size_type count) BMNOEXCEPT
 add a series of consequitve NULLs (no-value) to the container More...
 
void flush ()
 flush the accumulated buffer More...
 
Construction and assignment <br>
 back_insert_iterator () BMNOEXCEPT
  More...
 
 back_insert_iterator (rsc_sparse_vector_type *csv)
 
 back_insert_iterator (const back_insert_iterator &bi)
 
void operator= (const back_insert_iterator &bi)
  More...
 
 ~back_insert_iterator ()
 

Protected Types

typedef rsc_sparse_vector_type::sparse_vector_type sparse_vector_type
 add value to the buffer without changing the NULL vector More...
 
typedef sparse_vector_type::back_insert_iterator sparse_vector_bi
 

Detailed Description

template<class Val, class SV>
class bm::rsc_sparse_vector< Val, SV >::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 per vector at a 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 231 of file bmsparsevec_compr.h.

Member Typedef Documentation

◆ sparse_vector_type

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 size_type add_value(value_type v);

Definition at line 295 of file bmsparsevec_compr.h.

Member Function Documentation

◆ add()

template<class Val , class SV >
void bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::add ( value_type  v)

add value to the container

Definition at line 2009 of file bmsparsevec_compr.h.

References BM_ASSERT, and bm::id_max.

Referenced by bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::operator=().

◆ add_null() [1/2]

template<class Val , class SV >
void bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::add_null

add NULL (no-value) to the container

Definition at line 2027 of file bmsparsevec_compr.h.

References BM_ASSERT, and bm::id_max.

◆ add_null() [2/2]

template<class Val , class SV >
void bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::add_null ( size_type  count)

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

◆ flush()

template<class Val , class SV >
void bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::flush

flush the accumulated buffer

Definition at line 2051 of file bmsparsevec_compr.h.

Referenced by bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::operator=().

◆ operator*()

template<class Val , class SV >
back_insert_iterator& bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::operator* ( )
inline

noop

Definition at line 269 of file bmsparsevec_compr.h.

◆ operator++() [1/2]

template<class Val , class SV >
back_insert_iterator& bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::operator++ ( )
inline

noop

Definition at line 271 of file bmsparsevec_compr.h.

◆ operator++() [2/2]

template<class Val , class SV >
back_insert_iterator& bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::operator++ ( int  )
inline

noop

Definition at line 273 of file bmsparsevec_compr.h.

◆ operator=() [1/2]

template<class Val , class SV >
void bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::operator= ( const back_insert_iterator bi)
inline

◆ operator=() [2/2]

template<class Val , class SV >
back_insert_iterator& bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::operator= ( value_type  v)
inline

push value to the vector

Definition at line 266 of file bmsparsevec_compr.h.

References bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::add().


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