Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

SortableArray Class Template Reference

A sort-capable variant of the ResizeArray template class. In addition to the methods provided there, this template also allows either quicksorting or insertion sorting of the elements in the array. More...

#include <SortableArray.h>

List of all members.

Public Methods

 SortableArray (int s=10, float rsf=2.0)
 ~SortableArray (void)
int num (void)
 largest number of elements that have been accessed. More...

T & operator[] (int N)
 [] operator version of the item() routine. More...

int append (const T &val)
 add a new element to the end of the array. Return index of new item. More...

T & item (int N)
 return the nth item; assume N is >= 0. More...

void remove (int m=-1, int n=-1)
 remove the Mth ... Nth items: move all items lower in the array up to fill the empty slots. If both arguments are < 0, removes ALL items. If the second argument is < 0, just removes item m. More...

void swap (int i, int j)
 auxilliary function for qsort. More...

void qsort (int left, int right)
 sorts elements based on a specialied field. To change the sort, change the field which is used as a basis for comparison. The '>' and '<' symbols are overloaded. More...

void isort ()
 This is an internal sort. More...


Detailed Description

template<class T>
class SortableArray< T >

A sort-capable variant of the ResizeArray template class. In addition to the methods provided there, this template also allows either quicksorting or insertion sorting of the elements in the array.

Definition at line 33 of file SortableArray.h.


Constructor & Destructor Documentation

template<class T>
SortableArray< T >::SortableArray int    s = 10,
float    rsf = 2.0
[inline]
 

Definition at line 50 of file SortableArray.h.

template<class T>
SortableArray< T >::~SortableArray void    [inline]
 

Definition at line 62 of file SortableArray.h.


Member Function Documentation

template<class T>
int SortableArray< T >::append const T &    val [inline]
 

add a new element to the end of the array. Return index of new item.

Definition at line 82 of file SortableArray.h.

template<class T>
void SortableArray< T >::isort   [inline]
 

This is an internal sort.

Definition at line 170 of file SortableArray.h.

template<class T>
T& SortableArray< T >::item int    N [inline]
 

return the nth item; assume N is >= 0.

Definition at line 88 of file SortableArray.h.

Referenced by SortableArray< DepthSortObject >::append, and SortableArray< DepthSortObject >::operator[].

template<class T>
int SortableArray< T >::num void    [inline]
 

largest number of elements that have been accessed.

Definition at line 72 of file SortableArray.h.

template<class T>
T& SortableArray< T >::operator[] int    N [inline]
 

[] operator version of the item() routine.

Definition at line 79 of file SortableArray.h.

template<class T>
void SortableArray< T >::qsort int    left,
int    right
[inline]
 

sorts elements based on a specialied field. To change the sort, change the field which is used as a basis for comparison. The '>' and '<' symbols are overloaded.

Definition at line 154 of file SortableArray.h.

Referenced by SortableArray< DepthSortObject >::qsort.

template<class T>
void SortableArray< T >::remove int    m = -1,
int    n = -1
[inline]
 

remove the Mth ... Nth items: move all items lower in the array up to fill the empty slots. If both arguments are < 0, removes ALL items. If the second argument is < 0, just removes item m.

Definition at line 124 of file SortableArray.h.

template<class T>
void SortableArray< T >::swap int    i,
int    j
[inline]
 

auxilliary function for qsort.

Definition at line 143 of file SortableArray.h.

Referenced by SortableArray< DepthSortObject >::qsort.


The documentation for this class was generated from the following file:
Generated on Wed Apr 24 02:45:11 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002