X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Fhashtable.h;h=a46652307812edf24d4349558ca97954be076388;hp=5c84b01700d4da13e8d727995935dbd239e69707;hb=f13a8c004b8f182b42d9e4df2bcd7c7f030bf1ad;hpb=9f29c8b32c972db1178d6f8551d5cd57ceb67083 diff --git a/include/hashtable.h b/include/hashtable.h index 5c84b01..a466523 100644 --- a/include/hashtable.h +++ b/include/hashtable.h @@ -1,15 +1,12 @@ /* FILE IDENTIFICATION ** -** File Name: hashtable.h -** Author: Kevin Rosenberg -** Purpose: Header file for hash table library -** Date Started: Dec. 2000 +** 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 $ -** +** Copyright (c) 1983-2009 Kevin Rosenberg ** ** 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 @@ -35,11 +32,11 @@ 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(); } @@ -47,13 +44,13 @@ private: int getCode () const { return m_iCode; } - - void setCode (int iCode) + + void setCode (int iCode) { m_iCode = iCode; } - + void setNext (KeywordCodeEntry* pNext) { m_pNext = pNext; } - + KeywordCodeEntry* getNext () { return m_pNext; } }; @@ -64,19 +61,19 @@ 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 ();