---
name: "corelinux_Iterator"
section: "3"
platform: "linux"
package: "libcorelinux-dev"
version: "0.4.32-5"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/corelinux_Iterator"
---

# corelinux\_Iterator(3)

The Iterator provides a way to access the elements of an collection type sequentially without exposing its underlying representation.

## NAME

corelinux::Iterator - The **Iterator** provides a way to access the elements of an collection type sequentially without exposing its underlying representation.

## SYNOPSIS

`#include <Iterator.hpp>`

Inherits **corelinux::CoreLinuxObject**.

Inherited by **corelinux::AssociativeIterator\< KeyType, ElementType \>**, and **corelinux::CoreLinuxIterator\< TraverseType, ElementType \>**.

### Public Member Functions

**Iterator** (void)\
 *Default constructor.*  **Iterator** (const  **Iterator** &aRef)\
 *Copy constructor.*  virtual **~Iterator** (void)\
 *Destructor.*  **Iterator** & **operator=** (const  **Iterator** &)\
 *Assignment operator.*  bool **operator==** (const  **Iterator** &aRef) const \
 *Equality operator.*  virtual bool **isValid** (void) const =0\
 *isValid abstract interface for implementation to determine if the current position points to a valid EntityType instance*  virtual ElementType **getElement** (void) const =0  throw (IteratorBoundsException)\
 *getElement returns the ElementType instance that is currently pointed to by the* **Iterator**  virtual void **setFirst** (void)=0\
 *Set iterator to first element.*  virtual void **setNext** (void)=0  throw (IteratorBoundsException)\
 *Set iterator to next element.*  virtual void **setPrevious** (void)=0  throw (IteratorBoundsException)\
 *Set iterator to previous element.*  virtual void **setLast** (void)=0  throw (IteratorBoundsException)\
 *Set iterator to last element.*

## Detailed Description

### template\<class ElementType\> class corelinux::Iterator\< ElementType \>

The **Iterator** provides a way to access the elements of an collection type sequentially without exposing its underlying representation.

The implementation requires a template argument that describes the ElementType being iterated over.

## Constructor & Destructor Documentation

### template\<class ElementType\> corelinux::Iterator\< ElementType \>::Iterator (const Iterator\< ElementType \> & aRef)` [inline]`

Copy constructor. **Parameters:**

*Iterator* const reference

## Member Function Documentation

### template\<class ElementType\> virtual ElementType corelinux::Iterator\< ElementType \>::getElement (void) const throw (IteratorBoundsException)` [pure virtual]`

getElement returns the ElementType instance that is currently pointed to by the **Iterator** **Returns:**

ElementType

**Exceptions:**

*IteratorBoundsException* if the **Iterator** is not positioned correctley.

Implemented in **corelinux::CoreLinuxAssociativeIterator\< TraverseType, KeyType, ElementType \>**, and **corelinux::CoreLinuxIterator\< TraverseType, ElementType \>**.

### template\<class ElementType\> virtual bool corelinux::Iterator\< ElementType \>::isValid (void) const` [pure virtual]`

isValid abstract interface for implementation to determine if the current position points to a valid EntityType instance **Returns:**

bool true if valid, false otherwise

Implemented in **corelinux::CoreLinuxAssociativeIterator\< TraverseType, KeyType, ElementType \>**, and **corelinux::CoreLinuxIterator\< TraverseType, ElementType \>**.

### template\<class ElementType\> Iterator& corelinux::Iterator\< ElementType \>::operator= (const Iterator\< ElementType \> &)` [inline]`

Assignment operator. **Parameters:**

*Iterator* const reference

**Returns:**

**Iterator** reference

### template\<class ElementType\> bool corelinux::Iterator\< ElementType \>::operator== (const Iterator\< ElementType \> & aRef) const` [inline]`

Equality operator. **Parameters:**

*Iterator* const reference

**Returns:**

bool - true if instances are equal

### template\<class ElementType\> virtual void corelinux::Iterator\< ElementType \>::setLast (void) throw (IteratorBoundsException)` [pure virtual]`

Set iterator to last element. **Exceptions:**

*IteratorBoundsException* if it is the iterator is over an empty collection

Implemented in **corelinux::CoreLinuxAssociativeIterator\< TraverseType, KeyType, ElementType \>**, and **corelinux::CoreLinuxIterator\< TraverseType, ElementType \>**.

### template\<class ElementType\> virtual void corelinux::Iterator\< ElementType \>::setNext (void) throw (IteratorBoundsException)` [pure virtual]`

Set iterator to next element. **Exceptions:**

*IteratorBoundsException* if attempt to position past end of elements

Implemented in **corelinux::CoreLinuxAssociativeIterator\< TraverseType, KeyType, ElementType \>**, and **corelinux::CoreLinuxIterator\< TraverseType, ElementType \>**.

### template\<class ElementType\> virtual void corelinux::Iterator\< ElementType \>::setPrevious (void) throw (IteratorBoundsException)` [pure virtual]`

Set iterator to previous element. **Exceptions:**

*IteratorBoundsException* if attempt to position before begining of elements

Implemented in **corelinux::CoreLinuxAssociativeIterator\< TraverseType, KeyType, ElementType \>**, and **corelinux::CoreLinuxIterator\< TraverseType, ElementType \>**.

## Author

Generated automatically by Doxygen for CoreLinux++ from the source code.
