corelinux::Iterator< ElementType > Class Template Referenceabstract

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

`#include <Iterator.hpp>`

## Public Member Functions

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

Set iterator to next element

Exceptions

  IteratorBoundsException | if attempt to position past end of elements.

virtual void | setPrevious (void)=0 throw (IteratorBoundsException)

Set iterator to previous element

Exceptions

  IteratorBoundsException | if attempt to position before begining of elements.

virtual void | setLast (void)=0 throw (IteratorBoundsException)

Set iterator to last element

Exceptions

  IteratorBoundsException | if it is the iterator is over an empty collection.

Public Member Functions inherited from corelinux::CoreLinuxObject
| CoreLinuxObject (void)
| Default Constructor.
| CoreLinuxObject (CoreLinuxObjectCref)
| Copy Constructor. More...
virtual | ~CoreLinuxObject (void)
| Virtual Destructor.
CoreLinuxObjectRef | operator= (CoreLinuxObjectCref)
| Assignment operator overload. More...
bool | operator== (CoreLinuxObjectCref) const
| Equality operator overload. More...
bool | operator!= (CoreLinuxObjectCref) const
| Non-equality operator overload. More...

## 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 >.

Referenced by corelinux::Subject::notifyAllObservers(), and corelinux::Subject::notifyObservers().

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 >.

Referenced by corelinux::Subject::notifyAllObservers(), and corelinux::Subject::notifyObservers().

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

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

- Iterator.hpp

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium