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

HashTable Class Reference

#include <hash.h>

Inheritance diagram for HashTable:

Inheritance graph
[legend]
Collaboration diagram for HashTable:

Collaboration graph
[legend]
List of all members.

Public Methods

 HashTable ()
 HashTable (int)
void MakeTable ()
bool IsEmpty ()
void Dump (ostream &)
int AddEntry (char *key, HashValue value, int *index=0)
int AddEntry (bool, char *key, int len, HashValue value, int *index=0)
int AddEntry (char *key, int len, HashValue value, int *index=0)
int AddDupEntry (char *key, int len, HashValue value, int *index=0)
bool Lookup (char *key, HashValue *value)
bool Lookup (char *key, int len, HashValue *value)
bool LookupEntries (char *key, int len, HashValue *value, int &nth)
HashValue Peek (int index)
bool RemoveEntry (char *key)
bool RemoveEntry (char *key, int len)
void ReplaceValue (int index, HashValue value)

Protected Methods

char * KeyString (char *key)
char * KeyString (char *key, int len)
bool Lookup2 (char *key, HashValue *val, int *index)
bool Lookup2 (char *key, int len, HashValue *val, int *index)
bool GrowTable (int increment)
unsigned int StringToInt (char *)
unsigned int StringToInt (char *, int)
int HashFunc (unsigned int p, int n)

Static Protected Methods

uint NextPrimeNumber (uint number)

Protected Attributes

HashTableEntryentries
int Size
int Prime2

Constructor & Destructor Documentation

HashTable::HashTable  
 

Definition at line 52 of file hash.cc.

References MakeTable(), Prime2, and Size.

HashTable::HashTable int    [inline]
 

Definition at line 51 of file hash.h.


Member Function Documentation

int HashTable::AddDupEntry char *    key,
int    len,
HashValue    value,
int *    index = 0
[inline]
 

Definition at line 63 of file hash.h.

References AddEntry(), FALSE, and HashValue.

Referenced by Environment::AddDupEntry(), and GrowTable().

int HashTable::AddEntry char *    key,
int    len,
HashValue    value,
int *    index = 0
[inline]
 

Definition at line 58 of file hash.h.

References AddEntry(), HashValue, and TRUE.

int HashTable::AddEntry bool   ,
char *    key,
int    len,
HashValue    value,
int *    index = 0
 

Definition at line 278 of file hash.cc.

References AddEntry(), entries, GrowTable(), HashFunc(), HashValue, HashTableEntry::key, KeyString(), nil, Size, StringToInt(), and HashTableEntry::value.

int HashTable::AddEntry char *    key,
HashValue    value,
int *    index = 0
 

Definition at line 247 of file hash.cc.

References entries, GrowTable(), HashFunc(), HashValue, HashTableEntry::key, KeyString(), nil, Size, StringToInt(), and HashTableEntry::value.

Referenced by AddDupEntry(), AddEntry(), Environment::AddEntry(), Lex::RecordKeyword(), Environment::RecordPointerVariable(), Environment::RecordUsing(), and Environment::RecordVariable().

void HashTable::Dump ostream &   
 

Definition at line 82 of file hash.cc.

References entries, HashTableEntry::key, nil, and Size.

Referenced by Environment::Dump().

bool HashTable::GrowTable int    increment [protected]
 

Definition at line 216 of file hash.cc.

References AddDupEntry(), entries, HashTableEntry::key, MakeTable(), MopWarningMessage2(), NextPrimeNumber(), nil, Prime2, Size, and TRUE.

Referenced by AddEntry().

int HashTable::HashFunc unsigned int    p,
int    n
[protected]
 

Definition at line 391 of file hash.cc.

References Prime2, and Size.

Referenced by AddEntry(), Lookup2(), and LookupEntries().

bool HashTable::IsEmpty  
 

Definition at line 73 of file hash.cc.

References entries, FALSE, HashTableEntry::key, nil, Size, and TRUE.

Referenced by Environment::IsEmpty().

