Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

GHashTable Class Reference

General hash table container for O(1) access to table data. More...

#include <GContainers.h>

List of all members.

Public Member Functions

 GHashTable (int Size=0, bool Case=true)
 Constructs the hash table.
 GHashTable (List< char > &strs)
 Constructs the hash table.
virtual ~GHashTable ()
 Deletes the hash table removing all contents from memory.
void Set (List< char > &strs)
 Sets the hash table contents to the list of strings.
int64 GetSize ()
 Gets the total available entries.
void SetSize (int64 s)
 Sets the total available entries.
bool GetStringPool ()
 Gets the string pooling setting.
void SetStringPool (bool b)
bool IsCase ()
 Returns whether the keys are case sensitive.
void IsCase (bool c)
 Sets whether the keys are case sensitive.
bool IsOk ()
 Returns true if the object appears to be valid.
int Length ()
 Gets the number of entries used.
bool Add (char *Key, void *Value=(void *) 1)
 Adds a value under a given key.
bool Delete (char *Key)
 Deletes a value at 'key'.
void * Find (char *Key)
 Returns the value at 'key'.
void * First (char **Key=0)
 Returns the first value.
void * Current (char **Key=0)
 Returns the current value.
void * Next (char **Key=0)
 Returns the next value.
void Empty ()
 Removes all key/value pairs from memory.


Detailed Description

General hash table container for O(1) access to table data.


Constructor & Destructor Documentation

GHashTable::GHashTable int  Size = 0,
bool  Case = true
 

Constructs the hash table.

Parameters:
size  Sets the initial table size. Should be 2x your data set.
Case  Sets the case sensitivity of the keys.

GHashTable::GHashTable List< char > &  strs  ) 
 

Constructs the hash table.

Parameters:
strs  List of strings to initialize the hash table with


Member Function Documentation

bool GHashTable::Add char *  Key,
void *  Value = (void *) 1
 

Adds a value under a given key.

Parameters:
Key  The key to insert the value under
Value  The value to insert

bool GHashTable::Delete char *  Key  ) 
 

Deletes a value at 'key'.

Parameters:
Key  The key of the value to delete

void GHashTable::Set List< char > &  strs  ) 
 

Sets the hash table contents to the list of strings.

Parameters:
strs  The new contents

void GHashTable::SetStringPool bool  b  ) 
 

Sets the string pooling setting. String pooling lowers the number of memory allocs/frees but will waste memory if you delete keys. Good for fairly large static tables.


The documentation for this class was generated from the following files:
Generated on Wed Oct 26 14:46:59 2005 for Lgi by  doxygen 1.4.1