47 void used(FXival u){ ((FXival*)table)[-2]=u; }
50 void free(FXival f){ ((FXival*)table)[-3]=f; }
53 FXbool resize(FXival n);
64 FXHash(
const FXHash& other);
69 FXival
no()
const {
return ((FXival*)table)[-1]; }
74 FXival
used()
const {
return ((FXival*)table)[-2]; }
79 FXival
free()
const {
return ((FXival*)table)[-3]; }
84 FXbool
empty()
const {
return ((FXival*)table)[-1]<=1; }
99 FXival find(
const void* ky)
const;
104 FXbool
has(
const void* ky)
const {
return 0<=find(ky); }
109 void*& at(
const void* ky);
114 void *
const& at(
const void* ky)
const;
124 void *
const&
operator[](
const void* ky)
const {
return at(ky); }
130 void*
insert(
const void* ky,
void* ptr=
nullptr){
return swap(ptr,at(ky)); }
135 void*
remove(
const void* ky);
140 void* erase(FXival pos);
145 FXbool
empty(FXival pos)
const {
return (table[pos].key==
nullptr)||(table[pos].key==(
const void*)-1L); }
150 const void*
key(FXival pos)
const {
return table[pos].key; }
155 void*&
data(FXival pos){
return table[pos].data; }
160 void *
const&
data(FXival pos)
const {
return table[pos].data; }
FXival no() const
Return the total number of slots in the table.
Definition: FXHash.h:69
void *const & data(FXival pos) const
Return constant reference data pointer at position pos.
Definition: FXHash.h:160
A hash table for mapping pointers to pointers.
Definition: FXHash.h:33
FXbool empty() const
See if hash table is empty.
Definition: FXHash.h:84
Definition: FX4Splitter.h:28
FXival free() const
Return number of free slots in the table.
Definition: FXHash.h:79
FXival used() const
Return number of used slots in the table.
Definition: FXHash.h:74
FXbool empty(FXival pos) const
Return true if slot is not occupied by a key.
Definition: FXHash.h:145
void *const & operator[](const void *ky) const
Return constant reference to slot assocated with given key.
Definition: FXHash.h:124
const void * key(FXival pos) const
Return key at position pos.
Definition: FXHash.h:150
void * insert(const void *ky, void *ptr=nullptr)
Replace key in table, overwriting the old value if the given key already exists.
Definition: FXHash.h:130
void *& operator[](const void *ky)
Return reference to slot assocated with given key.
Definition: FXHash.h:119
FXbool has(const void *ky) const
Check if key is mapped.
Definition: FXHash.h:104
void *& data(FXival pos)
Return reference to data pointer at position pos.
Definition: FXHash.h:155