Classes | Defines | Typedefs | Enumerations | Functions

pldhash.h File Reference

#include "nscore.h"
Include dependency graph for pldhash.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  PLDHashEntryHdr
struct  PLDHashTable
struct  PLDHashTableOps
struct  PLDHashEntryStub

Defines

#define PL_DHASH_FASTCALL
#define PL_DHASH_SIZE_LIMIT   PR_BIT(24)
#define PL_DHASH_MIN_SIZE   16
#define PL_DHASH_BITS   32
#define PL_DHASH_GOLDEN_RATIO   0x9E3779B9U
#define PL_DHASH_ENTRY_IS_FREE(entry)   ((entry)->keyHash == 0)
#define PL_DHASH_ENTRY_IS_BUSY(entry)   (!PL_DHASH_ENTRY_IS_FREE(entry))
#define PL_DHASH_ENTRY_IS_LIVE(entry)   ((entry)->keyHash >= 2)
#define PL_DHASH_TABLE_SIZE(table)   PR_BIT(PL_DHASH_BITS - (table)->hashShift)
#define PL_DHASH_MIN_ALPHA(table, k)
#define PL_DHASH_DEFAULT_MAX_ALPHA   0.75
#define PL_DHASH_DEFAULT_MIN_ALPHA   0.25
#define PL_DHASH_CAP(entryCount, maxAlpha)   ((PRUint32)((double)(entryCount) / (maxAlpha)))
#define PL_DHASH_CAPACITY(entryCount, maxAlpha)
#define PL_DHASH_DEFAULT_CAPACITY(entryCount)   PL_DHASH_CAPACITY(entryCount, PL_DHASH_DEFAULT_MAX_ALPHA)

Typedefs

typedef PRUint32 PLDHashNumber
typedef struct PLDHashEntryHdr PLDHashEntryHdr
typedef struct PLDHashEntryStub PLDHashEntryStub
typedef struct PLDHashTable PLDHashTable
typedef struct PLDHashTableOps PLDHashTableOps
typedef void *(* PLDHashAllocTable )(PLDHashTable *table, PRUint32 nbytes)
typedef void(* PLDHashFreeTable )(PLDHashTable *table, void *ptr)
typedef PLDHashNumber(* PLDHashHashKey )(PLDHashTable *table, const void *key)
typedef PRBool(* PLDHashMatchEntry )(PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key)
typedef void(* PLDHashMoveEntry )(PLDHashTable *table, const PLDHashEntryHdr *from, PLDHashEntryHdr *to)
typedef void(* PLDHashClearEntry )(PLDHashTable *table, PLDHashEntryHdr *entry)
typedef void(* PLDHashFinalize )(PLDHashTable *table)
typedef PRBool(* PLDHashInitEntry )(PLDHashTable *table, PLDHashEntryHdr *entry, const void *key)
typedef enum PLDHashOperator PLDHashOperator
typedef PLDHashOperator(* PLDHashEnumerator )(PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)

Enumerations

enum  PLDHashOperator {
  PL_DHASH_LOOKUP = 0, PL_DHASH_ADD = 1, PL_DHASH_REMOVE = 2, PL_DHASH_NEXT = 0,
  PL_DHASH_STOP = 1
}

Functions

void * PL_DHashAllocTable (PLDHashTable *table, PRUint32 nbytes)
void PL_DHashFreeTable (PLDHashTable *table, void *ptr)
PLDHashNumber PL_DHashStringKey (PLDHashTable *table, const void *key)
PLDHashNumber PL_DHashVoidPtrKeyStub (PLDHashTable *table, const void *key)
PRBool PL_DHashMatchEntryStub (PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key)
PRBool PL_DHashMatchStringKey (PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key)
void PL_DHashMoveEntryStub (PLDHashTable *table, const PLDHashEntryHdr *from, PLDHashEntryHdr *to)
void PL_DHashClearEntryStub (PLDHashTable *table, PLDHashEntryHdr *entry)
void PL_DHashFreeStringKey (PLDHashTable *table, PLDHashEntryHdr *entry)
void PL_DHashFinalizeStub (PLDHashTable *table)
const PLDHashTableOpsPL_DHashGetStubOps (void)
PLDHashTablePL_NewDHashTable (const PLDHashTableOps *ops, void *data, PRUint32 entrySize, PRUint32 capacity)
void PL_DHashTableDestroy (PLDHashTable *table)
PRBool PL_DHashTableInit (PLDHashTable *table, const PLDHashTableOps *ops, void *data, PRUint32 entrySize, PRUint32 capacity)
void PL_DHashTableSetAlphaBounds (PLDHashTable *table, float maxAlpha, float minAlpha)
void PL_DHashTableFinish (PLDHashTable *table)
PLDHashEntryHdrPL_DHashTableOperate (PLDHashTable *table, const void *key, PLDHashOperator op)
void PL_DHashTableRawRemove (PLDHashTable *table, PLDHashEntryHdr *entry)
PRUint32 PL_DHashTableEnumerate (PLDHashTable *table, PLDHashEnumerator etor, void *arg)

Define Documentation

