|
|
@ -62,24 +62,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
// Define a field inside an object that is used to link it into a hash table
|
|
|
|
// Define a field inside an object that is used to link it into a hash table
|
|
|
|
#define HASHLINK(object) THashLink< object > |
|
|
|
#define HASHLINK(object) THashLink< object > |
|
|
|
|
|
|
|
|
|
|
|
// Define a POINTER to a hash table, not a hash table
|
|
|
|
|
|
|
|
#define HASHTABLE(object,key) THashTable< object, key > |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Define a hash table:
|
|
|
|
// Define a hash table:
|
|
|
|
// - starts with kSlotMinCount rows
|
|
|
|
// - starts with kSlotMinCount rows
|
|
|
|
// - can grow to kDefaultSlotMaxCount rows
|
|
|
|
// - can grow to kDefaultSlotMaxCount rows
|
|
|
|
// (hash table grows when a row contains more than kGrowOnListSize entries
|
|
|
|
// (hash table grows when a row contains more than kGrowOnListSize entries
|
|
|
|
#define HASHTABLEDECL(object,key,link) THashTableDecl< object, key, offsetof(object,link), 0 > |
|
|
|
#define HASHTABLEDECL(object,key,link) THashTableDecl< object, key, offsetof(object,link), 0 > |
|
|
|
|
|
|
|
|
|
|
|
// Define a hash table in situations when a forward reference prevents use of HASHTABLEDECL
|
|
|
|
|
|
|
|
// - Size characteristics are identical to HASHTABLEDECL
|
|
|
|
|
|
|
|
#define HASHTABLEDYN(object,key) THashTableDyn< object, key > |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Define a hash table with:
|
|
|
|
|
|
|
|
// - starts with <size>
|
|
|
|
|
|
|
|
// - row table never grows
|
|
|
|
|
|
|
|
#define HASHTABLEDECLSIZE(object,key,link,size) THashTableDecl<object, key, offsetof(object,link), size > |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) |
|
|
|
#if defined(_MSC_VER) |
|
|
|
#define forceinline __forceinline |
|
|
|
#define forceinline __forceinline |
|
|
@ -595,28 +583,6 @@ THashTableDecl<T,K,linkOffset,maxSize>::THashTableDecl () { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* THashTableDyn |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
***/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<class T, class K> |
|
|
|
|
|
|
|
class THashTableDyn : public THashTable<T,K> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
void Initialize (int linkOffset, unsigned maxSize = 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
template<class T, class K> |
|
|
|
|
|
|
|
void THashTableDyn<T,K>::Initialize (int linkOffset, unsigned maxSize) { |
|
|
|
|
|
|
|
this->SetLinkOffset(linkOffset, maxSize); |
|
|
|
|
|
|
|
this->SetSlotMaxCount(maxSize); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
/****************************************************************************
|
|
|
|
* |
|
|
|
* |
|
|
|
* THashKeyVal |
|
|
|
* THashKeyVal |
|
|
|