TemplateXFcHashtable< Key, Value > class Reference

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XFcHashtable< Key, Value > Class Template Reference

Hashtable template class. More...

Inheritance diagram for XFcHashtable< Key, Value >:

[legend]
Collaboration diagram for XFcHashtable< Key, Value >:

[legend]
List of all members.

## Public Types

typedef XFcHashtableIterator< Key, Value > | iterator
| Iterator type.

## Public Member Functions

iterator | begin ()
| Returns an iterator pointing to the first key.
iterator | end ()
| Returns an iterator pointing to the last key.
UINT32 | size () const
| Returns the amount of elements.
Value | put (const Key aKey, const Value aValue)
| Puts a new key-value pair in the hashtable.
Value | get (const Key aKey)
| Gets the value for a key from the hashtable.
iterator | find (const Key aKey)
| Finds the key-value pair from the hashtable with a given key.
INT | remove (const Key aKey)
| Removes a key-value pair from the hashtable.
INT | remove (iterator &aIterator)
| Removes a key-value pair by iterator.
| XFcHashtable ()
| Creates an empty hashtable.
| XFcHashtable (const INT32 aBucketCount)
| Creates an empty hashtable with specified amount of buckets.
| ~XFcHashtable ()
| Destructor.

## Protected Member Functions

XFcLinkedList< XFcHashtableNode< Key, Value > * >::forwardIterator | findFirst ()
| Finds the first entry.

## Protected Attributes

XFcHashtableHash< Key > | _hasher_function
| Hasher function for the key type.
XFcHashtableEQ< Key > | _equals_function
| Equality checking function for the key type.
UINT32 | mElements
| Number of keys/values in hashtable.
INT32 | mBuckets
| Number of buckets.
XFcLinkedList< XFcHashtableNode< Key, Value > * > ** | mTable
| Hashtable.

## Friends

class | XFcHashtableIterator< Key, Value >

## Detailed Description

### template<class Key, class Value>
class XFcHashtable< Key, Value >

Hashtable template class.

See also:
  XFuConfiguration

## Member Typedef Documentation

template<class Key, class Value>
typedef XFcHashtableIterator<Key, Value> XFcHashtable< Key, Value >::iterator

| Iterator type.

## Constructor & Destructor Documentation

template<class Key, class Value>
XFcHashtable< Key, Value >::XFcHashtable | ( |  | ) |

| Creates an empty hashtable.

template<class Key, class Value>
XFcHashtable< Key, Value >::XFcHashtable | ( | const INT32 | aBucketCount | ) |

Creates an empty hashtable with specified amount of buckets.

Parameters:

  aBucketCount | amount of buckets for the hashtable.

template<class Key, class Value>
XFcHashtable< Key, Value >::~XFcHashtable | ( |  | ) |

| Destructor.

## Member Function Documentation

template<class Key, class Value>
XFcHashtable< Key, Value >::iterator XFcHashtable< Key, Value >::begin | ( |  | ) |

| Returns an iterator pointing to the first key.

template<class Key, class Value>
XFcHashtable< Key, Value >::iterator XFcHashtable< Key, Value >::end | ( |  | ) |

| Returns an iterator pointing to the last key.

template<class Key, class Value>
XFcHashtable< Key, Value >::iterator XFcHashtable< Key, Value >::find | ( | const Key | aKey | ) |

Finds the key-value pair from the hashtable with a given key.

Parameters:

  aKey | key to get the pair by.

Returns:
  iterator pointing to the requested pair.

template<class Key, class Value>
XFcLinkedList< XFcHashtableNode< Key, Value > * >::forwardIterator XFcHashtable< Key, Value >::findFirst | ( |  | ) | `[protected]`

| Finds the first entry.

template<class Key, class Value>
Value XFcHashtable< Key, Value >::get | ( | const Key | aKey | ) |

Gets the value for a key from the hashtable.

Parameters:

  aKey | key to get the value for.

Returns:
  value corresponding the requested key.

template<class Key, class Value>
Value XFcHashtable< Key, Value >::put | ( | const Key | aKey,
|  | const Value | aValue
| ) |

Puts a new key-value pair in the hashtable.

Parameters:

  aKey | key for the new pair.
  aValue | value for the new pair.

Returns:
  value of the new pair.

template<class Key, class Value>
INT XFcHashtable< Key, Value >::remove | ( | iterator & | aIterator | ) |

Removes a key-value pair by iterator.

Parameters:

  aIterator | iterator pointing to the pair to be removed.

Returns:
  1 if the removal was successful, 0 otherwise.

template<class Key, class Value>
INT XFcHashtable< Key, Value >::remove | ( | const Key | aKey | ) |

Removes a key-value pair from the hashtable.

Parameters:

  aKey | key of the pair to remove.

Returns:
  1 if removal was successful, 0 otherwise.

template<class Key, class Value>
UINT32 XFcHashtable< Key, Value >::size | ( |  | ) | const

| Returns the amount of elements.

## Friends And Related Function Documentation

template<class Key, class Value>
friend class XFcHashtableIterator< Key, Value >`[friend]`

## Member Data Documentation

template<class Key, class Value>
XFcHashtableEQ<Key> XFcHashtable< Key, Value >::_equals_function`[protected]`

| Equality checking function for the key type.

template<class Key, class Value>
XFcHashtableHash<Key> XFcHashtable< Key, Value >::_hasher_function`[protected]`

| Hasher function for the key type.

template<class Key, class Value>
INT32 XFcHashtable< Key, Value >::mBuckets`[protected]`

| Number of buckets.

template<class Key, class Value>
UINT32 XFcHashtable< Key, Value >::mElements`[protected]`

| Number of keys/values in hashtable.

template<class Key, class Value>
XFcLinkedList<XFcHashtableNode<Key, Value> *>** XFcHashtable< Key, Value >::mTable`[protected]`

| Hashtable.

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch