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 // John Scipione, <jscipione@gmail.com> 18 19 #ifndef SFHASH_H 20 #define SFHASH_H 21 22 23 class HashItem { 24 friend class SFHash; 25 public: 26 unsigned int key; 27 private: 28 HashItem* next; 29 }; 30 31 32 class SFHash { 33 public: 34 SFHash(int size = 4096); 35 virtual ~SFHash(); 36 37 void AddItem(HashItem* item); 38 HashItem* GetItem(unsigned int key); 39 unsigned int CountItems(); 40 HashItem* NextItem(); 41 void Rewind(); 42 43 bool fatalerror; 44 45 private: 46 int size; 47 int iterate_pos; 48 int iterate_depth; 49 50 HashItem** main_array; 51 }; 52 53 54 #endif // SFHASH_H 55