BitMagic-C++: bm::rsc_sparse_vector< Val, SV >::back_insert_iterator Class Reference

BitMagic-C++

Public Types | Public Member Functions | Protected Types
bm::rsc_sparse_vector< Val, SV >::back_insert_iterator Class Reference
BitMagic Library » sparse_vector<>

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_type * | rsc_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_iterator () BMNOEXCEPT
| back_insert_iterator (rsc_sparse_vector_type *csv) BMNOEXCEPT
back_insert_iterator & | operator= (const back_insert_iterator &bi)
| ~back_insert_iterator ()
back_insert_iterator & | operator= (value_type 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 (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...

## 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 229 of file bmsparsevec_compr.h.

## Member Typedef Documentation

## ◆ bvector_type

template<class Val , class SV >

typedef rsc_sparse_vector_type::bvector_type bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::bvector_type

Definition at line 239 of file bmsparsevec_compr.h.

## ◆ difference_type

template<class Val , class SV >

typedef void bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::difference_type

Definition at line 241 of file bmsparsevec_compr.h.

## ◆ iterator_category

template<class Val , class SV >

typedef std::output_iterator_tag bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::iterator_category

Definition at line 233 of file bmsparsevec_compr.h.

## ◆ pointer

template<class Val , class SV >

typedef void bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::pointer

Definition at line 242 of file bmsparsevec_compr.h.

## ◆ reference

template<class Val , class SV >

typedef void bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::reference

Definition at line 243 of file bmsparsevec_compr.h.

## ◆ rsc_sparse_vector_type

template<class Val , class SV >

typedef rsc_sparse_vector<Val, SV> bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::rsc_sparse_vector_type

Definition at line 235 of file bmsparsevec_compr.h.

## ◆ rsc_sparse_vector_type_ptr

template<class Val , class SV >

typedef rsc_sparse_vector_type* bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::rsc_sparse_vector_type_ptr

Definition at line 236 of file bmsparsevec_compr.h.

## ◆ size_type

template<class Val , class SV >

typedef rsc_sparse_vector_type::size_type bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::size_type

Definition at line 238 of file bmsparsevec_compr.h.

## ◆ sparse_vector_bi

template<class Val , class SV >

typedef sparse_vector_type::back_insert_iterator bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::sparse_vector_bi
| protected

Definition at line 290 of file bmsparsevec_compr.h.

## ◆ sparse_vector_type

template<class Val , class SV >

typedef rsc_sparse_vector_type::sparse_vector_type bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::sparse_vector_type
| 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 size_type add_value(value_type v);

Definition at line 288 of file bmsparsevec_compr.h.

## ◆ value_type

template<class Val , class SV >

typedef rsc_sparse_vector_type::value_type bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::value_type

Definition at line 237 of file bmsparsevec_compr.h.

## Constructor & Destructor Documentation

## ◆ back_insert_iterator() [1/2]

template<class Val , class SV >

bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::back_insert_iterator

Definition at line 1327 of file bmsparsevec_compr.h.

Referenced by bm::rsc_sparse_vector< Val, SV >::get_back_inserter().

## ◆ back_insert_iterator() [2/2]

template<class Val , class SV >

bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::back_insert_iterator | ( | rsc_sparse_vector_type * | csv | ) |

Definition at line 1336 of file bmsparsevec_compr.h.

## ◆ ~back_insert_iterator()

template<class Val , class SV >

bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::~back_insert_iterator

Definition at line 1346 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 1354 of file bmsparsevec_compr.h.

References BM_ASSERT.

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

Examples
  rscsample02.cpp, and rscsample03.cpp.

Definition at line 1370 of file bmsparsevec_compr.h.

References BM_ASSERT.

Referenced by main().

## ◆ 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 1391 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 262 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 264 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 266 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= | ( | const back_insert_iterator & | bi | ) |
| inline

Definition at line 249 of file bmsparsevec_compr.h.

References BM_ASSERT, and bm::rsc_sparse_vector< Val, SV >::back_insert_iterator::flush().

## ◆ 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 259 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:

- bmsparsevec_compr.h