DWFCore::DWFVector< T, Pr, Eq > Class Template Reference

#include "dwfcore/Vector.h"

Inheritance diagram for DWFCore::DWFVector< T, Pr, Eq >:

Inheritance graph
[legend]
Collaboration diagram for DWFCore::DWFVector< T, Pr, Eq >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
class DWFCore::DWFVector< T, Pr, Eq >

A container to store objects in a contiguous block of memory (as in STL vectors).

Since:
1.2
This abstract class provides the basic interface to DWFVectors.

Parameters:
T The value type.
Pr Predicate defining the order between to values.
Eq The equality comparision between values.

Definition at line 61 of file Vector.h.

Public Types

typedef DWFCore::DWFVectorConstIterator<
T > 
ConstIterator
 This type defines a const iterator on DWFVector.

Public Member Functions

 DWFVector () throw ()
 DWFVector (const std::vector< T > &oVector) throw ()
 DWFVector (const DWFVector< T > &oVector) throw ()
virtual ~DWFVector () throw ()
bool erase (const T &oValue) throw ()
void eraseAt (size_t index) throw ( DWFException )
void eraseAt (size_t iStart, size_t iStop) throw ( DWFException )
void clear () throw ()
bool empty () const
size_t size () const throw ()
virtual size_t count (const T &oValue) const =0 throw ()
virtual const T & front () const =0 throw ( DWFException )
virtual const T & back () const =0 throw ( DWFException )
virtual const T & operator[] (size_t index) const =0 throw ( DWFException )
virtual bool findFirst (const T &oValue, size_t &iFirst) const =0 throw ()
virtual bool operator== (const DWFVector< T, Pr, Eq > &oVector) const throw ()
virtual ConstIteratorconstIterator () const =0 throw ()

Protected Types

typedef std::vector< T
>::iterator 
_tSTLIterator
typedef std::vector< T
>::const_iterator 
_tSTLConstIterator

Protected Attributes

std::vector< T > _oVector
Pr _tCompares
Eq _tEquals


Constructor & Destructor Documentation

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
DWFCore::DWFVector< T, Pr, Eq >::DWFVector  )  throw () [inline]
 

Constructor

Exceptions:
None 

Definition at line 78 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
DWFCore::DWFVector< T, Pr, Eq >::DWFVector const std::vector< T > &  oVector  )  throw () [inline]
 

Constructor

Parameters:
oVector An STL vector of with the same type of elements
Exceptions:
None 

Definition at line 89 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
DWFCore::DWFVector< T, Pr, Eq >::DWFVector const DWFVector< T > &  oVector  )  throw () [inline]
 

Copy Constructor

Parameters:
oVector The DWFVector to copy.
Exceptions:
None 

Definition at line 100 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual DWFCore::DWFVector< T, Pr, Eq >::~DWFVector  )  throw () [inline, virtual]
 

Destructor

Exceptions:
None 

Definition at line 110 of file Vector.h.


Member Function Documentation

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual const T& DWFCore::DWFVector< T, Pr, Eq >::back  )  const throw ( DWFException ) [pure virtual]
 

Return a const reference to the last element in the vector.

Returns:
A const reference to the last element in the vector
Exceptions:
DWFUnexpectedException is thrown if there are no elements in the vector.

Implemented in DWFCore::DWFOrderedVector< T, Pr, Eq >, and DWFCore::DWFSortedVector< T, Pr, Eq >.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFVector< T, Pr, Eq >::clear  )  throw () [inline]
 

Clear out the vector. This will not change whether or not duplicates are allowed.

Exceptions:
None 

Definition at line 191 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual ConstIterator* DWFCore::DWFVector< T, Pr, Eq >::constIterator  )  const throw () [pure virtual]
 

Returns a const iterator from the first element in the vector. The const iterator prevents modification of the element values to preserve the sort order. The caller owns the iterator and is responsible for releasing it with the DWFCORE_FREE_OBJECT macro.

Returns:
A pointer to a new list iterator.
Exceptions:
None 

