Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXHash Class Reference

A hash table for associating pointers to pointers. More...

#include <FXHash.h>

List of all members.

Classes

struct  Entry

Public Member Functions

 FXHash ()
 Construct empty hash table.
FXbool size (FXuint m)
 Resize the table to the given size; the size must be a power of two.
FXuint size () const
 Return the total number of slots in the table.
FXuint no () const
 Return number of non-empty slots in the table.
void * insert (void *name, void *data=NULL)
 Insert key into table, unless the key already exists.
void * replace (void *name, void *data=NULL)
 Replace key in table, overwriting the old value if the given key already exists.
void * remove (void *name)
 Remove key from the table.
void * find (void *name) const
 Return value of key, or return NULL.
FXbool empty (FXuint pos) const
 Return true if slot is not occupied by a key.
void * key (FXuint pos) const
 Return key at position pos.
void * value (FXuint pos) const
 Return data pointer at position pos.
void clear ()
 Clear hash table.
virtual ~FXHash ()
 Destructor.

Protected Attributes

FXArray< Entrytable
FXuint used
FXuint free

Static Protected Attributes

static const Entry init

Detailed Description

A hash table for associating pointers to pointers.

All values may be used as a key, except 0 and -1.


Member Function Documentation

void* FX::FXHash::insert ( void *  name,
void *  data = NULL 
)

Insert key into table, unless the key already exists.

Returns the current value of the key.

void* FX::FXHash::remove ( void *  name)

Remove key from the table.

Returns the old value of the key.

void* FX::FXHash::replace ( void *  name,
void *  data = NULL 
)

Replace key in table, overwriting the old value if the given key already exists.

Returns the old value of the key.


The documentation for this class was generated from the following file:

Copyright © 1997-2013 Jeroen van der Zijp