pfuHash(3pf) OpenGL Performer 3.2.2 libpfutil Reference Pages pfuHash(3pf)NAME
pfuNewHTable, pfuDelHTable, pfuResetHTable, pfuEnterHash, pfuRemoveHash,
pfuFindHash, pfuHashGSetVerts, pfuCalcHashSize - Hash table utility
library.
FUNCTION SPECIFICATION
#include <Performer/pfutil.h>
pfuHashTable * pfuNewHTable(int numb, int eltsize, void* arena);
void pfuDelHTable(pfuHashTable* ht);
void pfuResetHTable(pfuHashTable* ht);
pfuHashElt * pfuEnterHash(pfuHashTable* ht, pfuHashElt* elt);
int pfuRemoveHash(pfuHashTable* ht, pfuHashElt* elt);
int pfuFindHash(pfuHashTable* ht, pfuHashElt* elt);
int pfuHashGSetVerts(pfGeoSet *gset);
int pfuCalcHashSize(int size);
typedef struct _pfuHashElt
{
int id;
int listIndex;
uint key;
void *data;
} pfuHashElt;
typedef struct _pfuHashBucket
{
int nelts;
pfuHashElt *elts;
struct _pfuHashBucket *next;
} pfuHashBucket;
typedef struct _pfuHashTable
{
void *arena;
int eltSize;
int realeltSize;
int numBuckets;
pfuHashBucket **buckets;
/* Flat list of hash elements provides linear ordering */
int listCount;
int listAvail;
Page 1
pfuHash(3pf) OpenGL Performer 3.2.2 libpfutil Reference Pages pfuHash(3pf)
pfuHashElt **list;
} pfuHashTable;
DESCRIPTION
pfuNewHTable returns a new hash table allocated from the shared memory
arena arena with numb elements each of size eltsize. eltsize is in bytes
and must be a multiple of four.
pfuDelHTable deletes the hash table ht.
pfuResetHTable resets the hash table ht.
pfuEnterHash puts element elt into hash table ht. If the element is
already in the table, it returns the address of that element, otherwise
it returns NULL and adds the element to the list member of the
pfuHashTable structure.
pfuRemoveHash removes element elt from the hash table ht, returning TRUE
if elt was found and FALSE otherwise.
pfuFindHash looks for element elt in hash table ht, returning TRUE if elt
was found and FALSE otherwise.
pfuHashGSetVerts takes a pfGeoSet of type PFGS_TRIS and attempts to share
all PFGS_PER_VERTEX attributes. pfuHashGSetVerts will convert a non-
indexed pfGeoSet into an indexed one and may delete the old attribute and
index arrays and create new ones. Consequently you may wish to pfRef
your arrays to avoid their deletion.
An example of pfuHashGSetVerts usage is found in pfdMeshGSet.
pfuCalcHashSize returns the smallest prime number larger than size. This
is useful since hash tables are more memory efficient when their table
size is prime.
NOTES
The libpfutil source code, object code and documentation are provided as
unsupported software. Routines are subject to change in future releases.
SEE ALSO
pfGeoSet, pfRef, pfuMeshGSet, pfuEventQueue, pfuGUI
Page 2