PSCF v1.1
|
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... | |
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.
|
inline |
|
inline |
Set the current pointer value.
ptr | Pointer 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().
|
inline |
Set the value of the end pointer.
ptr | Pointer 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().
|
inline |
Nullify the iterator.
Definition at line 72 of file PArrayIterator.h.
Referenced by Util::PArray< Data >::begin().
|
inline |
Is the current pointer at the end of the PArray?
Definition at line 84 of file PArrayIterator.h.
|
inline |
Is the current pointer not at the end of the PArray?
Definition at line 92 of file PArrayIterator.h.
|
inline |
Return a pointer to the current data.
Definition at line 100 of file PArrayIterator.h.
|
inline |
Return a reference to the current Data.
Definition at line 111 of file PArrayIterator.h.
|
inline |
Provide a pointer to the current Data object.
Definition at line 122 of file PArrayIterator.h.
|
inline |
Increment the current pointer.
Definition at line 133 of file PArrayIterator.h.