char * HashTable::KeyString char *    key,
int    len
[protected]
 

Definition at line 99 of file hash.cc.

char * HashTable::KeyString char *    key [protected]
 

Definition at line 93 of file hash.cc.

Referenced by AddEntry().

bool HashTable::Lookup char *    key,
int    len,
HashValue   value
 

Definition at line 112 of file hash.cc.

References HashValue, and Lookup2().

bool HashTable::Lookup char *    key,
HashValue   value
 

Definition at line 106 of file hash.cc.

References HashValue, and Lookup2().

Referenced by Environment::LookupAll(), Environment::LookupTop(), and Lex::Screening().

bool HashTable::Lookup2 char *    key,
int    len,
HashValue   val,
int *    index
[protected]
 

Definition at line 137 of file hash.cc.

References entries, FALSE, HashFunc(), HashValue, HashTableEntry::key, nil, Size, StringToInt(), TRUE, and HashTableEntry::value.

bool HashTable::Lookup2 char *    key,
HashValue   val,
int *    index
[protected]
 

Definition at line 118 of file hash.cc.

References entries, FALSE, HashFunc(), HashValue, HashTableEntry::key, nil, Size, StringToInt(), TRUE, and HashTableEntry::value.

Referenced by Lookup(), and RemoveEntry().

bool HashTable::LookupEntries char *    key,
int    len,
HashValue   value,
int &    nth
 

Definition at line 163 of file hash.cc.

References entries, FALSE, HashFunc(), HashValue, HashTableEntry::key, nil, Size, StringToInt(), TRUE, and HashTableEntry::value.

Referenced by Environment::LookupType().

void HashTable::MakeTable  
 

Definition at line 59 of file hash.cc.

References entries, HashTableEntry::key, nil, and Size.

Referenced by BigHashTable::BigHashTable(), GrowTable(), and HashTable().

uint HashTable::NextPrimeNumber uint    number [static, protected]
 

Definition at line 189 of file hash.cc.

References FALSE, TRUE, and uint.

Referenced by GrowTable().

HashValue HashTable::Peek int    index
 

Definition at line 317 of file hash.cc.

References entries, HashValue, and HashTableEntry::value.

Referenced by Lex::RecordKeyword().

bool HashTable::RemoveEntry char *    key,
int    len
 

Definition at line 343 of file hash.cc.

References entries, FALSE, HashValue, HashTableEntry::key, Lookup2(), and TRUE.

bool HashTable::RemoveEntry char *    key
 

Definition at line 330 of file hash.cc.

References entries, FALSE, HashValue, HashTableEntry::key, Lookup2(), and TRUE.

void HashTable::ReplaceValue int    index,
HashValue    value
 

Definition at line 322 of file hash.cc.

References entries, HashValue, Size, and HashTableEntry::value.

unsigned int HashTable::StringToInt char *   ,
int   
[protected]
 

Definition at line 373 of file hash.cc.

References nil.

unsigned int HashTable::StringToInt char *    [protected]
 

Definition at line 356 of file hash.cc.

References nil.

Referenced by AddEntry(), Lookup2(), and LookupEntries().


Member Data Documentation

HashTableEntry* HashTable::entries [protected]
 

Definition at line 88 of file hash.h.

Referenced by AddEntry(), Dump(), GrowTable(), IsEmpty(), Lookup2(), LookupEntries(), MakeTable(), Peek(), RemoveEntry(), and ReplaceValue().

int HashTable::Prime2 [protected]
 

Definition at line 91 of file hash.h.

Referenced by BigHashTable::BigHashTable(), GrowTable(), HashFunc(), and HashTable().

int HashTable::Size [protected]
 

Definition at line 89 of file hash.h.

Referenced by AddEntry(), BigHashTable::BigHashTable(), Dump(), GrowTable(), HashFunc(), HashTable(), IsEmpty(), Lookup2(), LookupEntries(), MakeTable(), and ReplaceValue().


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 17:35:38 2003 for VFiasco Semantics Compiler by doxygen1.2.15