X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Fhashtable.h;h=bfad8825be4922d2edb1ef5c49e25361096db87a;hp=ea5dc43729a40fa254aea1a974ac783807866915;hb=f7ee98f7d964ed361068179f0e7ea4475ed1abdf;hpb=c00c639073653fac7463a88f2b000f263236550d diff --git a/include/hashtable.h b/include/hashtable.h index ea5dc43..bfad882 100644 --- a/include/hashtable.h +++ b/include/hashtable.h @@ -1,14 +1,14 @@ /* 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-2000 Kevin Rosenberg +** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: hashtable.h,v 1.2 2001/01/02 16:02:12 kevin Exp $ +** $Id$ ** ** ** This program is free software; you can redistribute it and/or modify @@ -35,11 +35,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 +47,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 +64,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 ();