Developer Documentation
Centre for Vision, Speech & Signal Processing
USER IN NAMESPACE AMMA TREE ROOT AMMA SEARCH AMMA HOME
 

  PUBLIC
HashARC::HashARC(void)
HashARC::HashARC(istream &)
HashARC::HashARC(UIndex)
HashARC::HashARC(const HashARC &)
HashARC::HashARC(Tuple2C *)
HashARC::Copy(void) const
HashARC::Lookup(const K &) const
HashARC::Lookup(const K &)
HashARC::Lookup(const K &,T &)
HashARC::Update(const K &,const T &)
HashARC::Update(const K &)
HashARC::Insert(const K &,const T &)
HashARC::Access(const K &,const T &)
HashARC::operator[](const K &)
HashARC::operator[](const K &) const
HashARC::Del(const K &)
HashARC::DelNoResize(const K &)
HashARC::Get(const K &)
HashARC::IsElm(const K &) const
HashARC::Empty(void)
HashARC::IsEmpty(void) const
HashARC::Size(void) const
HashARC::Move(HashARC &)
HashARC::AddFrom(HashARC &,BooleanT)
HashARC::Add(const HashARC &)
HashARC::operator=(const HashARC &)
HashARC::operator==(const HashARC &) const
HashARC::operator!=(const HashARC &) const
HashARC::Hash(void) const
HashARC::GetTable_Internal(void) const
HashARC::Add(const K &,const T &)
HashARC::Add(const K &)
HashARC::CheckAdd(void)
HashARC::CheckDel(void)
HashARC::AccessTable(void)
HashARC::AccessTable(void) const
HashARC::operator>>(istream &,HashARC &)
HashARC::operator<<(BinOStreamC &,const HashARC &)
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::operator<<(ostream &,const HashC &)
HashC::LookupHV(const K &,HashBaseC::UIndex &) const
HashC::Del(HashElemT *,HashBaseC::UIndex &)
HashC::Resize(HashBaseC::USize)
HashARC<class K,class T>
 
Auto resizing hash-table.
 
include "amma/HashAR.hh"
User Level:Default
Library:Hash1d
Example:WordFreq.cc
Section:Containers.Hash Tables
In Scope:std

Comments:
This is a SMALL object !

Though this inherits from HashT which is a big-object, this function's effectively random use of Resize, means handle to this table may be damages without warning.

For a reference counted version of this class see RCHashARC

HashARC should inherit HashC privately, but because of bugs in g++ this stops the iterator working (the iterator should really be a friend.) I'll fix this hopefully with the next release of gcc.

Parent Classes: Variables:
UIndex Elements;
friend HashIterT;

Methods:
HashARC()
Default constructor.

HashARC(istream & in)
Stream constructor.

HashARC(UIndex nBins)
Create table with nBins.
Bin size must be at least 1.

HashARC(const HashARC<K,T> & Oth)
Copy table.

HashARC(Tuple2C<K,T> * data)
Initalise from simple array.
NB. Array must be terminated by a duplicate of the first key. (i.e. == must return true between them)

HashARC<K,T> Copy() const
Make a copy.

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 HashCable, will create new one if it doesn't
exist. 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.

BooleanT Insert(const K & Key,const T & Data)
Standard insert function, as Update(K,T).
Returns: True=Member existed already. False=New one was added.

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.

T & operator[](const K & Key)
Associative array style of access.

const T & operator[](const K & Key) const
Associative array style of access.

BooleanT Del(const K & Key)
Delete member from table.
Returns TRUE if Key was in hash table.

BooleanT DelNoResize(const K & Key)
Delete member from table, without resizing.

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.

BooleanT IsEmpty(void) const
Is table empty ?

UIntT Size(void) const
Number of elements in table.

void Move(HashARC<K,T> & oth)
Move contents of another table into this one.
leave other empty. The previous contents of this table are removed.

void AddFrom(HashARC<K,T> & oth,BooleanT replace = true)
Add contents of another table into this one.
leave other empty. if replace is true the old table

void Add(const HashARC<K,T> & oth)
Add contents of another table into this one.

const HashARC<K,T> & operator=(const HashARC<K,T> & oth)

bool operator==(const HashARC<K,T> & oth) const
Is this hash table the same as another ?

bool operator!=(const HashARC<K,T> & oth) const
Is this hash table different from another ?

UIntT Hash() const
Get a hash value for the hash table.

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.

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 !!

void CheckAdd(void)
Need to increase size ?

void CheckDel(void)
Need to decrease size ?

SArray1dC<HashElemLst> & AccessTable()

const SArray1dC<HashElemLst> & AccessTable() const

istream & operator>>(istream & in,HashARC<K,T> & obj)

BinOStreamC & operator<<(BinOStreamC & out,const HashARC<K,T> & oth)

#include "amma/Hash.hh"
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.

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