-/* FILE IDENTIFICATION\r
-**\r
-** File Name: hashtable.h\r
-** Author: Kevin Rosenberg\r
-** Purpose: Header file for hash table library\r
-** Date Started: Dec. 2000\r
-**\r
-** This is part of the CTSim program\r
-** Copyright (C) 1983-2000 Kevin Rosenberg\r
-**\r
-** $Id: hashtable.h,v 1.1 2000/12/27 20:09:19 kevin Exp $\r
-**\r
-**\r
-** This program is free software; you can redistribute it and/or modify\r
-** it under the terms of the GNU General Public License (version 2) as\r
-** published by the Free Software Foundation.\r
-**\r
-** This program is distributed in the hope that it will be useful,\r
-** but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-** GNU General Public License for more details.\r
-**\r
-** You should have received a copy of the GNU General Public License\r
-** along with this program; if not, write to the Free Software\r
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-******************************************************************************/\r
-\r
-#ifndef HASHTABLE_H\r
-#define HASHTABLE_H\r
-\r
-\r
-class KeywordCodeEntry\r
-{\r
-private:\r
- std::string m_strKeyword;\r
- int m_iCode;\r
- class KeywordCodeEntry *m_pNext;\r
- \r
- public:\r
- \r
- KeywordCodeEntry (const char* const pszKeyword, int iCode);\r
- \r
- const char* const getKeyword() const\r
- { return m_strKeyword.c_str(); }\r
-\r
- bool matchesKeyword (const char* const pszMatch) const;\r
-\r
- int getCode () const\r
- { return m_iCode; }\r
- \r
- void setCode (int iCode) \r
- { m_iCode = iCode; }\r
- \r
- void setNext (KeywordCodeEntry* pNext)\r
- { m_pNext = pNext; }\r
- \r
- KeywordCodeEntry* getNext ()\r
- { return m_pNext; }\r
-};\r
-\r
-\r
-class KeywordCodeHashTable {\r
-public:\r
- enum {\r
- HASHSIZE = 100,\r
- };\r
- \r
- KeywordCodeHashTable()\r
- { initTable(); }\r
- \r
- ~KeywordCodeHashTable()\r
- { freeTable(); }\r
- \r
- void installKeywordCode (const char* const pszKeyword, int iCode);\r
- KeywordCodeEntry* lookup (const char* const pszKeyword);\r
- \r
-private:\r
- KeywordCodeEntry* m_hashTable[HASHSIZE];\r
- \r
- int hash (const char* s);\r
- void initTable ();\r
- void freeTable ();\r
-};\r
-\r
-#endif\r
-\r
-\r
+/* FILE IDENTIFICATION
+**
+** File Name: hashtable.h
+** Author: Kevin Rosenberg
+** Purpose: Header file for hash table library
+** Date Started: Dec. 2000
+**
+** This is part of the CTSim program
+** Copyright (c) 1983-2001 Kevin Rosenberg
+**
+** $Id: hashtable.h,v 1.3 2001/01/28 19:10:18 kevin Exp $
+**
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License (version 2) as
+** published by the Free Software Foundation.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+******************************************************************************/
+
+#ifndef HASHTABLE_H
+#define HASHTABLE_H
+
+
+class KeywordCodeEntry
+{
+private:
+ std::string m_strKeyword;
+ int m_iCode;
+ class KeywordCodeEntry *m_pNext;
+
+ public:
+
+ KeywordCodeEntry (const char* const pszKeyword, int iCode);
+
+ const char* const getKeyword() const
+ { return m_strKeyword.c_str(); }
+
+ bool matchesKeyword (const char* const pszMatch) const;
+
+ int getCode () const
+ { return m_iCode; }
+
+ void setCode (int iCode)
+ { m_iCode = iCode; }
+
+ void setNext (KeywordCodeEntry* pNext)
+ { m_pNext = pNext; }
+
+ KeywordCodeEntry* getNext ()
+ { return m_pNext; }
+};
+
+
+class KeywordCodeHashTable {
+public:
+ enum {
+ HASHSIZE = 100,
+ };
+
+ KeywordCodeHashTable()
+ { initTable(); }
+
+ ~KeywordCodeHashTable()
+ { freeTable(); }
+
+ void installKeywordCode (const char* const pszKeyword, int iCode);
+ KeywordCodeEntry* lookup (const char* const pszKeyword);
+
+private:
+ KeywordCodeEntry* m_hashTable[HASHSIZE];
+
+ int hash (const char* s);
+ void initTable ();
+ void freeTable ();
+};
+
+#endif
+
+