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

Forward iterator for a PArray. More...

#include <PArrayIterator.h>

Public Member Functions

 PArrayIterator ()
 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 PArray? More...
 
bool notEnd () const
 Is the current pointer not at the end of the PArray? More...
 
Data * get () const
 Return a pointer to the current data. More...
 

Operators

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

Detailed Description

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

Forward iterator for a PArray.

An PArrayIterator 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, an PArrayIterator contains 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 PArrayIterator.h.

Constructor & Destructor Documentation

◆ PArrayIterator()

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

Default constructor.


Constructs a null iterator.

Definition at line 44 of file PArrayIterator.h.

Member Function Documentation

◆ setCurrent()

template<typename Data >
void Util::PArrayIterator< 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 PArrayIterator.h.

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

◆ setEnd()

template<typename Data >
void Util::PArrayIterator< 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 PArrayIterator.h.

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

◆ setNull()

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

Nullify the iterator.

Definition at line 72 of file PArrayIterator.h.

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

◆ isEnd()

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

Is the current pointer at the end of the PArray?

Returns
true if at end, false otherwise.

Definition at line 84 of file PArrayIterator.h.

◆ notEnd()

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

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

Returns
true if not at end, false otherwise.

Definition at line 92 of file PArrayIterator.h.

◆ get()

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

Return a pointer to the current data.

Returns
true if at end, false otherwise.

Definition at line 100 of file PArrayIterator.h.

◆ operator*()

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

Return a reference to the current Data.

Returns
reference to associated Data object

Definition at line 111 of file PArrayIterator.h.

◆ operator->()

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

Provide a pointer to the current Data object.

Returns
pointer to the Data object

Definition at line 122 of file PArrayIterator.h.

◆ operator++()

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

Increment the current pointer.

Returns
this PArrayIterator, after modification.

Definition at line 133 of file PArrayIterator.h.


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