KeyArray< Type > Class Template Reference
[Kernel Module]

#include <keyarray.h>

List of all members.


Detailed Description

template<class Type>
class KeyArray< Type >

Implements growable array of key-data pairs. The array is kept sorted for fast Find() by key.

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 ()
KeyElementFind (int key)

Private Attributes

int elements_count
int max_elements
int grow_elements
KeyElementcur_element
KeyElementelements

Classes

struct  KeyElement

Constructor & Destructor Documentation

template<class Type>
KeyArray< Type >::KeyArray ( int  num  )  [inline]

Constructor for non-growable array.

template<class Type>
KeyArray< Type >::KeyArray ( int  num,
int  Grow 
) [inline]

Constructor for growable array.

template<class Type>
KeyArray< Type >::~KeyArray (  )  [inline]

Destructor.


Member Function Documentation

template<class Type>
void KeyArray< Type >::Add ( int  key,
const Type &  e 
) [inline]

Adds key/element pair to array.

template<class Type>
bool KeyArray< Type >::Find ( int  key,
Type &  e 
) [inline]

Finds element associated with given key.

template<class Type>
bool KeyArray< Type >::FindPtr ( int  key,
Type *&  e 
) [inline]

Finds pointer to element associated with key.

template<class Type>
void KeyArray< Type >::Rem ( int  key  )  [inline]

Removes element defined by key.

template<class Type>
void KeyArray< Type >::RemByIndex ( int  index  )  [inline]

Removes element defined by key index.

template<class Type>
int KeyArray< Type >::Size (  )  const [inline]

Returns number of elements.

template<class Type>
Type & KeyArray< Type >::GetElementAt ( int  index  )  const [inline]

Gets element at index.

template<class Type>
int KeyArray< Type >::GetKeyAt ( int  index  )  const [inline]

Gets key at index.

template<class Type>
void KeyArray< Type >::Clear (  )  [inline]

Clear the array without deallocating memory.

template<class Type>
void KeyArray< Type >::Alloc ( int  num  )  [inline, private]

Allocates array.

template<class Type>
void KeyArray< Type >::Grow (  )  [inline, private]

Grows array.

template<class Type>
KeyArray< Type >::KeyElement * KeyArray< Type >::Find ( int  key  )  [inline, private]

Binary search.


Member Data Documentation

template<class Type>
int KeyArray< Type >::elements_count [private]

template<class Type>
int KeyArray< Type >::max_elements [private]

template<class Type>
int KeyArray< Type >::grow_elements [private]

template<class Type>
KeyElement* KeyArray< Type >::cur_element [private]

template<class Type>
KeyElement* KeyArray< Type >::elements [private]


The documentation for this class was generated from the following file:
Generated on Sat Oct 20 14:47:32 2007 for Dark Oberon by  doxygen 1.5.3