BitMagic-C++
bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator Class Reference

Const iterator to do quick traverse of the sparse vector. More...

#include <bmstrsparsevec.h>

Public Types

typedef std::input_iterator_tag iterator_category
typedef std::basic_string_view< CharType > string_view_type
typedef str_sparse_vector< CharType, BV, 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 long long difference_type
typedef CharType * pointer
typedef CharType *& reference

Public Member Functions

 const_iterator () BMNOEXCEPT
 Construct iterator (not attached to any particular vector).
 const_iterator (const str_sparse_vector_type *sv) BMNOEXCEPT
 Construct iterator (attached to sparse vector).
 const_iterator (const str_sparse_vector_type *sv, size_type pos) BMNOEXCEPT
 Construct iterator (attached to sparse vector) and positioned.
 const_iterator (const const_iterator &it) BMNOEXCEPT
void set_substr (unsigned from, unsigned len=0) BMNOEXCEPT
 setup iterator to retrieve a sub-string of a string
bool operator== (const const_iterator &it) const BMNOEXCEPT
bool operator!= (const const_iterator &it) const BMNOEXCEPT
bool operator< (const const_iterator &it) const BMNOEXCEPT
bool operator<= (const const_iterator &it) const BMNOEXCEPT
bool operator> (const const_iterator &it) const BMNOEXCEPT
bool operator>= (const const_iterator &it) const BMNOEXCEPT
const value_typeoperator* () const
 Get current position (value).
const_iteratoroperator++ () BMNOEXCEPT
 Advance to the next available value.
const_iteratoroperator++ (int) BMNOEXCEPT
 Advance to the next available value.
const value_typevalue () const
 Get zero terminated string value at the current position.
string_view_type get_string_view () const
 Get current string as string_view.
bool is_null () const BMNOEXCEPT
 Get NULL status.
bool valid () const BMNOEXCEPT
 Returns true if iterator is at a valid position.
void invalidate () BMNOEXCEPT
 Invalidate current iterator.
size_type pos () const BMNOEXCEPT
 Current position (index) in the vector.
void go_to (size_type pos) BMNOEXCEPT
 re-position to a specified position
void advance () BMNOEXCEPT
 advance iterator forward by one

Protected Types

enum  buf_size_e { n_rows = 1024 }
typedef dynamic_heap_matrix< CharType, allocator_typebuffer_matrix_type

Friends

class str_sparse_vector

Detailed Description

template<typename CharType, typename BV, unsigned STR_SIZE>
class bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator

Const iterator to do quick traverse of the sparse vector.

Implementation uses buffer for decoding so, competing changes to the original vector may not match the iterator returned values.

This iterator keeps an operational buffer of decoded elements, so memory footprint is NOT negligable.

Definition at line 213 of file bmstrsparsevec.h.

Member Typedef Documentation

◆ allocator_pool_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef allocator_type::allocator_pool_type bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::allocator_pool_type

Definition at line 227 of file bmstrsparsevec.h.

◆ allocator_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef bvector_type::allocator_type bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::allocator_type

Definition at line 226 of file bmstrsparsevec.h.

◆ buffer_matrix_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef dynamic_heap_matrix<CharType, allocator_type> bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::buffer_matrix_type
protected

Definition at line 314 of file bmstrsparsevec.h.

◆ bvector_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef str_sparse_vector_type::bvector_type bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::bvector_type

Definition at line 225 of file bmstrsparsevec.h.

◆ difference_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef long long bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::difference_type

Definition at line 229 of file bmstrsparsevec.h.

◆ iterator_category

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef std::input_iterator_tag bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::iterator_category

Definition at line 218 of file bmstrsparsevec.h.

◆ pointer

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef CharType* bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::pointer

Definition at line 230 of file bmstrsparsevec.h.

◆ reference

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef CharType*& bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::reference

Definition at line 231 of file bmstrsparsevec.h.

◆ size_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef str_sparse_vector_type::size_type bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::size_type

