Class hierarchy Compound list Compound Members

# Enumeration Class Reference

This class provides a serial list of elements. More...

List of all members.

## Public Members

- Enumeration ()
    Default Constructor: Construct an empty Enumeration.

- Enumeration (const Enumeration& e)
    Copy Constructor: Construct a copy of an enumeration.

- Enumeration (Enumeration& e, int temp)
    Copy a non-const enumeration and optionally discard source enumeration if temp is non-zero.

- Enumeration (const Container& c)
    Construct an enumeration of any Container.

- Enumeration (const Vector& v)
    Construct an enumeration of a vector.

- virtual ~Enumeration ()
    Destructor.

- Enumeration& operator= (const Enumeration&)
    Assignment: Copy an enumeration.

- DS_BOOL hasMoreElements () const
    Returns a non-zero value if there are more elements to be read.

- Data nextElement ()
    Returns the next element.

- long forEach (FN_FOR_EACH* fn)
    Execute a function on each element from the current element to the last.

- void reset ()
    Reset to read the elements again from the start.

- void reverse ()
    Reverse the order of reading.

- int load (const Container& c)
    Load an enumeration from any container.

- int load (const Enumeration& e)
    Load an enumeration from another enumeration.

- int load (Enumeration& e, int temp=0)
    Load this enumeration from a non-const enum and optionally discard source if temp is non-zero.

- DS_BOOL isDestructive () const
    returns non-zero if the container or enumeration from which this enumeration was built isDestructive().

- Enumeration ()
    Default Constructor: Construct an empty Enumeration.

- Enumeration (const Enumeration& e)
    Copy Constructor: Construct a copy of an enumeration.

- Enumeration (const Container& c)
    Construct an enumeration of any Container.

- Enumeration (const Vector& v)
    Construct an enumeration of a vector.

- virtual ~Enumeration ()
    Destructor.

- Enumeration& operator= (const Enumeration&)
    Assignment: Copy an enumeration.

- DS_BOOL hasMoreElements () const
    Returns a non-zero value if there are more elements to be read.

- Data nextElement ()
    Returns the next element.

- void setFilter (FILTER_FN* fn=NULL)
    Set the function by which the elements are to be filtered by this enumeration.

- long forEach (FN_FOR_EACH* fn)
    Execute a function on each element from the current element to the last.

- void reset ()
    Reset to read the elements again from the start.

- void reverse ()
    Reverse the order of reading.

- int load (const Container& c)
    Load an enumeration from any container.

- int load (const Enumeration& e)
    Load an enumeration from another enumeration.

- DS_BOOL isDestructive () const
    returns non-zero if the container or enumeration from which this enumeration was built isDestructive().

## Detailed Description

This class provides a serial list of elements.

This is especially useful for non-vector containers. An instance of this class is returned by many containers' methods.

If an enumeration is not initialized by construction, opeartor= or load(), NotInitialized will be thrown by most of its other methods.

All enumerations created using the elements() method of a container are considered initialized, regardless of whether they have any elements.

## Member Function Documentation

### Enumeration::Enumeration()

Default Constructor: Construct an empty Enumeration.

operator= or load() must be used before using any of this enumeration's methods.

### Enumeration::Enumeration(const Enumeration& e)

Copy Constructor: Construct a copy of an enumeration.

### Enumeration::Enumeration(Enumeration& e, int temp)

Copy a non-const enumeration and optionally discard source enumeration if temp is non-zero.

Invalidates e if temp.

### Enumeration::Enumeration(const Container& c)

Construct an enumeration of any Container.

### Enumeration::Enumeration(const Vector& v)

Construct an enumeration of a vector.

### virtual Enumeration::~Enumeration()`[virtual]`

Destructor.

### Enumeration& Enumeration::operator=(const Enumeration&)

Assignment: Copy an enumeration.

### DS_BOOL Enumeration::hasMoreElements() const

Returns a non-zero value if there are more elements to be read.

### Data Enumeration::nextElement()

Returns the next element.

Throws IndexOutOfBounds if there are no more elements.

### long Enumeration::forEach(FN_FOR_EACH* fn)

Execute a function on each element from the current element to the last.

If fn(item) returns non-zero for any element, forEach() stops and returns that value. If, for each element, fn(item) returns 0, forEach() also returns 0.

### void Enumeration::reset()

Reset to read the elements again from the start.

### void Enumeration::reverse()

Reverse the order of reading.

To read from the start (or end), reset() must be applied afterwards.

### int Enumeration::load(const Container& c)

Load an enumeration from any container.

Returns the number of elements added (c.size()). Resets this enumeration to the beginning and sets the direction to forward. Unlike Container::load(), load() is not cumulative (the enumeration is cleared before the load).

### int Enumeration::load(const Enumeration& e)

Load an enumeration from another enumeration.

### int Enumeration::load(Enumeration& e, int temp=0)

Load this enumeration from a non-const enum and optionally discard source if temp is non-zero.

Invaildates e if temp.

### DS_BOOL Enumeration::isDestructive() const

returns non-zero if the container or enumeration from which this enumeration was built isDestructive().

### Enumeration::Enumeration()

Default Constructor: Construct an empty Enumeration.

operator= or load must be used before using any of the Enumeration's methods.

### Enumeration::Enumeration(const Enumeration& e)

Copy Constructor: Construct a copy of an enumeration.

### Enumeration::Enumeration(const Container& c)

Construct an enumeration of any Container.

### Enumeration::Enumeration(const Vector& v)

Construct an enumeration of a vector.

### virtual Enumeration::~Enumeration()`[virtual]`

Destructor.

### Enumeration& Enumeration::operator=(const Enumeration&)

Assignment: Copy an enumeration.

### DS_BOOL Enumeration::hasMoreElements() const

Returns a non-zero value if there are more elements to be read.

### Data Enumeration::nextElement()

Returns the next element.

Returns NULL if there are no more elements.

### void Enumeration::setFilter(FILTER_FN* fn=NULL)

Set the function by which the elements are to be filtered by this enumeration.

if NULL (the default), no filtering is done. The specified filter function is applied to each element determining whether it will be detected by hasMoreElements() or returned by nextElement(). if fn(item) returns non-zero, the item is considered part of the enumeration.

### long Enumeration::forEach(FN_FOR_EACH* fn)

Execute a function on each element from the current element to the last.

If fn(item) returns non-zero for any element, forEach() stops and returns that value. If, for each element, fn(item) returns 0, forEach() also returns 0.

### void Enumeration::reset()

Reset to read the elements again from the start.

### void Enumeration::reverse()

Reverse the order of reading.

Reset must be applied afterwards to read from the start.

### int Enumeration::load(const Container& c)

Load an enumeration from any container.

Returns the number of elements added (c.size()). Resets the enumeration to the beginning and sets the direction to forward.

### int Enumeration::load(const Enumeration& e)

Load an enumeration from another enumeration.

Returns the number of elements added (c.size()). Resets the enumeration to the beginning and sets the direction to forward.

### DS_BOOL Enumeration::isDestructive() const

returns non-zero if the container or enumeration from which this enumeration was built isDestructive().

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

- DS_Enumeration.h
- DS_EnumFilter.h