00001 /* BurrTools 00002 * 00003 * BurrTools is the legal property of its developers, whose 00004 * names are listed in the COPYRIGHT file, which is included 00005 * within the source distribution. 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 */ 00021 #ifndef __DISASSEMBLER_HASHES_H__ 00022 #define __DISASSEMBLER_HASHES_H__ 00023 00024 class disassemblerNode_c; 00025 00026 00033 class nodeHash { 00034 00035 private: 00036 00038 unsigned long tab_size; 00039 00041 unsigned long tab_entries; 00042 00044 disassemblerNode_c ** tab; 00045 00046 public: 00047 00048 nodeHash(void); 00049 00050 ~nodeHash(void); 00051 00053 void clear(void); 00054 00061 const disassemblerNode_c * insert(disassemblerNode_c * n); 00062 00064 bool contains(const disassemblerNode_c * n) const; 00065 00066 private: 00067 00068 // no copying and assigning 00069 nodeHash(const nodeHash&); 00070 void operator=(const nodeHash&); 00071 }; 00072 00073 00074 00085 class countingNodeHash { 00086 00087 private: 00088 00090 unsigned long tab_size; 00092 unsigned long tab_entries; 00093 00104 struct hashNode { 00106 disassemblerNode_c * dat; 00108 hashNode * next; 00110 hashNode * link; 00111 }; 00112 00114 hashNode ** tab; 00116 hashNode * linkStart; 00117 00119 hashNode * scanPtr; 00121 bool scanActive; 00122 00123 public: 00124 00125 countingNodeHash(void); 00126 ~countingNodeHash(void); 00127 00129 void clear(void); 00130 00138 bool insert(disassemblerNode_c * n); 00139 00145 void initScan(void); 00146 00155 const disassemblerNode_c * nextScan(void); 00156 00157 private: 00158 00159 // no copying and assigning 00160 countingNodeHash(const countingNodeHash&); 00161 void operator=(const countingNodeHash&); 00162 }; 00163 00164 #endif