Definition at line 224 of file bmstrsparsevec.h.

◆ str_sparse_vector_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef str_sparse_vector<CharType, BV, STR_SIZE> bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::str_sparse_vector_type

Definition at line 221 of file bmstrsparsevec.h.

◆ str_sparse_vector_type_ptr

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef str_sparse_vector_type* bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::str_sparse_vector_type_ptr

Definition at line 222 of file bmstrsparsevec.h.

◆ string_view_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef std::basic_string_view<CharType> bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::string_view_type

Definition at line 219 of file bmstrsparsevec.h.

◆ value_type

template<typename CharType, typename BV, unsigned STR_SIZE>
typedef str_sparse_vector_type::value_type bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::value_type

Definition at line 223 of file bmstrsparsevec.h.

Member Enumeration Documentation

◆ buf_size_e

template<typename CharType, typename BV, unsigned STR_SIZE>
enum bm::str_sparse_vector::const_iterator::buf_size_e
protected
Enumerator
n_rows 

Definition at line 310 of file bmstrsparsevec.h.

Constructor & Destructor Documentation

◆ const_iterator() [1/4]

template<class CharType, class BV, unsigned STR_SIZE>
bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::const_iterator ( )

Construct iterator (not attached to any particular vector).

Definition at line 2646 of file bmstrsparsevec.h.

References BMNOEXCEPT, and bm::id_max.

