Loading...
Searching...
No Matches
EST_TStructIterator< Container, IPointer, Entry > Class Template Reference
Inheritance diagram for EST_TStructIterator< Container, IPointer, Entry >:
[legend]
Collaboration diagram for EST_TStructIterator< Container, IPointer, Entry >:
[legend]

## Public Types

typedef EST_TIterator< Container, IPointer, Entry > | Iter
Public Types inherited from EST_TIterator< Container, IPointer, Entry >
typedef EST_TIterator< Container, IPointer, Entry > | Iter
| Name for an iterator like this.

## Public Member Functions

| EST_TStructIterator ()
| Create an iterator not associated with any specific container.
Iter & | operator= (const Iter &orig)
| Copy an iterator by assignment.
| EST_TStructIterator (const Container &over)
| Create an iterator ready to run over the given container.
const Entry * | operator-> () const
Public Member Functions inherited from EST_TIterator< Container, IPointer, Entry >
| EST_TIterator ()
| Create an iterator not associated with any specific container.
| EST_TIterator (const Container &over)
| Create an iterator ready to run over the given container.
Iter & | operator= (const Iter &orig)
| Copy an iterator by assignment.
Iter & | operator= (const Container &over)
| Assigning a container to an iterator sets it ready to start.
void | begin (const Container &over)
| Set the iterator ready to run over this container.
void | beginning ()
| Reset to the start of the container.
bool | has_more_elements () const
| True if there are more elements to look at.
bool | at_end () const
| True when there are no more.
| operator int () const
void | next ()
| Next moves to the next entry.
Iter & | operator++ ()
| The increment operator does the same as next.
Iter | operator++ (int dummy)
const Entry & | current () const
| Return the element currently pointed to.
const Entry & | operator* () const
| The * operator returns the current element.
const Entry & | next_element ()
| Return the current element and move the pointer forwards.
unsigned int | n () const
| Return the current position.

## Additional Inherited Members

Protected Attributes inherited from EST_TIterator< Container, IPointer, Entry >
Container * | cont
| The container we are looking at.
unsigned int | pos
| Position in the structure. May or may not be useful.
IPointer | pointer

## Detailed Description

template<class Container, class IPointer, class Entry>
class EST_TStructIterator< Container, IPointer, Entry >

Template class defining interface to an iterator, i.e an object which returns elements from a structure one at a time.

This is template is usually hidden in the declaration of the container classes with a typedef for Entries providing a more convenient name for the iterator. However the interface is that defined here.

We support two interfaces, a pointer like interface similar to specialised iteration code elsewhere in the speech tools library and to the iterators in the C++ standard template library and an interface similar to that of Enumerations in Java.

<programlisting arch='c++'> MyContainer::Entries them;

for(them.begin(container); them; them++) { MyContainer::Entry &it = *them; // Do Something With it }</programlisting>

<programlisting arch='c++'> MyContainer::Entries them;

them.begin(container); while (them.has_more_entries()) { MyContainer::Entry &it = them.next_entry(); // Do Something With it }</programlisting>

Author
  Richard Caley rjc@c.nosp@m.str..nosp@m.ed.ac.nosp@m..uk

Version

Id
  EST_TIterator.h,v 1.7 2013/04/13 14:17:11 awb Exp

Definition at line 196 of file EST_TIterator.h.

## Member Typedef Documentation

## Iter

template<class Container, class IPointer, class Entry>

typedef EST_TIterator<Container, IPointer, Entry> EST_TStructIterator< Container, IPointer, Entry >::Iter

Definition at line 201 of file EST_TIterator.h.

## Constructor & Destructor Documentation

## EST_TStructIterator() [1/2]

template<class Container, class IPointer, class Entry>

EST_TStructIterator< Container, IPointer, Entry >::EST_TStructIterator | ( |  | ) |

inline

Create an iterator not associated with any specific container.

Definition at line 204 of file EST_TIterator.h.

## EST_TStructIterator() [2/2]

template<class Container, class IPointer, class Entry>

EST_TStructIterator< Container, IPointer, Entry >::EST_TStructIterator | ( | const Container & | over | ) |

inline

Create an iterator ready to run over the given container.

Definition at line 211 of file EST_TIterator.h.

## Member Function Documentation

## operator=()

template<class Container, class IPointer, class Entry>

Iter & EST_TStructIterator< Container, IPointer, Entry >::operator= | ( | const Iter & | orig | ) |

inline

Copy an iterator by assignment.

Definition at line 207 of file EST_TIterator.h.

## operator->()

template<class Container, class IPointer, class Entry>

const Entry * EST_TStructIterator< Container, IPointer, Entry >::operator-> | ( |  | ) | const

inline

Definition at line 214 of file EST_TIterator.h.

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

- include/EST_TIterator.h