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

#include "dwfcore/Vector.h"

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

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

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

Since:
1.2
This class implements the sorted vector container. Elements get sorted as they are inserted, but all elements are stored in a contiguous block of memory, just as in the STL vectors (internally we use an STL vector). The sorted vector allows multiple copies of an element to be stored.

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

Definition at line 780 of file Vector.h.

Public Member Functions

 DWFSortedVector (bool bAllowDuplicates=true) throw ()
 DWFSortedVector (const std::vector< T > &oVector, bool bAllowDuplicates=true) throw ()
 DWFSortedVector (const DWFSortedVector< T, Pr, Eq > &oVector) throw ()
 ~DWFSortedVector () throw ()
DWFSortedVector< T, Pr, Eq > & operator= (const DWFSortedVector< T, Pr, Eq > &oVector) throw ()
void insert (const T &oValue) throw ()
void insert (const std::vector< T > &oVector) throw ()
void insert (const DWFSortedVector< T, Pr, Eq > &oSortedVector) throw ()
virtual size_t count (const T &oValue) const throw ()
virtual const T & front () const throw ( DWFException )
virtual const T & back () const throw ( DWFException )
virtual const T & operator[] (size_t index) const throw ( DWFException )
virtual bool findFirst (const T &oValue, size_t &iFirst) const throw ()
bool find (const T &oValue, size_t &iFirst, size_t &iLast) const throw ()
void allowDuplicates (bool bAllow=true) throw ()
bool duplicatesAllowed () const throw ()
virtual DWFSortedVector< T
>::ConstIterator
constIterator () const throw ()


Constructor & Destructor Documentation

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
DWFCore::DWFSortedVector< T, Pr, Eq >::DWFSortedVector bool  bAllowDuplicates = true  )  throw () [inline]
 

Constructor

Parameters:
bAllowDuplicates By default, the container can have multiple copies of the same object.
Exceptions:
None 

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

Constructor

Parameters:
oVector An STL vector of with the same type of elements
bAllowDuplicates Specifies whether duplicates are to be allowed or not.
Exceptions:
None 

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

Copy Constructor

Parameters:
oVector The sorted vector to copy.
Exceptions:
None 

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

Destructor

Exceptions:
None 

Definition at line 842 of file Vector.h.


Member Function Documentation

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFSortedVector< T, Pr, Eq >::allowDuplicates bool  bAllow = true  )  throw () [inline]
 

Change whether or not duplicates are allowed. If duplicates are being disallowed with this method, existing duplicates will be removed.

Parameters:
bAllow Set to true to allow duplicates (default).
Exceptions:
None 

Definition at line 1070 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual const T& DWFCore::DWFSortedVector< 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 972 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual DWFSortedVector<T>::ConstIterator* DWFCore::DWFSortedVector< 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 1102 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual size_t DWFCore::DWFSortedVector< 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 946 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
bool DWFCore::DWFSortedVector< T, Pr, Eq >::duplicatesAllowed  )  const throw () [inline]
 

Returns whether or not duplicates are allowed.

Returns:
True if duplicates are allowed.
Exceptions:
None 

Definition at line 1093 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
bool DWFCore::DWFSortedVector< T, Pr, Eq >::find const T &  oValue,
size_t &  iFirst,
size_t &  iLast
const throw () [inline]
 

Search for the first and last occurence of a given value. If the value is found the first and last indices for the value are returned in iFirst and iLast respectively. If the value is not found these are undefined.

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

Definition at line 1044 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual bool DWFCore::DWFSortedVector< 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 1013 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual const T& DWFCore::DWFSortedVector< 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 958 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
void DWFCore::DWFSortedVector< T, Pr, Eq >::insert const DWFSortedVector< T, Pr, Eq > &  oSortedVector  )  throw () [inline]
 

Insert values from another sorted vector into this vector.

Parameters:
oSortedVector The sorted vector to copy
Exceptions:
None 

Definition at line 915 of file Vector.h.

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

Insert values from an STL vector into this vector.

Parameters:
oVector The STL vector to copy
Exceptions:
None 

Definition at line 902 of file Vector.h.

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

Insert a value into the vector.

Parameters:
oValue The value to insert.
Exceptions:
None 

Definition at line 871 of file Vector.h.

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

Assignment operator for copying

Parameters:
oVector The sorted vector to copy.
Exceptions:
None 

Definition at line 853 of file Vector.h.

template<class T, class Pr = tDWFCompareLess<T>, class Eq = tDWFCompareEqual<T>>
virtual const T& DWFCore::DWFSortedVector< 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 990 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