ucc::keymap< T, M > Class Template Reference

A templated class for a hash map. More...

#include <linked.h>

Collaboration diagram for ucc::keymap< T, M >:
Collaboration graph
[legend]

Public Member Functions

void add (char *name, T *object)
 Add a typed object derived from NamedObject to the hash map by name.
void add (char *name, T &object)
 Add a typed object derived from NamedObject to the hash map by name.
T * begin (void)
 Find first typed object in hash map to iterate.
unsigned count (void)
 Count the number of typed objects in our hash map.
T * get (char *name)
 Find a typed object derived from NamedObject in the hash map by name.
T ** index (void)
 Convert our hash map into a linear object pointer array.
unsigned limit (void)
 Retreive key size to use in NamedObject constructors.
T * next (T *current)
 Find next typed object in hash map for iteration.
T * operator[] (char *name)
 Find a typed object derived from NamedObject in the hash map by name.
T * remove (char *name)
 Remove a typed object derived from NamedObject to the hash map by name.
NamedObject ** root (void)
 Retrieve root of index to use in NamedObject constructors.
T ** sort (void)
 Convert our hash map into an alphabetically sorted linear object pointer array.
 ~keymap ()
 Destroy the hash map by puring the index chains.

Detailed Description

template<class T, unsigned M = 177>
class ucc::keymap< T, M >

A templated class for a hash map.

This provides a has map index object as a chain of keyindex selected linked pointers of a specified size. This is used for the index and size values for NamedObject's which are listed on a hash map.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 1712 of file linked.h.


Member Function Documentation

template<class T , unsigned M = 177>
void ucc::keymap< T, M >::add ( char *  name,
T *  object 
) [inline]

Add a typed object derived from NamedObject to the hash map by name.

Parameters:
name to add.
object to add.

Definition at line 1767 of file linked.h.

template<class T , unsigned M = 177>
void ucc::keymap< T, M >::add ( char *  name,
T &  object 
) [inline]

Add a typed object derived from NamedObject to the hash map by name.

Parameters:
name to add.
object to add.

Definition at line 1759 of file linked.h.

template<class T , unsigned M = 177>
T* ucc::keymap< T, M >::begin ( void   )  [inline]

Find first typed object in hash map to iterate.

Returns:
first typed object or NULL if nothing in list.

Definition at line 1782 of file linked.h.

template<class T , unsigned M = 177>
unsigned ucc::keymap< T, M >::count ( void   )  [inline]

Count the number of typed objects in our hash map.

Returns:
count of typed objects.

Definition at line 1797 of file linked.h.

template<class T , unsigned M = 177>
T* ucc::keymap< T, M >::get ( char *  name  )  [inline]

Find a typed object derived from NamedObject in the hash map by name.

Parameters:
name to search for.
Returns:
typed object if found through map or NULL.

Definition at line 1743 of file linked.h.

template<class T , unsigned M = 177>
T** ucc::keymap< T, M >::index ( void   )  [inline]

Convert our hash map into a linear object pointer array.

The object pointer array is created from the heap and must be deleted when no longer used.

Returns:
array of typed named object pointers.

Definition at line 1806 of file linked.h.

template<class T , unsigned M = 177>
unsigned ucc::keymap< T, M >::limit ( void   )  [inline]

Retreive key size to use in NamedObject constructors.

Returns:
key size of hash map.

Definition at line 1735 of file linked.h.

template<class T , unsigned M = 177>
T* ucc::keymap< T, M >::next ( T *  current  )  [inline]

Find next typed object in hash map for iteration.

Parameters:
current typed object we are referencing.
Returns:
next iterative object or NULL if past end of map.

Definition at line 1790 of file linked.h.

template<class T , unsigned M = 177>
T* ucc::keymap< T, M >::operator[] ( char *  name  )  [inline]

Find a typed object derived from NamedObject in the hash map by name.

Parameters:
name to search for.
Returns:
typed object if found through map or NULL.

Definition at line 1751 of file linked.h.

template<class T , unsigned M = 177>
T* ucc::keymap< T, M >::remove ( char *  name  )  [inline]

Remove a typed object derived from NamedObject to the hash map by name.

Parameters:
name to remove.
Returns:
object removed if found or NULL.

Definition at line 1775 of file linked.h.

Here is the call graph for this function:

template<class T , unsigned M = 177>
NamedObject** ucc::keymap< T, M >::root ( void   )  [inline]

Retrieve root of index to use in NamedObject constructors.

Returns:
root node of index.

Definition at line 1728 of file linked.h.

template<class T , unsigned M = 177>
T** ucc::keymap< T, M >::sort ( void   )  [inline]

Convert our hash map into an alphabetically sorted linear object pointer array.

The object pointer array is created from the heap and must be deleted when no longer used.

Returns:
sorted array of typed named object pointers.

Definition at line 1815 of file linked.h.


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208