C++ Based OPC UA Client/Server SDK
1.6.5.478
|
#include <hashtable.h>
Public Types | |
enum | HashType { Rotating = 0 } |
Description of the Enumeration HashType. More... | |
Public Member Functions | |
HashTable (int iSize=1000003) | |
Constructor of the hash table. More... | |
~HashTable () | |
The destructor cleans up its resources. More... | |
void | add (const UaNodeId &key, ChainEntry *pValue) |
Adds a new ChainEntry object with a corresponding key. More... | |
ChainEntry * | lookup (const UaNodeId &key) |
Looks up the value object identified by the passed string. More... | |
ChainEntry * | remove (const UaNodeId &key) |
Removes an object from the hash table identified by the passed string. More... | |
void | setHashType (HashType type) |
Sets the HashType. More... | |
void | clear (bool bDelete=true) |
Clears the hash table. More... | |
int | count () |
Get the number of elements in the hash table. More... | |
int | tableSize () const |
Get the size the table was initialized with. More... | |
Protected Member Functions | |
int | hash (const unsigned char *pData, unsigned int iLen) |
Create a new Hash with specified length and data. More... | |
int | rotating_hash (const unsigned char *pData, unsigned int iLen) |
Rotating hash. More... | |
HashIterator | next (const HashIterator *pCurrent) |
Get next element from table starting at iterator. | |
This class implements a fast hash table. primes for special tables sizes: size 1.000, 10.000, 100.000, 1.000.000, 10.000.000 prime 1.009, 10.007, 100.003, 1.000.003, 10.000.019
enum HashTable::HashType |
HashTable::HashTable | ( | int | iSize = 1000003 | ) |
Constructor of the hash table.
You can initialize the max size of the table. You can fill in even more the max elements, but then there must be collision and performance is decreasing.
iSize | max number of entries. You should choose a prime here to reduce collisions. |
HashTable::~HashTable | ( | ) |
The destructor cleans up its resources.
It does not delete the referenced objects.
void HashTable::add | ( | const UaNodeId & | key, |
ChainEntry * | pValue | ||
) |
Adds a new ChainEntry object with a corresponding key.
You can use this key to lookup the object.
key | a unicode string |
pValue | the value to store |
void HashTable::clear | ( | bool | bDelete = true | ) |
Clears the hash table.
bDelete | true if everything is cleared false if not. |
int HashTable::count | ( | ) |
Get the number of elements in the hash table.
|
protected |
Create a new Hash with specified length and data.
pData | the data to put into the hash. |
iLen | the length of the Hash. |
ChainEntry * HashTable::lookup | ( | const UaNodeId & | key | ) |
Looks up the value object identified by the passed string.
key | the key to search for |
ChainEntry * HashTable::remove | ( | const UaNodeId & | key | ) |
Removes an object from the hash table identified by the passed string.
key | the key to search for |
|
protected |
Rotating hash.
pData | the data to put into the hash. |
iLen | the length of the Hash. |
void HashTable::setHashType | ( | HashType | type | ) |
Sets the HashType.
type | a Variable filled with the HashType (e.g. rotating_hash). |
int HashTable::tableSize | ( | ) | const |
Get the size the table was initialized with.