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

#include "dwfcore/Vector.h"

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

Inheritance graph
[legend]
Collaboration diagram for DWFCore::DWFOrderedVector< 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::DWFOrderedVector< T, Pr, Eq >

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

Since:
1.2
This class allows the storage of elements in a contiguous block in memory while preserving the order in which they are added to the vector.

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

Definition at line 331 of file Vector.h.

Public Types

typedef DWFVectorIterator< T > Iterator
 This type defines an iterator on the vector.
enum  teVectorInsertLocation { eDefault = 0, eFront = 1, eBack = 2 }
 This type defines the enumeration of standard locations to insert new elements. More...

Public Member Functions

 DWFOrderedVector () throw ()
 DWFOrderedVector (size_t nSize, const T &tValue) throw ()
 DWFOrderedVector (const std::vector< T > &oVector) throw ()
 DWFOrderedVector (const DWFOrderedVector< T, Pr, Eq > &oVector) throw ()
 ~DWFOrderedVector () throw ()
virtual DWFOrderedVector<
T, Pr, Eq > & 
operator= (const DWFOrderedVector< T, Pr, Eq > &oVector) throw ()
void insert (const T &oValue, teVectorInsertLocation eLoc=eDefault) throw ()
void insert (const std::vector< T > &oVector, teVectorInsertLocation eLoc=eDefault) throw ()
void insert (const DWFOrderedVector< T > &oOrderedVector, teVectorInsertLocation eLoc=eDefault) throw ()
void insertAt (const T &oValue, size_t index) throw ( DWFException )
void push_back (const T &oValue) throw ()
virtual size_t count (const T &oValue) const throw ()
virtual bool findFirst (const T &oValue, size_t &iFirst) const throw ()
virtual size_t findAll (const T &oValue, DWFOrderedVector< unsigned int > &oIndices) const throw ()
T & front () throw ( DWFException )
virtual const T & front () const throw ( DWFException )
T & back () throw ( DWFException )
virtual const T & back () const throw ( DWFException )
T & operator[] (size_t index) throw ( DWFException )
const T & operator[] (size_t index) const throw ( DWFException )
virtual DWFOrderedVector<
T >::Iterator
iterator () throw ()
virtual DWFOrderedVector<
T >::ConstIterator
constIterator () const throw ()


Member Enumeration Documentation

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
enum DWFCore::DWFOrderedVector::teVectorInsertLocation
 

This type defines the enumeration of standard locations to insert new elements.

Enumerator:
eDefault  The default value depends on the implementation
eFront  Insert elements at the front
eBack  Insert elements at the back

Definition at line 346 of file Vector.h.


Constructor & Destructor Documentation

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

Constructor

Exceptions:
None 

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
DWFCore::DWFOrderedVector< T, Pr, Eq >::DWFOrderedVector size_t  nSize,
const T &  tValue
throw () [inline]
 

Constructor

This constructor initializes the vector with the provided size, filling it with copies of the provided value.

Parameters:
nSize The size of the vector.
tValue The value that must be used to initialize the vector.
Exceptions:
None 

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

Constructor

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

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

Copy Constructor

Parameters:
oVector The DWFVector to copy.
Exceptions:
None 

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

Destructor

Exceptions:
None 

Definition at line 419 of file Vector.h.


Member Function Documentation

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual const T& DWFCore::DWFOrderedVector< T, Pr, Eq >::back  )  const throw ( DWFException ) [inline, 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.
.

Implements DWFCore::DWFVector< T, Pr, Eq >.

Definition at line 682 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
T& DWFCore::DWFOrderedVector< T, Pr, Eq >::back  )  throw ( DWFException ) [inline]
 

Return a reference to the last element in the vector.

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

