TRF Language Model
|
a linear hash table More...
#include <wb-lhash.h>
Classes | |
struct | Unit |
the Unit of hash More... | |
Public Member Functions | |
LHash (int nSize=0) | |
constructor More... | |
~LHash () | |
destructor More... | |
int | GetNum () const |
Get the unit number. More... | |
int | GetSize () const |
Get the buffer size of hash. More... | |
int | GetMaxBits () const |
Get the buffer size bits. More... | |
const Unit * | GetBuffer () const |
Get the buffer. More... | |
size_t | TotalMemCost () |
Compute the whole memory cost of hash structure. More... | |
int | RoundSize (int nSize) |
calculate the buffer size need to be allocated More... | |
void | Alloc (int nSize) |
Allocate the buffer. More... | |
void | Release () |
Release the buffer. More... | |
void | Reset (int nSize) |
Reset the hash buffer. More... | |
void | Clean () |
Clean the hash, but don't release the buffer. More... | |
void | Fill (DataT d) |
Set all the values to d. More... | |
bool | Locate (KeyT key, int &index) const |
Find the key. More... | |
DataT * | Find (KeyT key, bool &bFound) |
Find a value. More... | |
DataT * | Find (KeyT key) |
Find a value. More... | |
DataT * | Insert (KeyT key, bool &bFound) |
Insert a value. More... | |
DataT * | Insert (KeyT key) |
Insert a value. More... | |
void | Copy (LHash< KeyT, DataT > &other) |
Copy hash. More... | |
Protected Attributes | |
int | m_nMaxBits |
The bit number of the memory buffer. (2^m_nMaxBits is the memory size) More... | |
int | m_nUnitNum |
The unit number add to the hash. More... | |
Unit * | m_pUnit |
pointer to the buffer. More... | |
Friends | |
class | LHashIter< KeyT, DataT > |
a linear hash table
Definition at line 41 of file wb-lhash.h.
constructor
Definition at line 231 of file wb-lhash.h.
destructor
Definition at line 233 of file wb-lhash.h.
|
inline |
Allocate the buffer.
Definition at line 255 of file wb-lhash.h.
|
inline |
Clean the hash, but don't release the buffer.
Definition at line 309 of file wb-lhash.h.
|
inline |
Copy hash.
Definition at line 467 of file wb-lhash.h.
|
inline |
Set all the values to d.
Definition at line 322 of file wb-lhash.h.
|
inline |
Find a value.
Definition at line 392 of file wb-lhash.h.
|
inline |
Find a value.
Definition at line 403 of file wb-lhash.h.
Get the buffer.
Definition at line 241 of file wb-lhash.h.
|
inline |
Get the buffer size bits.
Definition at line 239 of file wb-lhash.h.
|
inline |
Get the unit number.
Definition at line 235 of file wb-lhash.h.
|
inline |
Get the buffer size of hash.
Definition at line 237 of file wb-lhash.h.
|
inline |
Insert a value.
Definition at line 408 of file wb-lhash.h.
|
inline |
Insert a value.
Definition at line 461 of file wb-lhash.h.
|
inline |
Find the key.
Definition at line 333 of file wb-lhash.h.
|
inline |
Release the buffer.
Definition at line 284 of file wb-lhash.h.
|
inline |
Reset the hash buffer.
Definition at line 302 of file wb-lhash.h.
|
inline |
calculate the buffer size need to be allocated
Definition at line 248 of file wb-lhash.h.
|
inline |
Compute the whole memory cost of hash structure.
Definition at line 243 of file wb-lhash.h.
|
friend |
Definition at line 211 of file wb-lhash.h.
|
protected |
The bit number of the memory buffer. (2^m_nMaxBits is the memory size)
Definition at line 220 of file wb-lhash.h.
|
protected |
The unit number add to the hash.
Definition at line 221 of file wb-lhash.h.
pointer to the buffer.
Definition at line 222 of file wb-lhash.h.