#include <keyarray.h>
Public Member Functions | |
KeyArray (int num) | |
KeyArray (int num, int Grow) | |
~KeyArray () | |
void | Add (int key, const Type &e) |
bool | Find (int key, Type &e) |
bool | FindPtr (int key, Type *&e) |
void | Rem (int key) |
void | RemByIndex (int index) |
int | Size () const |
Type & | GetElementAt (int index) const |
int | GetKeyAt (int index) const |
void | Clear () |
Private Member Functions | |
void | Alloc (int num) |
void | Grow () |
KeyElement * | Find (int key) |
Private Attributes | |
int | elements_count |
int | max_elements |
int | grow_elements |
KeyElement * | cur_element |
KeyElement * | elements |
Classes | |
struct | KeyElement |
Constructor for non-growable array.
Constructor for growable array.
void KeyArray< Type >::Add | ( | int | key, | |
const Type & | e | |||
) | [inline] |
Adds key/element pair to array.
bool KeyArray< Type >::Find | ( | int | key, | |
Type & | e | |||
) | [inline] |
Finds element associated with given key.
bool KeyArray< Type >::FindPtr | ( | int | key, | |
Type *& | e | |||
) | [inline] |
Finds pointer to element associated with key.
void KeyArray< Type >::Rem | ( | int | key | ) | [inline] |
Removes element defined by key.
void KeyArray< Type >::RemByIndex | ( | int | index | ) | [inline] |
Removes element defined by key index.
int KeyArray< Type >::Size | ( | ) | const [inline] |
Returns number of elements.
Type & KeyArray< Type >::GetElementAt | ( | int | index | ) | const [inline] |
Gets element at index.
int KeyArray< Type >::GetKeyAt | ( | int | index | ) | const [inline] |
Gets key at index.
void KeyArray< Type >::Clear | ( | ) | [inline] |
Clear the array without deallocating memory.
void KeyArray< Type >::Alloc | ( | int | num | ) | [inline, private] |
Allocates array.
void KeyArray< Type >::Grow | ( | ) | [inline, private] |
Grows array.
KeyArray< Type >::KeyElement * KeyArray< Type >::Find | ( | int | key | ) | [inline, private] |
Binary search.
int KeyArray< Type >::elements_count [private] |
int KeyArray< Type >::max_elements [private] |
int KeyArray< Type >::grow_elements [private] |
KeyElement* KeyArray< Type >::cur_element [private] |
KeyElement* KeyArray< Type >::elements [private] |