1 //////////////////////////////////////////////////////////////////////////////// 2 // 3 // File: SFHash.h 4 // 5 // Date: December 1999 6 // 7 // Author: Daniel Switkin 8 // 9 // Copyright 2003 (c) by Daniel Switkin. This file is made publically available 10 // under the BSD license, with the stipulations that this complete header must 11 // remain at the top of the file indefinitely, and credit must be given to the 12 // original author in any about box using this software. 13 // 14 //////////////////////////////////////////////////////////////////////////////// 15 16 // Additional authors: Stephan Aßmus, <superstippi@gmx.de> 17 18 #ifndef SFHASH_H 19 #define SFHASH_H 20 21 class HashItem { 22 friend class SFHash; 23 public: 24 unsigned int key; 25 private: 26 HashItem *next; 27 }; 28 29 class SFHash { 30 public: 31 SFHash(int size = 4096); 32 ~SFHash(); 33 34 void AddItem(HashItem *item); 35 HashItem* GetItem(unsigned int key); 36 unsigned int CountItems(); 37 HashItem* NextItem(); 38 void Rewind(); 39 40 bool fatalerror; 41 42 private: 43 int size, iterate_pos, iterate_depth; 44 HashItem **main_array; 45 }; 46 47 #endif 48 49