PSCF v1.1
Public Member Functions | List of all members
Util::ConstPArrayIterator< Data > Class Template Reference

Forward iterator for a PArray. More...

#include <ConstPArrayIterator.h>

Public Member Functions

 ConstPArrayIterator ()
 Default constructor. More...
 
void setCurrent (Data **ptr)
 Set the current pointer value. More...
 
void setEnd (Data **ptr)
 Set the value of the end pointer. More...
 
void setNull ()
 Nullify the iterator. More...
 
bool isEnd () const
 Is the current pointer at the end of the array. More...
 
bool notEnd () const
 Is the current pointer not at the end of the array? More...
 
const Data * get () const
 Return a pointer to const current data. More...
 

Operators

const Data & operator* () const
 Return a const refererence to the current Data. More...
 
const Data * operator-> () const
 Provide a pointer to the current Data object. More...
 
ConstPArrayIterator< Data > & operator++ ()
 Increment the current pointer. More...
 

Detailed Description

template<typename Data>
class Util::ConstPArrayIterator< Data >

Forward iterator for a PArray.

A ConstPArrayIterator is an abstraction of a pointer, similar to an STL forward iterator. The * operator returns a reference to an associated Data object, the -> operator returns a pointer to that object. The ++ operator increments the current pointer by one array element.

Unlike an STL forward iterator, a ConstPArrayIterator has the address of the end of the array. The isEnd() method can be used to test for termination of a for or while loop. When isEnd() is true, the iterator has no current value, and cannot be incremented further. The isEnd() method returns true either if the iterator: i) has already been incremented one past the end of an associated PArray, or ii) is in a null state that is produced by the constructor and the clear() method.

Definition at line 34 of file ConstPArrayIterator.h.

Constructor & Destructor Documentation

◆ ConstPArrayIterator()

template<typename Data >
Util::ConstPArrayIterator< Data >::ConstPArrayIterator ( )
inline

Default constructor.


Constructs a null iterator.

Definition at line 44 of file ConstPArrayIterator.h.

Member Function Documentation

◆ setCurrent()

template<typename Data >
void Util::ConstPArrayIterator< Data >::setCurrent ( Data **  ptr)
inline

Set the current pointer value.

Parameters
ptrPointer to current element of array of Data* pointers

Definition at line 55 of file ConstPArrayIterator.h.

Referenced by Util::FPArray< Data, Capacity >::begin(), Util::PArray< Data >::begin(), and Util::SSet< Data, Capacity >::begin().

◆ setEnd()

template<typename Data >
void Util::ConstPArrayIterator< Data >::setEnd ( Data **  ptr)
inline

Set the value of the end pointer.

Parameters
ptrPointer to one element past end of array of Data* pointers

Definition at line 66 of file ConstPArrayIterator.h.

Referenced by Util::FPArray< Data, Capacity >::begin(), Util::PArray< Data >::begin(), and Util::SSet< Data, Capacity >::begin().

◆ setNull()

template<typename Data >
void Util::ConstPArrayIterator< Data >::setNull ( )
inline

Nullify the iterator.

Definition at line 72 of file ConstPArrayIterator.h.

Referenced by Util::PArray< Data >::begin().

◆ isEnd()

template<typename Data >
bool Util::ConstPArrayIterator< Data >::isEnd ( ) const
inline

Is the current pointer at the end of the array.

Returns
true if at end, false otherwise

Definition at line 84 of file ConstPArrayIterator.h.

◆ notEnd()

template<typename Data >
bool Util::ConstPArrayIterator< Data >::notEnd ( ) const
inline

Is the current pointer not at the end of the array?

Returns
true if not at end, false otherwise

Definition at line 92 of file ConstPArrayIterator.h.

◆ get()

template<typename Data >
const Data * Util::ConstPArrayIterator< Data >::get ( ) const
inline

Return a pointer to const current data.

Returns
true if at end, false otherwise.

Definition at line 100 of file ConstPArrayIterator.h.

◆ operator*()

template<typename Data >
const Data & Util::ConstPArrayIterator< Data >::operator* ( ) const
inline

Return a const refererence to the current Data.

Returns
const reference to the Data object

Definition at line 111 of file ConstPArrayIterator.h.

◆ operator->()

template<typename Data >
const Data * Util::ConstPArrayIterator< Data >::operator-> ( ) const
inline

Provide a pointer to the current Data object.

Returns
pointer to the Data object

Definition at line 119 of file ConstPArrayIterator.h.

◆ operator++()

template<typename Data >
ConstPArrayIterator< Data > & Util::ConstPArrayIterator< Data >::operator++ ( )
inline

Increment the current pointer.

Returns
this ConstPArrayIterator, after modification

Definition at line 127 of file ConstPArrayIterator.h.


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