Implemented in DWFCore::DWFOrderedVector< T, Pr, Eq >, and DWFCore::DWFSortedVector< T, Pr, Eq >.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual size_t DWFCore::DWFVector< T, Pr, Eq >::count const T &  oValue  )  const throw () [pure virtual]
 

Returns the number of copies of a given value in the vector.

Parameters:
oValue The value whose count will be returned.
Returns:
The number of copies of the value.
Exceptions:
None 

Implemented in DWFCore::DWFOrderedVector< T, Pr, Eq >, and DWFCore::DWFSortedVector< T, Pr, Eq >.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
bool DWFCore::DWFVector< T, Pr, Eq >::empty  )  const [inline]
 

Returns whether or not the vector is empty.

Returns:
True if the vector is empty.
Exceptions:
None 

Definition at line 203 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
bool DWFCore::DWFVector< T, Pr, Eq >::erase const T &  oValue  )  throw () [inline]
 

Erase a value from the vector. All copies of the value will be removed.

Parameters:
oValue The value to remove
Returns:
If the value is found and removed this returns true.
Exceptions:
None 

Definition at line 121 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFVector< T, Pr, Eq >::eraseAt size_t  iStart,
size_t  iStop
throw ( DWFException ) [inline]
 

Erase elements at positions given by the range. iStart is included and iStop is excluded. If iStop is greater than the size of the vector, all elements upto the end will be removed.

Parameters:
iStart Position of first element to remove.
iStop 1 past the position of the last element to remove.
Exceptions:
A DWFUnexpectedException is thrown if the index is out of range.

Definition at line 165 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFVector< T, Pr, Eq >::eraseAt size_t  index  )  throw ( DWFException ) [inline]
 

Erase an element at the given index.

Parameters:
index The index of the element to remove.
Exceptions:
A DWFUnexpectedException is thrown if the index is out of range.

Definition at line 143 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual bool DWFCore::DWFVector< T, Pr, Eq >::findFirst const T &  oValue,
size_t &  iFirst
const throw () [pure virtual]
 

Search for the first occurence of a value. If it is found the index is returned in iFirst. If the value is not found these are undefined.

Parameters:
oValue The value being searched.
iFirst The first occurence is returned in the argument
Returns:
True if the value is found
Exceptions:
None 

Implemented in DWFCore::DWFOrderedVector< T, Pr, Eq >, and DWFCore::DWFSortedVector< T, Pr, Eq >.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual const T& DWFCore::DWFVector< T, Pr, Eq >::front  )  const throw ( DWFException ) [pure virtual]
 

Return a const reference to the first element in the vector.

Returns:
A const reference to the first element in the vector
Exceptions:
DWFUnexpectedException is thrown if there are no elements in the vector.

Implemented in DWFCore::DWFOrderedVector< T, Pr, Eq >, and DWFCore::DWFSortedVector< T, Pr, Eq >.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual bool DWFCore::DWFVector< T, Pr, Eq >::operator== const DWFVector< T, Pr, Eq > &  oVector  )  const throw () [inline, virtual]
 

Test the equality of the vectors.

Parameters:
oVector The sorted vector to compare against.
Returns:
True if each element in the RHS vector is equal to the element at the corresponding location in the LHS vector.

Definition at line 278 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual const T& DWFCore::DWFVector< T, Pr, Eq >::operator[] size_t  index  )  const throw ( DWFException ) [pure virtual]
 

Returns a const reference to the element at the given index in the vector

Parameters:
index The index at which to get the element.
Returns:
A const reference to the element at the index.
Exceptions:
DWFUnexpectedException is thrown is the index is past the end of the range.

Implemented in DWFCore::DWFOrderedVector< T, Pr, Eq >, and DWFCore::DWFSortedVector< T, Pr, Eq >.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
size_t DWFCore::DWFVector< T, Pr, Eq >::size  )  const throw () [inline]
 

Returns the size of the vector.

Returns:
The number of elements in the vector
Exceptions:
None 

Definition at line 214 of file Vector.h.


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