Lines 231-238
Link Here
|
231 |
// HashFunction(unsigned), HashFunction(void const *), HashFunction(char const *) |
231 |
// HashFunction(unsigned), HashFunction(void const *), HashFunction(char const *) |
232 |
// you can disable the default hash functions by defining HT_NODEFAULTFNS |
232 |
// you can disable the default hash functions by defining HT_NODEFAULTFNS |
233 |
|
233 |
|
|
|
234 |
namespace IFF { |
235 |
class RegEntry; |
236 |
}; |
237 |
|
234 |
#ifndef HT_NODEFAULTFNS |
238 |
#ifndef HT_NODEFAULTFNS |
235 |
// a hash function for integral (unsigned) values |
239 |
// a hash function for integral (unsigned) values |
|
|
240 |
inline unsigned int HashFunction(const IFF::RegEntry& rEntry); |
236 |
inline unsigned HashFunction(unsigned const _i) |
241 |
inline unsigned HashFunction(unsigned const _i) |
237 |
{ |
242 |
{ |
238 |
return _i ^ _i>>4 ^ _i>>9 ^ _i>>15 ^ _i>>22; |
243 |
return _i ^ _i>>4 ^ _i>>9 ^ _i>>15 ^ _i>>22; |
Lines 418-424
Link Here
|
418 |
}; |
423 |
}; |
419 |
|
424 |
|
420 |
// a _base_HashTable non-const iterator - can remove entry pointed to |
425 |
// a _base_HashTable non-const iterator - can remove entry pointed to |
421 |
class Iterator : public ConstIterator |
426 |
class Iterator : public _base_HashTable::ConstIterator |
422 |
{ |
427 |
{ |
423 |
// Nested class functions apparently have to be declared here for MSVC compatability |
428 |
// Nested class functions apparently have to be declared here for MSVC compatability |
424 |
public: |
429 |
public: |
Lines 432-455
Link Here
|
432 |
// remove the current entry pointed to, advancing to the next |
437 |
// remove the current entry pointed to, advancing to the next |
433 |
void Remove() |
438 |
void Remove() |
434 |
{ |
439 |
{ |
435 |
if (!nEntriesRemaining) |
440 |
if (!ConstIterator::nEntriesRemaining) |
436 |
{ |
441 |
{ |
437 |
HT_FAIL("HTT: Tried to Remove() via an iterator which was Done()"); |
442 |
HT_FAIL("HTT: Tried to Remove() via an iterator which was Done()"); |
438 |
} |
443 |
} |
439 |
Node * oldP = *nodePP; |
444 |
Node * oldP = *ConstIterator::nodePP; |
440 |
*nodePP = oldP->nextP; |
445 |
*ConstIterator::nodePP = oldP->nextP; |
441 |
delete oldP; |
446 |
delete oldP; |
442 |
if (!*nodePP) |
447 |
if (!*ConstIterator::nodePP) |
443 |
{ |
448 |
{ |
444 |
do |
449 |
do |
445 |
{ |
450 |
{ |
446 |
++ chainPP; |
451 |
++ ConstIterator::chainPP; |
447 |
-- nChainsRemaining; |
452 |
-- ConstIterator::nChainsRemaining; |
448 |
} |
453 |
} |
449 |
while (nChainsRemaining && !*chainPP); |
454 |
while (ConstIterator::nChainsRemaining && !*ConstIterator::chainPP); |
450 |
nodePP = chainPP; |
455 |
ConstIterator::nodePP = ConstIterator::chainPP; |
451 |
} |
456 |
} |
452 |
-- nEntriesRemaining; |
457 |
-- ConstIterator::nEntriesRemaining; |
453 |
-- *tableNEntriesP; |
458 |
-- *tableNEntriesP; |
454 |
} |
459 |
} |
455 |
|
460 |
|
Lines 702-708
Link Here
|
702 |
|
707 |
|
703 |
|
708 |
|
704 |
// for(HashTable<TYPE>::ConstIterator it(ht); !it.Done(); it.Next() ) |
709 |
// for(HashTable<TYPE>::ConstIterator it(ht); !it.Done(); it.Next() ) |
705 |
for (_base_HashTable::ConstIterator it(ht); !it.Done(); it.Next() ) |
710 |
for (class _base_HashTable::ConstIterator it(ht); !it.Done(); it.Next() ) |
706 |
{ |
711 |
{ |
707 |
AddRegardless( it.Get() ); |
712 |
AddRegardless( it.Get() ); |
708 |
} |
713 |
} |