|
Developer Documentation |
|
Centre for Vision, Speech & Signal Processing |
|
PUBLIC |
HashC::HashC(UIndex)
HashC::HashC(const HashC &)
HashC::HashC(istream &)
HashC::Copy(void) const
HashC::Lookup(const K &) const
HashC::Lookup(const K &)
HashC::Lookup(const K &,T &)
HashC::Update(const K &,const T &)
HashC::Update(const K &)
HashC::operator[](const K &)
HashC::operator[](const K &) const
HashC::Insert(const K &,const T &)
HashC::Access(const K &,const T &)
HashC::Del(const K &)
HashC::Get(const K &)
HashC::IsElm(const K &) const
HashC::Empty(void)
HashC::Size(void) const
HashC::IsEmpty(void) const
HashC::Bins(void) const
HashC::Resize(USize)
HashC::operator=(const HashC &)
HashC::IsSameTable(const HashC &) const
HashC::Add(const K &,const T &)
HashC::Add(const K &)
HashC::LookupHV(const K &,UIndex &) const
HashC::Del(HashElemT *,UIndex &)
HashC::GetTable_Internal(void) const
HashC::HashC(const SArray1dC &)
HashC::operator<<(ostream &,const HashC &)
HashC::LookupHV(const K &,HashBaseC::UIndex &) const
HashC::Del(HashElemT *,HashBaseC::UIndex &)
HashC::Resize(HashBaseC::USize)
|
Comments:
It is recomended to use HashARC, unless you know how many items will be put in
the table before its created.
Type K is the hash key, it mush define a function
unsigned int K::Hash(); which returns a number fairly unique to the key.
or a global function of the form UIntT StdHash(const K &x) which returns the key.
bool K::operator== (const K &Oth); to test equality.
!!!!! Update() Require's a default constructor & a working assigment operator !!!!!
Few things to bare in mind when writing StdHash() functions.
1) Try and use all the bits in the values being hashed.
2) Use quick operations that tend to preserve the number of bits in the value.
ie '+' '^' '-'
3) Try and generate a hash value which uses as many bits as possible,
but no more than the thing your hashing. i.e. ByteRGBValueC only
uses 21 bits, and so does the default hash value.
4) For best results try and generate a function which distributes key values
evenly over the range of hash values.
Parent Classes:
Derived Classes:
Typedefs:
- typedef T ElementT;
-
Allow function templates to find type of array.
- typedef K KeyT;
-
Allow function templates to find type of index.
- typedef HashIterC<K,T> IteratorT;
-
Type of iterator.
- typedef HashElemT<K,T> HashElem;
-
- typedef SLListC<HashElemT<K,T>> HashElemLst;
-
- typedef SLConstIterC<HashElemT<K,T>> HashElemConstIter;
-
- typedef SLIterC<HashElemT<K,T>> HashElemIter;
-
Used in Del.
These typedef's control the types of lists used in this class
and it's iterator.
Variables:
- SArray1dC Table;
-
friend HashIterT;
Methods:
- HashC(UIndex nBins = 23)
-
Create table with nBins.
Bin size must be at least 1.
- HashC(const HashC<K,T> & Oth)
-
Copy access structure.
- HashC(istream & in)
-
Recreate from stream.
- HashC<K,T> Copy() const
-
Make a copy of the table.
- const T * Lookup(const K & Key) const
-
Find data matching key.
Ptr == NULL, if matching key not found.
- T * Lookup(const K & Key)
-
Find data matching key.
Ptr == NULL, if matching key not found.
- BooleanT Lookup(const K & Key,T & data)
-
Lookup data for key.
Returns true if data is found, copy is place in 'data'.
- BooleanT Update(const K & Key,const T & Data)
-
Update member of HashTable, will create new one if it doesn't
exist.
Require's a default constructor & a working assigment operator !!
Returns: True=Member existed already. False=New one was added.
- T & Update(const K & Key)
-
Get value, add default if its not there. Return refrence anyway.
- T & operator[](const K & Key)
-
Associative array style interface.
- const T & operator[](const K & Key) const
-
Associative array style of access.
- BooleanT Insert(const K & Key,const T & Data)
-
Default insertion operation, same as Update(K,T);
- T & Access(const K & key,const T & def = T())
-
Access key, if it does exists create a new bin with value 'def'
Retuns a refrence to the new entry.
- BooleanT Del(const K & Key)
-
Delete member from table.
- T Get(const K & Key)
-
Get data element from table, and remove it.
- BooleanT IsElm(const K & Key) const
-
Is key used in the table ?
- void Empty(void)
-
Remove all items from table.
- UIntT Size(void) const
-
Count number of elements in table.
- BooleanT IsEmpty(void) const
-
Is the table empty ?
- UIndex Bins(void) const
-
Number of bins in the HashTable.
- void Resize(USize NewSize)
-
Resize HashCable.
WARNING: this empties the old table & creates a new one,
so it will leave other handles pointing to an empty hash
table.
- const HashC<K,T> & operator=(const HashC<K,T> & Oth)
-
Assign from another hash table.
- BooleanT IsSameTable(const HashC<K,T> & oth) const
-
- T & Add(const K & Key,const T & Data)
-
Add member to table.
!! Doesn't check if member already exists !!
- T & Add(const K & Key)
-
Add member created with default constructor.
!! Doesn't check if member already exists !!
- HashElemT<K,T> * LookupHV(const K & Value,UIndex & HashVal) const
-
- BooleanT Del(HashElemT<K,T> * Elem,UIndex & HashVal)
-
- SArray1dC<HashElemLst> & GetTable_Internal() const
-
Don't use this function, it's a bug work around,
and I'll remove it as soon as gcc is fixed.
- HashC(const SArray1dC<HashElemLst> & tab)
-
Creat new table from an array.
- ostream & operator<<(ostream & out,const HashC<K,T> & obj)
-
- HashElemT<K,T> * LookupHV(const K & Value,HashBaseC::UIndex & HashVal) const
-
////////////////////////////////
Lookup data in hash table, constant.
- BooleanT Del(HashElemT<K,T> * Elem,HashBaseC::UIndex & HashVal)
-
/////////////////////////////
Add member to table.
!! Doesn't check if member already exists !!
- void Resize(HashBaseC::USize NewSize)
-
|
Programmer:Charles Galambos, Documentation by CxxDoc: Tue Mar 20 10:49:27 2001
|