Hash class (not thread-safe) 更多...
#include <vrpn_HashST.h>
Public 成员函数 | |
| vrpn_Hash (int init=16) | |
| constructor | |
| vrpn_Hash (unsigned int(*func)(const TKey &key), int init=16) | |
| constructor | |
| virtual | ~vrpn_Hash () |
| destructor | |
| void | Clear () |
| clears the Hash | |
| unsigned int | GetNrItems () const |
| returns the number of items in the Hash | |
| TValue & | Find (const TKey &key) |
| returns the value that belongs to this key | |
| const TValue & | Find (const TKey &key) const |
| returns the value that belongs to this key | |
| bool | IsPresent (const TValue &value, TKey &key) const |
| checks if the Hash contains a value and returns its key | |
| bool | MoveFirst () const |
| moves an iterator to the first element and returns false if no element is present | |
| bool | MoveNext () const |
| moves the iterator to the next element and returns false if no more element is present | |
| TValue | GetCurrentValue () const |
| returns the value of the current item | |
| TKey | GetCurrentKey () const |
| returns the key of the current item | |
| void | SetCurrentValue (TValue theValue) |
| sets the Value of the current key | |
| bool | GetCurrentKeyAndValue (TKey &theKey, TValue &theValue) const |
| returns the key and the value of the current item | |
| bool | Add (TKey key, TValue value) |
| adds a new (key, value) pair, returns true if succeeded | |
| bool | Remove (TKey key) |
| removes the value that belongs to this key, returns true if succeeded | |
Hash class (not thread-safe)
This class implements a NON thread-safe template Hash. Both the key as the value are templates. It is possible to iterate over this Hash, but no guarantee is given about the order in which the items are returned. All keys must be unique.
| vrpn_Hash | ( | int | init = 16 | ) |
constructor
Constructs a new Hash
| init | Hash's initial size and grow size |
| vrpn_Hash | ( | unsigned int(* | func )(const TKey &key), |
| int | init = 16 ) |
constructor
Constructs a new Hash
| func | the function that used to calculate Hash values from the keys |
| init | Hash's initial size and grow size |
|
virtual |
destructor
| bool Add | ( | TKey | key, |
| TValue | value ) |
adds a new (key, value) pair, returns true if succeeded
| void Clear | ( | ) |
clears the Hash
| TValue & Find | ( | const TKey & | key | ) |
returns the value that belongs to this key
| const TValue & Find | ( | const TKey & | key | ) | const |
returns the value that belongs to this key
| TKey GetCurrentKey | ( | ) | const |
returns the key of the current item
| bool GetCurrentKeyAndValue | ( | TKey & | theKey, |
| TValue & | theValue ) const |
returns the key and the value of the current item
| TValue GetCurrentValue | ( | ) | const |
returns the value of the current item
|
inline |
returns the number of items in the Hash
| bool IsPresent | ( | const TValue & | value, |
| TKey & | key ) const |
checks if the Hash contains a value and returns its key
| bool MoveFirst | ( | ) | const |
moves an iterator to the first element and returns false if no element is present
| bool MoveNext | ( | ) | const |
moves the iterator to the next element and returns false if no more element is present
| bool Remove | ( | TKey | key | ) |
removes the value that belongs to this key, returns true if succeeded
| void SetCurrentValue | ( | TValue | theValue | ) |
sets the Value of the current key