#include <JHashRecord.h>
◆ JHashRecord() [1/2]
JHashRecord encapsulates the per-entry information needed by JHashTable. JHashTable itself only requires the state information and treats the rest of the data (the template parameter) opaquely. Only client code need understand the properties of the data and provide hash values and key comparisons. Care must be taken to ensure that the hash value is the correct one for the given key.
It is perhaps unusual that the hash value would be stored in the table itself, which uses considerable extra space in a large table. For static tables it is unnecessary, since the location itself is the hash value. To implement dynamic resizing, however, the location is essentially only a partial hash value (for JHashTable, the hash value modulo the tablesize), and the complete hash value must be cached to determine the new location of a record in a larger table.
Base code generated by Codemill v0.1.0
◆ JHashRecord() [2/2]
◆ ~JHashRecord()
◆ GetHashValue()
◆ GetState()
◆ GetValue()
◆ IsDeleted()
◆ IsEmpty()
◆ IsFull()
◆ MarkEmpty()
DANGER! Extreme memory leak hazard!
Don't use this unless you know what you're doing–this is the single easiest way to rip a hash table to shreds, and likely leak memory too.
◆ PrintLayout()
Prints the layout of a JHashRecord in memory. Useful for optimizing the memory usage on a particular architecture, which can be important considering how many records can potentially be stored.
This method ought to be static but isn't to accomodate how certain compilers implement sizeof() and/or offsetof(). It isn't very hard to use the default constructor to create a throwaway object anyway.
◆ Remove()
If the state is kFull, sets it to kDeleted (in other words, won't mark a kEmpty record kDeleted).
◆ Set() [1/2]
Some fields cannot be set individually to make it harder to set the value incorrectly (such as accidentally marking it empty or giving it a hash value which does not match the value).
◆ Set() [2/2]
The documentation for this class was generated from the following files: