1 /* FILE IDENTIFICATION
\r
3 ** File Name: hashtable.h
\r
4 ** Author: Kevin Rosenberg
\r
5 ** Purpose: Header file for hash table library
\r
6 ** Date Started: Dec. 2000
\r
8 ** This is part of the CTSim program
\r
9 ** Copyright (C) 1983-2000 Kevin Rosenberg
\r
11 ** $Id: hashtable.h,v 1.1 2000/12/27 20:09:19 kevin Exp $
\r
14 ** This program is free software; you can redistribute it and/or modify
\r
15 ** it under the terms of the GNU General Public License (version 2) as
\r
16 ** published by the Free Software Foundation.
\r
18 ** This program is distributed in the hope that it will be useful,
\r
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
21 ** GNU General Public License for more details.
\r
23 ** You should have received a copy of the GNU General Public License
\r
24 ** along with this program; if not, write to the Free Software
\r
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
26 ******************************************************************************/
\r
32 class KeywordCodeEntry
\r
35 std::string m_strKeyword;
\r
37 class KeywordCodeEntry *m_pNext;
\r
41 KeywordCodeEntry (const char* const pszKeyword, int iCode);
\r
43 const char* const getKeyword() const
\r
44 { return m_strKeyword.c_str(); }
\r
46 bool matchesKeyword (const char* const pszMatch) const;
\r
48 int getCode () const
\r
51 void setCode (int iCode)
\r
52 { m_iCode = iCode; }
\r
54 void setNext (KeywordCodeEntry* pNext)
\r
55 { m_pNext = pNext; }
\r
57 KeywordCodeEntry* getNext ()
\r
62 class KeywordCodeHashTable {
\r
68 KeywordCodeHashTable()
\r
71 ~KeywordCodeHashTable()
\r
74 void installKeywordCode (const char* const pszKeyword, int iCode);
\r
75 KeywordCodeEntry* lookup (const char* const pszKeyword);
\r
78 KeywordCodeEntry* m_hashTable[HASHSIZE];
\r
80 int hash (const char* s);
\r