29 #ifndef __HASHINDEX_H__
30 #define __HASHINDEX_H__
41 #define DEFAULT_HASH_SIZE 1024
42 #define DEFAULT_HASH_GRANULARITY 1024
47 idHashIndex(
const int initialHashSize,
const int initialIndexSize );
53 size_t Size(
void )
const;
57 void Add(
const int key,
const int index );
59 void Remove(
const int key,
const int index );
61 int First(
const int key )
const;
63 int Next(
const int index )
const;
71 void Clear(
const int newHashSize,
const int newIndexSize );
85 int GenerateKey(
const char *
string,
bool caseSensitive =
true )
const;
89 int GenerateKey(
const int n1,
const int n2 )
const;
102 void Init(
const int initialHashSize,
const int initialIndexSize );
103 void Allocate(
const int newHashSize,
const int newIndexSize );
121 Init( initialHashSize, initialIndexSize );
219 if (
hash[k] == index ) {
263 if (
hash[i] >= index ) {
265 if (
hash[i] > max ) {
278 if ( max >= indexSize ) {
281 for ( i = max; i >
index; i-- ) {
301 if (
hash[i] >= index ) {
302 if (
hash[i] > max ) {
316 for ( i = index; i <
max; i++ ) {
370 assert( newGranularity > 0 );
380 if ( caseSensitive ) {
393 return ( (((
int) v[0]) + ((
int) v[1]) + ((
int) v[2])) &
hashMask );
void ResizeIndex(const int newIndexSize)
assert(prefInfo.fullscreenBtn)
#define DEFAULT_HASH_SIZE
int GetHashSize(void) const
int Next(const int index) const
void Remove(const int key, const int index)
int GetIndexSize(void) const
void Allocate(const int newHashSize, const int newIndexSize)
void RemoveIndex(const int key, const int index)
void SetGranularity(const int newGranularity)
void Init(const int initialHashSize, const int initialIndexSize)
int First(const int key) const
idHashIndex & operator=(const idHashIndex &other)
static int INVALID_INDEX[1]
size_t Allocated(void) const
void InsertIndex(const int key, const int index)
static int Hash(const char *string)
static int IHash(const char *string)
int GenerateKey(const char *string, bool caseSensitive=true) const
void Add(const int key, const int index)
int GetSpread(void) const