Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

DWFCore::DWFBasicIteratorImpl< T > Class Template Reference

#include "dwfcore/Iterator.h"

Inheritance diagram for DWFCore::DWFBasicIteratorImpl< T >:

Inheritance graph
[legend]
Collaboration diagram for DWFCore::DWFBasicIteratorImpl< T >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class T>
class DWFCore::DWFBasicIteratorImpl< T >

An iterator and basic collection implementation template.
Since:
1.0.1.

This implementation provides an iterator interface over a simple array-based collection of T type objects. This class is useful when a simple array of objects must be created and a DWFIterator interface must be returned for it. Memory allocation in the array is simple doubling with additional consideration for the hint provided:

 _nAlloc = max(2*_nAlloc, _nAlloc + _nHint) 

and is intended to reduce memory allocations over the lifetime of the collection. When a new allocation is required, the previous array is copied into the new one all at once.

Definition at line 285 of file Iterator.h.

Public Member Functions

 DWFBasicIteratorImpl (uint16_t nHint=16) throw ()
virtual ~DWFBasicIteratorImpl () throw ()
virtual void reset () throw ()
virtual bool valid () throw ()
virtual bool next () throw ()
virtual T & get () throw ( DWFException )
virtual void add (T &rT) throw ( DWFException )


Constructor & Destructor Documentation

template<class T>
DWFCore::DWFBasicIteratorImpl< T >::DWFBasicIteratorImpl uint16_t  nHint = 16  )  throw () [inline]
 

Constructor

Parameters:
nHint Best guess at the number of elements in the collection. The more accurate this number is, the fewer memory allocations will occur over the lifetime of the collection.
Exceptions:
None 

Definition at line 299 of file Iterator.h.

template<class T>
virtual DWFCore::DWFBasicIteratorImpl< T >::~DWFBasicIteratorImpl  )  throw () [inline, virtual]
 

Destructor

Exceptions:
None 

Definition at line 313 of file Iterator.h.


Member Function Documentation

template<class T>
virtual void DWFCore::DWFBasicIteratorImpl< T >::add T &  rT  )  throw ( DWFException ) [inline, virtual]
 

Add an element to the collection. This operation does not alter the iterator position unless it was previously invalid due to the existence of no elements.

Parameters:
rT The element to add.
Exceptions:
DWFException 

Definition at line 384 of file Iterator.h.

template<class T>
virtual T& DWFCore::DWFBasicIteratorImpl< T >::get  )  throw ( DWFException ) [inline, virtual]
 

Returns the element at the current position.

Returns:
The current element.
Exceptions:
DWFException 

Implements DWFCore::DWFIterator< T >.

Definition at line 363 of file Iterator.h.

template<class T>
virtual bool DWFCore::DWFBasicIteratorImpl< T >::next  )  throw () [inline, virtual]
 

Move the iterator forward one element.

Returns:
true if the iterator points to a valid element, false if the end of the iterator has been reached.
Exceptions:
None 

Implements DWFCore::DWFIterator< T >.

Definition at line 343 of file Iterator.h.

template<class T>
virtual void DWFCore::DWFBasicIteratorImpl< T >::reset  )  throw () [inline, virtual]
 

Reset the iterator back to its initial position

Exceptions:
None 

Implements DWFCore::DWFIterator< T >.

Definition at line 325 of file Iterator.h.

template<class T>
virtual bool DWFCore::DWFBasicIteratorImpl< T >::valid  )  throw () [inline, virtual]
 

Determines if the iterator points to a valid element.

Returns:
true if get() returns a valid element, false if the end of the iterator has been reached.
Exceptions:
None 

Implements DWFCore::DWFIterator< T >.

Definition at line 334 of file Iterator.h.


The documentation for this class was generated from the following file:
Generated on Tue May 17 12:05:18 2005 for Autodesk DWF Core Library by  doxygen 1.4.1