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

GLIBHash< Key, ConfigData > Class Template Reference

An templated hash class. More...

#include <GLIBHash.h>

Inheritance diagram for GLIBHash< Key, ConfigData >:

AGenericHash< Key, ConfigData > List of all members.

Public Member Functions

 GLIBHash (int SizeWanted, ACompareNodesAlgorithm< Key, ConfigData > *Compare, AHashAlgorithm< Key > *Hash, DeleteHashDataEnum DeleteHashData=NO_DELETE_HASH_ITEM)
 Constructor.
virtual ~GLIBHash ()
 Destructor.
virtual Key * Insert (Key *key, bool OptimizeForCaching)
 Insert a value. Don't add if already there.
void Remove (Key *key)
 Delete a node from the table.
int Lookup (Key *key)
 Find a data item and return its hash value.
bool LookupExtended (Key *LookupKey, Key **OriginalKey, int **Value)
 Find a data item and get all the information about it.
void Freeze ()
 Prevent the hash table from resizing.
void Thaw ()
 Allow the hash table to resize.
void Resize ()
 Resize the hash table.
void ForEach (AProcessHashAlgorithm< Key, ConfigData > *ProcessFunc, ConfigData *UserData)
 Perform an action on all the entries in the hash table.
unsigned int ForEachRemove (RemoveHashAlgorithm< Key, ConfigData > *RemoveFunc, ConfigData *configData)
 Perform an action on all the entries in the hash table before removing them.
int GetSize ()
 Number of Entries in the hash table.

Protected Member Functions

void Insert (Key *key, int Value)
 Insert a value. Don't add if already there.
GLIBHashNode< Key > ** LookupNode (Key *key)
 Find a data item and return the hash entry.

Private Attributes

unsigned int m_Frozen
 Determines whether or not to grow the hash table.
GLIBHashNode< Key > ** m_Nodes
 Nodes in the hash table.

Detailed Description

template<class Key, class ConfigData>
class GLIBHash< Key, ConfigData >

This class is based off of the GLIB implementation of a hash table written in C

Definition at line 82 of file GLIBHash.h.


Member Function Documentation

template<class Key, class ConfigData>
void GLIBHash< Key, ConfigData >::ForEach AProcessHashAlgorithm< Key, ConfigData > *  ProcessFunc,
ConfigData *  UserData
 

Parameters:
ProcessFunc is the action to be performed
UserData is any extra information needed to perform the action

Definition at line 302 of file GLIBHash.h.

References GLIBHashNode< Key >::m_Key, GLIBHashNode< Key >::m_Next, GLIBHash< Key, ConfigData >::m_Nodes, AGenericHash< Key, ConfigData >::m_Size, GLIBHashNode< Key >::m_Value, and AProcessHashAlgorithm< Key, ConfigData >::ProcessHash().

template<class Key, class ConfigData>
unsigned int GLIBHash< Key, ConfigData >::ForEachRemove RemoveHashAlgorithm< Key, ConfigData > *  RemoveFunc,
ConfigData *  configData
 

Parameters:
ProcessFunc is the action to be performed
UserData is any extra information needed to perform the action

Definition at line 312 of file GLIBHash.h.

References GLIBHash< Key, ConfigData >::m_Frozen, GLIBHashNode< Key >::m_Key, GLIBHashNode< Key >::m_Next, GLIBHash< Key, ConfigData >::m_Nodes, AGenericHash< Key, ConfigData >::m_NumberOfElements, AGenericHash< Key, ConfigData >::m_Size, GLIBHashNode< Key >::m_Value, RemoveHashAlgorithm< Key, ConfigData >::ProcessHash(), and GLIBHash< Key, ConfigData >::Resize().

template<class Key, class ConfigData>
void GLIBHash< Key, ConfigData >::Insert Key *  key,
int  Value
[protected]
 

Parameters:
key is the data being inserted
Value is the hash value of the data

Definition at line 196 of file GLIBHash.h.

References GLIBHash< Key, ConfigData >::LookupNode(), AGenericHash< Key, ConfigData >::m_DeleteHashData, GLIBHash< Key, ConfigData >::m_Frozen, AGenericHash< Key, ConfigData >::m_NumberOfElements, and GLIBHash< Key, ConfigData >::Resize().

template<class Key, class ConfigData>
Key * GLIBHash< Key, ConfigData >::Insert Key *  key,
bool  OptimizeForCaching
[virtual]
 

Parameters:
key is the value being inserted
OptimizeForCaching is a flag for caching optimization
Returns:
A pointer to the value inserted/found

Implements AGenericHash< Key, ConfigData >.

Definition at line 183 of file GLIBHash.h.

References GLIBHash< Key, ConfigData >::LookupNode(), and AGenericHash< Key, ConfigData >::m_Hash.

template<class Key, class ConfigData>
int GLIBHash< Key, ConfigData >::Lookup Key *  key  ) 
 

Parameters:
key is the data being searched for.
Returns:
Hash value of the data.

Definition at line 228 of file GLIBHash.h.

References GLIBHash< Key, ConfigData >::LookupNode(), and GLIBHashNode< Key >::m_Value.

template<class Key, class ConfigData>
bool GLIBHash< Key, ConfigData >::LookupExtended Key *  LookupKey,
Key **  OriginalKey,
int **  Value
 

Parameters:
LookupKey is the key being searched for
OriginalKey is the key found and returned
Value is the hash value returned
Returns:
Whether or not the key was found

Definition at line 236 of file GLIBHash.h.

References GLIBHash< Key, ConfigData >::LookupNode(), GLIBHashNode< Key >::m_Key, and GLIBHashNode< Key >::m_Value.

template<class Key, class ConfigData>
GLIBHashNode< Key > ** GLIBHash< Key, ConfigData >::LookupNode Key *  key  )  [protected]
 

Parameters:
key is the data being searched for.
Returns:
Hash entry.

Definition at line 358 of file GLIBHash.h.

References ACompareNodesAlgorithm< Data, ConfigData >::Compare(), AGenericHash< Key, ConfigData >::m_Compare, AGenericHash< Key, ConfigData >::m_Hash, GLIBHashNode< Key >::m_Key, GLIBHashNode< Key >::m_Next, GLIBHash< Key, ConfigData >::m_Nodes, and AGenericHash< Key, ConfigData >::m_Size.

Referenced by GLIBHash< Key, ConfigData >::Insert(), GLIBHash< Key, ConfigData >::Lookup(), GLIBHash< Key, ConfigData >::LookupExtended(), and GLIBHash< Key, ConfigData >::Remove().

template<class Key, class ConfigData>
void GLIBHash< Key, ConfigData >::Remove Key *  key  ) 
 

Parameters:
key is the hash value of the data.

Definition at line 210 of file GLIBHash.h.

References GLIBHash< Key, ConfigData >::LookupNode(), GLIBHash< Key, ConfigData >::m_Frozen, GLIBHashNode< Key >::m_Next, AGenericHash< Key, ConfigData >::m_NumberOfElements, and GLIBHash< Key, ConfigData >::Resize().


The documentation for this class was generated from the following file:
Generated on Sat Nov 5 11:20:17 2005 for Cpp Freecell Solver by  doxygen 1.4.4