Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csHashMap Class Reference

This is a general hashmap. More...

#include <hashmap.h>

Inheritance diagram for csHashMap:

csHashMapReversible List of all members.

Public Methods

 csHashMap (uint32 size=211)
 Constructor. More...

virtual ~csHashMap ()
 Destructor. More...

void Put (csHashKey key, csHashObject object)
 Put an object in this map.

csHashObject Get (csHashKey key) const
 Get an object from this map. More...

void DeleteAll (csHashKey key)
 Delete all objects from this map with a given key.

void DeleteAll ()
 Delete all objects from this map.


Friends

class  csHashIterator
class  csHashMapReversible

Detailed Description

This is a general hashmap.

You can put elements in this map using a key. Keys must not be unique. If a key is not unique then you can iterate over all elements with the same key.


Constructor & Destructor Documentation

csHashMap::csHashMap ( uint32 size = 211 )
 

Constructor.

The parameter for the constructor is the initial size of the hashtable. The best sizes are prime.
Here are a few useful primes: 127, 211, 431, 701, 1201, 1559, 3541, 8087, 12263, 25247, 36923, 50119, 70951, 90313, 104707, ... For a bigger list go to www.utm.edu/research/primes. The map will grow dynamically if needed (@@ Not implemented yet).

csHashMap::~csHashMap ( ) [virtual]
 

Destructor.

The objects referenced too in this hash table will not be destroyed.


Member Function Documentation

csHashObject csHashMap::Get ( csHashKey key ) const
 

Get an object from this map.

Returns NULL if object is not there. If there are multiple elements with the same key then a random one will be returned. Use an iterator to iterate over all elements with the same key.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000