Referenced by const_iterator(), const_iterator(), operator!=(), operator++(), operator++(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

◆ const_iterator() [2/4]

template<class CharType, class BV, unsigned STR_SIZE>
bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::const_iterator ( const str_sparse_vector_type * sv)

Construct iterator (attached to sparse vector).

Parameters
sv- pointer to sparse vector

Definition at line 2666 of file bmstrsparsevec.h.

References BMNOEXCEPT, bm::id_max, n_rows, and str_sparse_vector.

◆ const_iterator() [3/4]

template<typename CharType, typename BV, unsigned STR_SIZE>
bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::const_iterator ( const str_sparse_vector_type * sv,
size_type pos )

Construct iterator (attached to sparse vector) and positioned.

Parameters
sv- reference to sparse vector
pos- position in the vector to start

References BMNOEXCEPT, const_iterator(), and pos().

◆ const_iterator() [4/4]

template<typename CharType, typename BV, unsigned STR_SIZE>
bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::const_iterator ( const const_iterator & it)

References BMNOEXCEPT, and const_iterator().

Member Function Documentation

◆ advance()

template<class CharType, class BV, unsigned STR_SIZE>
void bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::advance ( )

advance iterator forward by one

Definition at line 2782 of file bmstrsparsevec.h.

References BMNOEXCEPT, bm::id_max, invalidate(), and n_rows.

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

◆ get_string_view()

template<class CharType, class BV, unsigned STR_SIZE>
str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::string_view_type bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::get_string_view ( ) const

Get current string as string_view.

Definition at line 2742 of file bmstrsparsevec.h.

References BM_ASSERT, bm::id_max, bm::base_sparse_vector< CharType, BV, STR_SIZE >::is_null(), n_rows, and valid().

◆ go_to()

template<typename CharType, typename BV, unsigned STR_SIZE>
void bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::go_to ( size_type pos)

re-position to a specified position

Definition at line 2770 of file bmstrsparsevec.h.

References BMNOEXCEPT, bm::id_max, and pos().

◆ invalidate()

template<typename CharType, typename BV, unsigned STR_SIZE>
void bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::invalidate ( )
inline

Invalidate current iterator.

Definition at line 298 of file bmstrsparsevec.h.

References BMNOEXCEPT, and bm::id_max.

Referenced by advance().

◆ is_null()

template<typename CharType, typename BV, unsigned STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::is_null ( ) const
inline

Get NULL status.

Definition at line 292 of file bmstrsparsevec.h.

References BMNOEXCEPT.

◆ operator!=()

template<typename CharType, typename BV, unsigned STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::operator!= ( const const_iterator & it) const
inline

Definition at line 261 of file bmstrsparsevec.h.

References BMNOEXCEPT, const_iterator(), and operator==().

◆ operator*()

template<typename CharType, typename BV, unsigned STR_SIZE>
const value_type * bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::operator* ( ) const
inline

Get current position (value).

Definition at line 273 of file bmstrsparsevec.h.

References value().

◆ operator++() [1/2]

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

Advance to the next available value.

Definition at line 277 of file bmstrsparsevec.h.

References advance(), BMNOEXCEPT, and const_iterator().

◆ operator++() [2/2]

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

Advance to the next available value.

Definition at line 281 of file bmstrsparsevec.h.

References advance(), BMNOEXCEPT, and const_iterator().

◆ operator<()

template<typename CharType, typename BV, unsigned STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::operator< ( const const_iterator & it) const
inline

Definition at line 263 of file bmstrsparsevec.h.

References BMNOEXCEPT, and const_iterator().

◆ operator<=()

template<typename CharType, typename BV, unsigned STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::operator<= ( const const_iterator & it) const
inline

Definition at line 265 of file bmstrsparsevec.h.

References BMNOEXCEPT, and const_iterator().

◆ operator==()

template<typename CharType, typename BV, unsigned STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::operator== ( const const_iterator & it) const
inline

Definition at line 259 of file bmstrsparsevec.h.

References BMNOEXCEPT, and const_iterator().

Referenced by operator!=().

◆ operator>()

template<typename CharType, typename BV, unsigned STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::operator> ( const const_iterator & it) const
inline

Definition at line 267 of file bmstrsparsevec.h.

References BMNOEXCEPT, and const_iterator().

◆ operator>=()

template<typename CharType, typename BV, unsigned STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::operator>= ( const const_iterator & it) const
inline

Definition at line 269 of file bmstrsparsevec.h.

References BMNOEXCEPT, and const_iterator().

◆ pos()

template<typename CharType, typename BV, unsigned STR_SIZE>
size_type bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::pos ( ) const
inline

Current position (index) in the vector.

Definition at line 301 of file bmstrsparsevec.h.

References BMNOEXCEPT.

Referenced by const_iterator(), and go_to().

◆ set_substr()

template<class CharType, class BV, unsigned STR_SIZE>
void bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::set_substr ( unsigned from,
unsigned len = 0 )

setup iterator to retrieve a sub-string of a string

Parameters
from- Position of the first character to be copied
len- length of a substring (defult: 0 read to the available end)

Definition at line 2691 of file bmstrsparsevec.h.

References BMNOEXCEPT, bm::str_sparse_vector< CharType, BV, STR_SIZE >::max_str(), and n_rows.

◆ valid()

template<typename CharType, typename BV, unsigned STR_SIZE>
bool bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::valid ( ) const
inline

Returns true if iterator is at a valid position.

Definition at line 295 of file bmstrsparsevec.h.

References BMNOEXCEPT, and bm::id_max.

Referenced by bm::str_sparse_vector< CharType, BV, STR_SIZE >::calc_octet_stat(), get_string_view(), and value().

◆ value()

template<class CharType, class BV, unsigned STR_SIZE>
const str_sparse_vector< CharType, BV, STR_SIZE >::value_type * bm::str_sparse_vector< CharType, BV, STR_SIZE >::const_iterator::value ( ) const

Get zero terminated string value at the current position.

Definition at line 2715 of file bmstrsparsevec.h.

References BM_ASSERT, bm::id_max, bm::base_sparse_vector< CharType, BV, STR_SIZE >::is_null(), n_rows, and valid().

Referenced by operator*().

◆ str_sparse_vector

template<typename CharType, typename BV, unsigned STR_SIZE>
friend class str_sparse_vector
friend

Definition at line 216 of file bmstrsparsevec.h.

References str_sparse_vector.

Referenced by const_iterator(), and str_sparse_vector.


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