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.

Note: This iterator should be used within the scope of a calling function and not passed between them since the address of added items are stored by the iterator.

Definition at line 638 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 652 of file Iterator.h.

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

Destructor

Exceptions:
None 

Definition at line 666 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 737 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 716 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 696 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 678 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() will return a valid element, false if the end of the iterator has been reached.
Exceptions:
None 

Implements DWFCore::DWFIterator< T >.

Definition at line 687 of file Iterator.h.


The documentation for this class was generated from the following file:
Generated on Tue Jan 6 22:39:37 2009 for Autodesk DWF Core Library by  doxygen 1.4.5