CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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=53)
 Constructor.

virtual ~csHashMap ()
 Destructor.

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

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

void Delete (csHashKey key, csHashObject object)
 Delete the given key/object from the map.

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

void DeleteAll ()
 Delete all objects from this map.

void DumpStats ()
 Dump statistics about bucket quality.


Detailed Description

This is a general hashmap.

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

Definition at line 195 of file hashmap.h.


Constructor & Destructor Documentation

csHashMap::csHashMap uint32    size = 53
 

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.

virtual csHashMap::~csHashMap   [virtual]
 

Destructor.

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


Member Function Documentation

void csHashMap::Delete csHashKey    key,
csHashObject    object
 

Delete the given key/object from the map.

This function will only delete the object once. If multiple 'Put''s are done with the same object then this function will only delete one of them.

void csHashMap::DeleteAll  
 

Delete all objects from this map.

void csHashMap::DeleteAll csHashKey    key
 

Delete all objects from this map with a given key.

void csHashMap::DumpStats  
 

Dump statistics about bucket quality.

csHashObject csHashMap::Get csHashKey    key const
 

Get an object from this map.

Returns 0 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.

Reimplemented in csHashMapReversible.

Referenced by csHashMapReversible::Get().

void csHashMap::Put csHashKey    key,
csHashObject    object
 

Put an object in this map.

Use the csHashCompute() function to get a pseudo-unique numeric key from a string.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18