Flow123d  release_3.0.0-1070-g00ac913
Public Member Functions | Protected Attributes | List of all members
flow::FullIterator< Cont > Class Template Reference

Iterator that keeps also reference to its container. Safer and provides indexes. More...

#include <sys_vector.hh>

Collaboration diagram for flow::FullIterator< Cont >:
Collaboration graph
[legend]

Public Member Functions

 FullIterator (Cont &cont_par)
 Constructor to make uninitialized FullIterator for a container. More...
 
 FullIterator (const Cont &cont_par, const typename Cont::iterator it)
 
 FullIterator (Cont &cont_par, const typename Cont::Iter it)
 Constructor to make FullIterator from container and Iter i.e. T*. More...
 
bool is_valid ()
 Check validity of FullIterator. More...
 
int index () const
 
Cont & container ()
 Get reference to the container of the FullIterator. More...
 
FullIteratoroperator= (const FullIterator &orig)
 Assign operator. In debugging version check that containers of both FullIterator match. More...
 
 operator typename Cont::Iter () const
 Type cast to Iter i.e. standard pointer. More...
 
Cont::ElementType & operator* () const
 
Cont::ElementType * operator-> () const
 -> dereference operator More...
 
FullIteratoroperator+= (const int shift)
 
FullIteratoroperator-= (const int shift)
 
bool operator== (const FullIterator &it) const
 Comparison of two FullIterator. More...
 
bool operator!= (const FullIterator &it) const
 
FullIteratoroperator++ ()
 Prefix. Advance operator. More...
 
FullIterator operator++ (int)
 Postfix. Should not be used since involves iterator copy. More...
 
FullIteratoroperator-- ()
 Prefix. Advance to previous operator. More...
 
FullIterator operator-- (int)
 Postfix. Should not be used since involves iterator copy. More...
 

Protected Attributes

const Cont & cont
 We have here reference to the container of the iterator. So, an instance of this class can not change the container. More...
 
Cont::iterator iter
 

Detailed Description

template<class Cont>
class flow::FullIterator< Cont >

Iterator that keeps also reference to its container. Safer and provides indexes.

Full iterator into a Vector<T> container. It makes an envelop around std:vector<T>::iterator, but stores also reference of the container it points into. Consequently FullIter can return index. The container has to be provided when FullIterator is created and this container can not be changed during the life of the variable. This is intentional since more safe.

This class is larger then normal pointer i.e. Iter type and therefore is questionable to use it in the large arrays. To this and you can use Iter and later convert it to FullIter providing the container It points into.

Definition at line 48 of file sys_vector.hh.

Constructor & Destructor Documentation

template<class Cont>
flow::FullIterator< Cont >::FullIterator ( Cont &  cont_par)
inline

Constructor to make uninitialized FullIterator for a container.

Definition at line 52 of file sys_vector.hh.

template<class Cont>
flow::FullIterator< Cont >::FullIterator ( const Cont &  cont_par,
const typename Cont::iterator  it 
)
inline

Constructor to make FullIterator from container and its std::vector iterator. Mainly for internal use.

Definition at line 58 of file sys_vector.hh.

template<class Cont>
flow::FullIterator< Cont >::FullIterator ( Cont &  cont_par,
const typename Cont::Iter  it 
)
inline

Constructor to make FullIterator from container and Iter i.e. T*.

Definition at line 63 of file sys_vector.hh.

Member Function Documentation

template<class Cont>
Cont& flow::FullIterator< Cont >::container ( )
inline

Get reference to the container of the FullIterator.

Definition at line 84 of file sys_vector.hh.

template<class Cont>
int flow::FullIterator< Cont >::index ( ) const
inline

Get index of FullIterator in its container. Return invalid index -1 for undefined iterator.

Definition at line 78 of file sys_vector.hh.

Here is the caller graph for this function:

template<class Cont>
bool flow::FullIterator< Cont >::is_valid ( )
inline

Check validity of FullIterator.

Definition at line 71 of file sys_vector.hh.

template<class Cont>
flow::FullIterator< Cont >::operator typename Cont::Iter ( ) const
inline

Type cast to Iter i.e. standard pointer.

Definition at line 97 of file sys_vector.hh.

template<class Cont>
bool flow::FullIterator< Cont >::operator!= ( const FullIterator< Cont > &  it) const
inline

Definition at line 118 of file sys_vector.hh.

template<class Cont>
Cont::ElementType& flow::FullIterator< Cont >::operator* ( ) const
inline
  • dereference operator

Definition at line 101 of file sys_vector.hh.

template<class Cont>
FullIterator& flow::FullIterator< Cont >::operator++ ( )
inline

Prefix. Advance operator.

Definition at line 122 of file sys_vector.hh.

Here is the caller graph for this function:

template<class Cont>
FullIterator flow::FullIterator< Cont >::operator++ ( int  )
inline

Postfix. Should not be used since involves iterator copy.

template<class Cont>
FullIterator& flow::FullIterator< Cont >::operator+= ( const int  shift)
inline

Definition at line 108 of file sys_vector.hh.

template<class Cont>
FullIterator& flow::FullIterator< Cont >::operator-- ( )
inline

Prefix. Advance to previous operator.

Definition at line 132 of file sys_vector.hh.

Here is the caller graph for this function:

template<class Cont>
FullIterator flow::FullIterator< Cont >::operator-- ( int  )
inline

Postfix. Should not be used since involves iterator copy.

template<class Cont>
FullIterator& flow::FullIterator< Cont >::operator-= ( const int  shift)
inline

Definition at line 111 of file sys_vector.hh.

template<class Cont>
Cont::ElementType* flow::FullIterator< Cont >::operator-> ( ) const
inline

-> dereference operator

Definition at line 105 of file sys_vector.hh.

template<class Cont>
FullIterator& flow::FullIterator< Cont >::operator= ( const FullIterator< Cont > &  orig)
inline

Assign operator. In debugging version check that containers of both FullIterator match.

Definition at line 88 of file sys_vector.hh.

template<class Cont>
bool flow::FullIterator< Cont >::operator== ( const FullIterator< Cont > &  it) const
inline

Comparison of two FullIterator.

Definition at line 115 of file sys_vector.hh.

Member Data Documentation

template<class Cont>
const Cont& flow::FullIterator< Cont >::cont
protected

We have here reference to the container of the iterator. So, an instance of this class can not change the container.

Definition at line 144 of file sys_vector.hh.

template<class Cont>
Cont :: iterator flow::FullIterator< Cont >::iter
protected

Definition at line 146 of file sys_vector.hh.


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