BitMagic-C++
Public Types | Public Member Functions | Protected Types | Friends
bm::str_sparse_vector< CharType, BV, MAX_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 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 long long difference_type
 
typedef CharType * pointer
 
typedef CharType *& reference
 

Public Member Functions

 const_iterator () BMNOEXCEPT
 
 const_iterator (const str_sparse_vector_type *sv) BMNOEXCEPT
 
 const_iterator (const str_sparse_vector_type *sv, size_type pos) BMNOEXCEPT
 
 const_iterator (const const_iterator &it) 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
 
bool operator>= (const const_iterator &it) const BMNOEXCEPT
 
const value_typeoperator* () const BMNOEXCEPT
 Get current position (value) More...
 
const_iteratoroperator++ () BMNOEXCEPT
 Advance to the next available value. More...
 
const_iteratoroperator++ (int) BMNOEXCEPT
 Advance to the next available value. More...
 
const value_typevalue () const BMNOEXCEPT
 Get current position (value) More...
 
bool is_null () const BMNOEXCEPT
 Get NULL status. More...
 
bool valid () const BMNOEXCEPT
 Returns true if iterator is at a valid position. More...
 
void invalidate () BMNOEXCEPT
 Invalidate current iterator. More...
 
size_type pos () const BMNOEXCEPT
 Current position (index) in the vector. More...
 
void go_to (size_type pos) BMNOEXCEPT
 re-position to a specified position More...
 
void advance () BMNOEXCEPT
 advance iterator forward by one More...
 

Protected Types

typedef bm::heap_matrix< CharType, 1024, MAX_STR_SIZE, allocator_typebuffer_matrix_type
 

Friends

class str_sparse_vector
 

Detailed Description

template<typename CharType, typename BV, unsigned MAX_STR_SIZE>
class bm::str_sparse_vector< CharType, BV, MAX_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 transposed elements, so memory footprint is not negligable.

Examples
strsvsample01.cpp, strsvsample02.cpp, and strsvsample04.cpp.

Definition at line 167 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 >::const_iterator::allocator_pool_type

Definition at line 180 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 >::const_iterator::allocator_type

Definition at line 179 of file bmstrsparsevec.h.

◆ buffer_matrix_type

template<typename CharType , typename BV , unsigned MAX_STR_SIZE>
typedef bm::heap_matrix<CharType, 1024, MAX_STR_SIZE, allocator_type> bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::buffer_matrix_type
protected

Definition at line 241 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 >::const_iterator::bvector_type

Definition at line 178 of file bmstrsparsevec.h.

◆ difference_type

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

Definition at line 182 of file bmstrsparsevec.h.

◆ iterator_category

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

Definition at line 172 of file bmstrsparsevec.h.

◆ pointer

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

Definition at line 183 of file bmstrsparsevec.h.

◆ reference

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

Definition at line 184 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 >::const_iterator::size_type

Definition at line 177 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 >::const_iterator::str_sparse_vector_type

Definition at line 174 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 >::const_iterator::str_sparse_vector_type_ptr

Definition at line 175 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 >::const_iterator::value_type

Definition at line 176 of file bmstrsparsevec.h.

Constructor & Destructor Documentation

◆ const_iterator() [1/4]

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

◆ const_iterator() [2/4]

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

Definition at line 1765 of file bmstrsparsevec.h.

◆ const_iterator() [3/4]

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

◆ const_iterator() [4/4]

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

Member Function Documentation

◆ advance()

template<class CharType , class BV , unsigned MAX_STR_SIZE>
void bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::advance

advance iterator forward by one

Definition at line 1818 of file bmstrsparsevec.h.

References bm::id_max.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::operator++().

◆ go_to()

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

re-position to a specified position

Definition at line 1806 of file bmstrsparsevec.h.

References bm::id_max.

◆ invalidate()

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

Invalidate current iterator.

Definition at line 226 of file bmstrsparsevec.h.

References bm::id_max.

◆ is_null()

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

Get NULL status.

Examples
strsvsample04.cpp.

Definition at line 220 of file bmstrsparsevec.h.

References bm::base_sparse_vector< Val, BV, MAX_SIZE >::is_null().

Referenced by main().

◆ operator!=()

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

◆ operator*()

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

Get current position (value)

Definition at line 205 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::value().

◆ operator++() [1/2]

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

Advance to the next available value.

Definition at line 208 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::advance().

◆ operator++() [2/2]

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

Advance to the next available value.

Definition at line 212 of file bmstrsparsevec.h.

References bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::advance().

◆ operator<()

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

Definition at line 195 of file bmstrsparsevec.h.

◆ operator<=()

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

Definition at line 197 of file bmstrsparsevec.h.

◆ operator==()

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

◆ operator>()

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

Definition at line 199 of file bmstrsparsevec.h.

◆ operator>=()

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

Definition at line 201 of file bmstrsparsevec.h.

◆ pos()

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

Current position (index) in the vector.

Definition at line 229 of file bmstrsparsevec.h.

◆ valid()

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

Returns true if iterator is at a valid position.

Definition at line 223 of file bmstrsparsevec.h.

References bm::id_max.

◆ value()

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

Get current position (value)

Definition at line 1783 of file bmstrsparsevec.h.

References BM_ASSERT, and bm::id_max.

Referenced by bm::str_sparse_vector< CharType, BV, MAX_STR_SIZE >::const_iterator::operator*().

Friends And Related Function Documentation

◆ str_sparse_vector

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

Definition at line 170 of file bmstrsparsevec.h.


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