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

FX::FXHash Class Reference

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

#include <FXHash.h>

Inheritance diagram for FX::FXHash:
FX::FXHashOf< KEYTYPE, VALUETYPE >

Classes

struct  Entry
 

Public Member Functions

 FXHash ()
 Construct empty hash table.
 
 FXHash (const FXHash &other)
 Construct from another table.
 
FXival no () const
 Return the total number of slots in the table.
 
FXival used () const
 Return number of used slots in the table.
 
FXival free () const
 Return number of free slots in the table.
 
FXbool empty () const
 See if hash table is empty.
 
FXHashoperator= (const FXHash &other)
 Assign from another table.
 
FXHashadopt (FXHash &other)
 Adopt table from another; the other table becomes empty.
 
FXival find (const void *ky) const
 Find position of given key, returning -1 if not found.
 
FXbool has (const void *ky) const
 Check if key is mapped.
 
void *& at (const void *ky)
 Return reference to slot assocated with given key.
 
void *const & at (const void *ky) const
 Return constant reference to slot assocated with given key.
 
void *& operator[] (const void *ky)
 Return reference to slot assocated with given key.
 
void *const & operator[] (const void *ky) const
 Return constant reference to slot assocated with given key.
 
void * insert (const void *ky, void *ptr=nullptr)
 Replace key in table, overwriting the old value if the given key already exists. More...
 
void * remove (const void *ky)
 Remove key from the table. More...
 
void * erase (FXival pos)
 Erase entry from table at pos, returning old value.
 
FXbool empty (FXival pos) const
 Return true if slot is not occupied by a key.
 
const void * key (FXival pos) const
 Return key at position pos.
 
void *& data (FXival pos)
 Return reference to data pointer at position pos.
 
void *const & data (FXival pos) const
 Return constant reference data pointer at position pos.
 
FXbool clear ()
 Clear hash table.
 
 ~FXHash ()
 Destructor.
 

Protected Member Functions

FXbool no (FXival n)
 
void used (FXival u)
 
void free (FXival f)
 
FXbool resize (FXival n)
 

Protected Attributes

Entrytable
 

Detailed Description

A hash table for mapping pointers to pointers.

Two special key values are disallowed: NULL and the pointer value (-1L); NULL is used to designate an unoccupied slot, while (-1L) is used to designate a formerly occupied slot.

Member Function Documentation

◆ insert()

void* FX::FXHash::insert ( const void *  ky,
void *  ptr = nullptr 
)
inline

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

Returns the old value of the key.

◆ remove()

void* FX::FXHash::remove ( const void *  ky)

Remove key from the table.

Returns the old value of the key.


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

Copyright © 1997-2022 Jeroen van der Zijp