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

FX::FXHashOf< KEYTYPE, VALUETYPE > Class Template Reference

A hash table mapping pointers to KEYTYPE to pointers of VALUETYPE. More...

#include <FXHashOf.h>

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

Public Member Functions

 FXHashOf ()
 Default constructor.
 
 FXHashOf (const FXHashOf< KEYTYPE, VALUETYPE > &other)
 Copy constructor.
 
FXHashOf< KEYTYPE, VALUETYPE > & operator= (const FXHashOf< KEYTYPE, VALUETYPE > &other)
 Assignment operator.
 
FXHashOf< KEYTYPE, VALUETYPE > & adopt (FXHashOf< KEYTYPE, VALUETYPE > &other)
 Adopt objects from orig, leaving orig empty.
 
FXival find (KEYTYPE *ky) const
 Find position of given key, returning -1 if not found.
 
FXbool has (KEYTYPE *ky) const
 Check if key is mapped.
 
VALUETYPE *& at (KEYTYPE *ky)
 Return reference to slot assocated with given key.
 
VALUETYPE *const & at (KEYTYPE *ky) const
 Return constant reference to slot assocated with given key.
 
VALUETYPE *& operator[] (KEYTYPE *ky)
 Return reference to slot assocated with given key.
 
VALUETYPE *const & operator[] (KEYTYPE *ky) const
 Return constant reference to slot assocated with given key.
 
VALUETYPE * insert (KEYTYPE *ky, VALUETYPE *ptr=nullptr)
 Insert association with given key; return old value, if any.
 
VALUETYPE * remove (KEYTYPE *ky)
 Remove association with given key; return old value, if any.
 
VALUETYPE * erase (FXival pos)
 Erase data at pos in the table; return old value, if any.
 
KEYTYPE * key (FXival pos) const
 Return key at position pos.
 
VALUETYPE *& data (FXival pos)
 Return reference to slot at position pos.
 
VALUETYPE *const & data (FXival pos) const
 Return constant reference to slot at position pos.
 
- Public Member Functions inherited from FX::FXHash
 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.
 

Additional Inherited Members

- Protected Member Functions inherited from FX::FXHash
FXbool no (FXival n)
 
void used (FXival u)
 
void free (FXival f)
 
FXbool resize (FXival n)
 
- Protected Attributes inherited from FX::FXHash
Entrytable
 

Detailed Description

template<typename KEYTYPE, typename VALUETYPE>
class FX::FXHashOf< KEYTYPE, VALUETYPE >

A hash table mapping pointers to KEYTYPE to pointers of VALUETYPE.

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.


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

Copyright © 1997-2022 Jeroen van der Zijp