Sorted array. More...
#include <SgSortedArray.h>
Public Member Functions | |
SgSortedArray () | |
void | AddItem (T elt, K key) |
void | SetToMin (T elt, K key) |
void | SetToMax (T elt, K key) |
void | SetTo (T elt, K key) |
void | ReduceSizeTo (int newSize) |
void | SortMaximize () |
void | SortMinimize () |
void | GetElements (SgVector< T > *listOfElts) const |
void | GetKeys (SgVector< K > *listOfKeys) const |
T | operator[] (int index) const |
K | GetKey (int index) const |
int | Size () const |
bool | IsEmpty () const |
bool | NonEmpty () const |
bool | IsFull () const |
Private Member Functions | |
SgSortedArray (const SgSortedArray &) | |
not implemented | |
SgSortedArray & | operator= (const SgSortedArray &) |
not implemented | |
Private Attributes | |
int | m_numElt |
T | m_elt [size] |
K | m_key [size] |
Sorted array.
Implements an array of type T
elements that can be sorted by keys of type K
. Class K
needs to support comparison. Class T
currently needs to be a simple type.
Definition at line 19 of file SgSortedArray.h.
SgSortedArray< T, K, size >::SgSortedArray | ( | ) |
Definition at line 22 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_numElt.
SgSortedArray< T, K, size >::SgSortedArray | ( | const SgSortedArray< T, K, size > & | ) | [private] |
not implemented
void SgSortedArray< T, K, size >::AddItem | ( | T | elt, | |
K | key | |||
) |
Definition at line 27 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_elt, SgSortedArray< T, K, size >::m_key, SgSortedArray< T, K, size >::m_numElt, and SG_ASSERT.
Referenced by SgSortedArray< T, K, size >::SetTo(), SgSortedArray< T, K, size >::SetToMax(), and SgSortedArray< T, K, size >::SetToMin().
void SgSortedArray< T, K, size >::GetElements | ( | SgVector< T > * | listOfElts | ) | const |
Definition at line 119 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_elt, SgSortedArray< T, K, size >::m_numElt, and SgVector< T >::SetTo().
K SgSortedArray< T, K, size >::GetKey | ( | int | index | ) | const |
Definition at line 134 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_key.
void SgSortedArray< T, K, size >::GetKeys | ( | SgVector< K > * | listOfKeys | ) | const |
Definition at line 124 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_key, SgSortedArray< T, K, size >::m_numElt, and SgVector< T >::SetTo().
bool SgSortedArray< T, K, size >::IsEmpty | ( | ) | const |
Definition at line 144 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_numElt.
bool SgSortedArray< T, K, size >::IsFull | ( | ) | const |
Definition at line 154 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_numElt.
bool SgSortedArray< T, K, size >::NonEmpty | ( | ) | const |
Definition at line 149 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_numElt.
SgSortedArray& SgSortedArray< T, K, size >::operator= | ( | const SgSortedArray< T, K, size > & | ) | [private] |
not implemented
T SgSortedArray< T, K, size >::operator[] | ( | int | index | ) | const |
Definition at line 129 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_elt.
void SgSortedArray< T, K, size >::ReduceSizeTo | ( | int | newSize | ) |
Definition at line 75 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_numElt, and SG_ASSERT.
void SgSortedArray< T, K, size >::SetTo | ( | T | elt, | |
K | key | |||
) |
Definition at line 62 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::AddItem(), SgSortedArray< T, K, size >::m_elt, SgSortedArray< T, K, size >::m_key, and SgSortedArray< T, K, size >::m_numElt.
void SgSortedArray< T, K, size >::SetToMax | ( | T | elt, | |
K | key | |||
) |
Definition at line 48 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::AddItem(), SgSortedArray< T, K, size >::m_elt, SgSortedArray< T, K, size >::m_key, and SgSortedArray< T, K, size >::m_numElt.
void SgSortedArray< T, K, size >::SetToMin | ( | T | elt, | |
K | key | |||
) |
Definition at line 35 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::AddItem(), SgSortedArray< T, K, size >::m_elt, SgSortedArray< T, K, size >::m_key, and SgSortedArray< T, K, size >::m_numElt.
int SgSortedArray< T, K, size >::Size | ( | ) | const |
Definition at line 139 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_numElt.
void SgSortedArray< T, K, size >::SortMaximize | ( | ) |
Definition at line 81 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_elt, SgSortedArray< T, K, size >::m_key, and SgSortedArray< T, K, size >::m_numElt.
void SgSortedArray< T, K, size >::SortMinimize | ( | ) |
Definition at line 100 of file SgSortedArray.h.
References SgSortedArray< T, K, size >::m_elt, SgSortedArray< T, K, size >::m_key, and SgSortedArray< T, K, size >::m_numElt.
T SgSortedArray< T, K, size >::m_elt[size] [private] |
Definition at line 162 of file SgSortedArray.h.
Referenced by SgSortedArray< T, K, size >::AddItem(), SgSortedArray< T, K, size >::GetElements(), SgSortedArray< T, K, size >::operator[](), SgSortedArray< T, K, size >::SetTo(), SgSortedArray< T, K, size >::SetToMax(), SgSortedArray< T, K, size >::SetToMin(), SgSortedArray< T, K, size >::SortMaximize(), and SgSortedArray< T, K, size >::SortMinimize().
K SgSortedArray< T, K, size >::m_key[size] [private] |
Definition at line 164 of file SgSortedArray.h.
Referenced by SgSortedArray< T, K, size >::AddItem(), SgSortedArray< T, K, size >::GetKey(), SgSortedArray< T, K, size >::GetKeys(), SgSortedArray< T, K, size >::SetTo(), SgSortedArray< T, K, size >::SetToMax(), SgSortedArray< T, K, size >::SetToMin(), SgSortedArray< T, K, size >::SortMaximize(), and SgSortedArray< T, K, size >::SortMinimize().
int SgSortedArray< T, K, size >::m_numElt [private] |
Definition at line 160 of file SgSortedArray.h.
Referenced by SgSortedArray< T, K, size >::AddItem(), SgSortedArray< T, K, size >::GetElements(), SgSortedArray< T, K, size >::GetKeys(), SgSortedArray< T, K, size >::IsEmpty(), SgSortedArray< T, K, size >::IsFull(), SgSortedArray< T, K, size >::NonEmpty(), SgSortedArray< T, K, size >::ReduceSizeTo(), SgSortedArray< T, K, size >::SetTo(), SgSortedArray< T, K, size >::SetToMax(), SgSortedArray< T, K, size >::SetToMin(), SgSortedArray< T, K, size >::SgSortedArray(), SgSortedArray< T, K, size >::Size(), SgSortedArray< T, K, size >::SortMaximize(), and SgSortedArray< T, K, size >::SortMinimize().