Definition at line 668 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual DWFOrderedVector<T>::ConstIterator* DWFCore::DWFOrderedVector< T, Pr, Eq >::constIterator  )  const throw () [inline, 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 

Implements DWFCore::DWFVector< T, Pr, Eq >.

Definition at line 750 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual size_t DWFCore::DWFOrderedVector< T, Pr, Eq >::count const T &  oValue  )  const throw () [inline, 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 

Implements DWFCore::DWFVector< T, Pr, Eq >.

Definition at line 555 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual size_t DWFCore::DWFOrderedVector< T, Pr, Eq >::findAll const T &  oValue,
DWFOrderedVector< unsigned int > &  oIndices
const throw () [inline, virtual]
 

Find the instances of oValue in the vector. The method returns the number such instances. The position of each instance is returned in the oIndices vector passed in as argument.

Parameters:
oValue The value being searched.
oIndices A vector to return the indices of each found instance.
Returns:
The number of elements that are equal to oValue.
Exceptions:
None 

Definition at line 613 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual bool DWFCore::DWFOrderedVector< T, Pr, Eq >::findFirst const T &  oValue,
size_t &  iFirst
const throw () [inline, 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 

Implements DWFCore::DWFVector< T, Pr, Eq >.

Definition at line 583 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual const T& DWFCore::DWFOrderedVector< T, Pr, Eq >::front  )  const throw ( DWFException ) [inline, 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.
.

Implements DWFCore::DWFVector< T, Pr, Eq >.

Definition at line 651 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
T& DWFCore::DWFOrderedVector< T, Pr, Eq >::front  )  throw ( DWFException ) [inline]
 

Return a reference to the first element in the vector.

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

Definition at line 637 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFOrderedVector< T, Pr, Eq >::insert const DWFOrderedVector< T > &  oOrderedVector,
teVectorInsertLocation  eLoc = eDefault
throw () [inline]
 

Insert copies of values from another ordered vector.

Parameters:
oOrderedVector The value to insert.
eLoc The location to insert at.
Exceptions:
None 

Definition at line 503 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFOrderedVector< T, Pr, Eq >::insert const std::vector< T > &  oVector,
teVectorInsertLocation  eLoc = eDefault
throw () [inline]
 

Insert values from an STL vector into this vector.

Parameters:
oVector The STL vector to copy.
eLoc The location to insert at.
Exceptions:
None 

Definition at line 475 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFOrderedVector< T, Pr, Eq >::insert const T &  oValue,
teVectorInsertLocation  eLoc = eDefault
throw () [inline]
 

Insert a value into the vector.

Parameters:
oValue The value to insert.
eLoc The location to insert at.
Exceptions:
None 

Definition at line 447 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFOrderedVector< T, Pr, Eq >::insertAt const T &  oValue,
size_t  index
throw ( DWFException ) [inline]
 

Insert a value at the given index. If the given index is greater than the size of the vector, an exception is thrown.

Parameters:
oValue The value to insert.
index The index of the location to insert it.
Exceptions:
A DWFUnexpectedException is thrown if the index is greater than the size.

Definition at line 518 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual DWFOrderedVector<T>::Iterator* DWFCore::DWFOrderedVector< T, Pr, Eq >::iterator  )  throw () [inline, virtual]
 

Return an iterator from the first element in the vector. 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 

Definition at line 741 of file Vector.h.

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

Assignment operator for copying

Parameters:
oVector The DWFVector to copy.
Exceptions:
None 

Definition at line 429 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
const T& DWFCore::DWFOrderedVector< T, Pr, Eq >::operator[] size_t  index  )  const throw ( DWFException ) [inline, 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.

Implements DWFCore::DWFVector< T, Pr, Eq >.

Definition at line 720 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
T& DWFCore::DWFOrderedVector< T, Pr, Eq >::operator[] size_t  index  )  throw ( DWFException ) [inline]
 

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

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

Definition at line 700 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFOrderedVector< T, Pr, Eq >::push_back const T &  oValue  )  throw () [inline]
 

Append a value at the end of the vector.

Parameters:
oValue The value to append.
Exceptions:
None 

Definition at line 542 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