#define PL_DHASH_BITS   32
#define PL_DHASH_CAP (   entryCount,
  maxAlpha 
)    ((PRUint32)((double)(entryCount) / (maxAlpha)))
#define PL_DHASH_CAPACITY (   entryCount,
  maxAlpha 
)
Value:
(PL_DHASH_CAP(entryCount, maxAlpha) +                                     \
     (((PL_DHASH_CAP(entryCount, maxAlpha) * (PRUint8)(0x100 * (maxAlpha)))     \
       >> 8) < (entryCount)))
#define PL_DHASH_DEFAULT_CAPACITY (   entryCount  )     PL_DHASH_CAPACITY(entryCount, PL_DHASH_DEFAULT_MAX_ALPHA)
#define PL_DHASH_DEFAULT_MAX_ALPHA   0.75
#define PL_DHASH_DEFAULT_MIN_ALPHA   0.25
#define PL_DHASH_ENTRY_IS_BUSY (   entry  )     (!PL_DHASH_ENTRY_IS_FREE(entry))
#define PL_DHASH_ENTRY_IS_FREE (   entry  )     ((entry)->keyHash == 0)
#define PL_DHASH_ENTRY_IS_LIVE (   entry  )     ((entry)->keyHash >= 2)
#define PL_DHASH_FASTCALL
#define PL_DHASH_GOLDEN_RATIO   0x9E3779B9U
#define PL_DHASH_MIN_ALPHA (   table,
  k 
)
Value:
((float)((table)->entrySize / sizeof(void *) - 1)                         \
     / ((table)->entrySize / sizeof(void *) + (k)))
#define PL_DHASH_MIN_SIZE   16
#define PL_DHASH_SIZE_LIMIT   PR_BIT(24)
#define PL_DHASH_TABLE_SIZE (   table  )     PR_BIT(PL_DHASH_BITS - (table)->hashShift)

Typedef Documentation

typedef void*(* PLDHashAllocTable)(PLDHashTable *table, PRUint32 nbytes)
typedef void(* PLDHashClearEntry)(PLDHashTable *table, PLDHashEntryHdr *entry)
typedef PLDHashOperator(* PLDHashEnumerator)(PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)
typedef void(* PLDHashFinalize)(PLDHashTable *table)
typedef void(* PLDHashFreeTable)(PLDHashTable *table, void *ptr)
typedef PLDHashNumber(* PLDHashHashKey)(PLDHashTable *table, const void *key)
typedef PRBool(* PLDHashInitEntry)(PLDHashTable *table, PLDHashEntryHdr *entry, const void *key)
typedef PRBool(* PLDHashMatchEntry)(PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key)
typedef void(* PLDHashMoveEntry)(PLDHashTable *table, const PLDHashEntryHdr *from, PLDHashEntryHdr *to)
typedef PRUint32 PLDHashNumber
typedef struct PLDHashTable PLDHashTable

Enumeration Type Documentation

Enumerator:
PL_DHASH_LOOKUP 
PL_DHASH_ADD 
PL_DHASH_REMOVE 
PL_DHASH_NEXT 
PL_DHASH_STOP 

Function Documentation

void* PL_DHashAllocTable ( PLDHashTable table,
PRUint32  nbytes 
)
void PL_DHashClearEntryStub ( PLDHashTable table,
PLDHashEntryHdr entry 
)
void PL_DHashFinalizeStub ( PLDHashTable table  ) 
void PL_DHashFreeStringKey ( PLDHashTable table,
PLDHashEntryHdr entry 
)
void PL_DHashFreeTable ( PLDHashTable table,
void *  ptr 
)
const PLDHashTableOps* PL_DHashGetStubOps ( void   ) 
PRBool PL_DHashMatchEntryStub ( PLDHashTable table,
const PLDHashEntryHdr entry,
const void *  key 
)
PRBool PL_DHashMatchStringKey ( PLDHashTable table,
const PLDHashEntryHdr entry,
const void *  key 
)
void PL_DHashMoveEntryStub ( PLDHashTable table,
const PLDHashEntryHdr from,
PLDHashEntryHdr to 
)
PLDHashNumber PL_DHashStringKey ( PLDHashTable table,
const void *  key 
)
void PL_DHashTableDestroy ( PLDHashTable table  ) 
PRUint32 PL_DHashTableEnumerate ( PLDHashTable table,
PLDHashEnumerator  etor,
void *  arg 
)
void PL_DHashTableFinish ( PLDHashTable table  ) 
PRBool PL_DHashTableInit ( PLDHashTable table,
const PLDHashTableOps ops,
void *  data,
PRUint32  entrySize,
PRUint32  capacity 
)
PLDHashEntryHdr* PL_DHashTableOperate ( PLDHashTable table,
const void *  key,
PLDHashOperator  op 
)
void PL_DHashTableRawRemove ( PLDHashTable table,
PLDHashEntryHdr entry 
)
void PL_DHashTableSetAlphaBounds ( PLDHashTable table,
float  maxAlpha,
float  minAlpha 
)
PLDHashNumber PL_DHashVoidPtrKeyStub ( PLDHashTable table,
const void *  key 
)
PLDHashTable* PL_NewDHashTable ( const PLDHashTableOps ops,
void *  data,
PRUint32  entrySize,
PRUint32  capacity 
)