COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Public Member Functions | Protected Types | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
covise::coMultiHashBase< KEY, DATA > Class Template Referenceabstract

#include <coIntMultiHash.h>

Inheritance diagram for covise::coMultiHashBase< KEY, DATA >:
Inheritance graph
[legend]
Collaboration diagram for covise::coMultiHashBase< KEY, DATA >:
Collaboration graph
[legend]

Public Member Functions

 coMultiHashBase ()
 constructor More...
 
 coMultiHashBase (DATA nullelem)
 constructor More...
 
const DATA & getNullElem () const
 get the NULL element More...
 
virtual ~coMultiHashBase ()
 destructor More...
 
virtual int insert (const KEY &key, const DATA &inData)
 insert an entry (virtual for non-multi hash) More...
 
int remove (unsigned long hashIndex)
 remove an entry by hashIndex More...
 
void removeAll ()
 remove an entry by hashIndex More...
 
unsigned long getHash (const KEY &key) const
 get hash index, 0 if no element found More...
 
DATA & operator[] (unsigned long hashIndex)
 access element by hash index: assert() correct index !! More...
 
const DATA & operator[] (unsigned long hashIndex) const
 access element by hash index: assert() correct index !! More...
 
virtual unsigned long nextHash (unsigned long hashIndex) const
 get next hashIndex to given hashIndex More...
 
int getNumEntries () const
 get number of entries currently in hash More...
 
virtual unsigned long hash1 (const KEY &) const =0
 first hash function (pure virtual) More...
 
virtual unsigned long hash2 (const KEY &) const =0
 second hash function (pure virtual) More...
 
virtual bool equal (const KEY &, const KEY &) const =0
 KEY1 == KEY2 operation (pure virtual) More...
 

Protected Types

enum  { EMPTY = 0, PREVIOUS, USED }
 

Protected Attributes

KEY * keys
 
unsigned char * entryFlags
 
unsigned int size
 size of the list More...
 
unsigned int prime
 the prime currently used as the length of the list More...
 

Private Types

enum  { NUMPRIMES = 28 }
 

Private Member Functions

void resize (void)
 

Private Attributes

DATA d_nullElem
 
DATA * data
 
unsigned int entries
 
unsigned int maxEntries
 
int primeIndex
 

Friends

class coHashIter< KEY, DATA >
 
class coHashBase< KEY, DATA >
 

Detailed Description

template<class KEY, class DATA>
class covise::coMultiHashBase< KEY, DATA >

Virtual base class implementing the double-hashing algorithm.

Requires:

Users must derive a class and define:

Member Enumeration Documentation

template<class KEY, class DATA>
anonymous enum
private
Enumerator
NUMPRIMES 
template<class KEY, class DATA>
anonymous enum
protected
Enumerator
EMPTY 
PREVIOUS 
USED 

Constructor & Destructor Documentation

template<class KEY , class DATA >
covise::coMultiHashBase< KEY, DATA >::coMultiHashBase ( )
inline

constructor

template<class KEY , class DATA>
covise::coMultiHashBase< KEY, DATA >::coMultiHashBase ( DATA  nullelem)
inline

constructor

template<class KEY , class DATA >
covise::coMultiHashBase< KEY, DATA >::~coMultiHashBase ( )
inlinevirtual

destructor

Member Function Documentation

template<class KEY, class DATA>
virtual bool covise::coMultiHashBase< KEY, DATA >::equal ( const KEY &  ,
const KEY &   
) const
pure virtual

KEY1 == KEY2 operation (pure virtual)

Implemented in covise::coStringMultiHash< DATA >, covise::coIntMultiHash< DATA >, and covise::coHashBase< KEY, DATA >.

template<class KEY, class DATA >
unsigned long covise::coMultiHashBase< KEY, DATA >::getHash ( const KEY &  key) const
inline

get hash index, 0 if no element found

template<class KEY, class DATA>
const DATA& covise::coMultiHashBase< KEY, DATA >::getNullElem ( ) const
inline

get the NULL element

template<class KEY , class DATA >
int covise::coMultiHashBase< KEY, DATA >::getNumEntries ( ) const
inline

get number of entries currently in hash

template<class KEY, class DATA>
virtual unsigned long covise::coMultiHashBase< KEY, DATA >::hash1 ( const KEY &  ) const
pure virtual
template<class KEY, class DATA>
virtual unsigned long covise::coMultiHashBase< KEY, DATA >::hash2 ( const KEY &  ) const
pure virtual
template<class KEY, class DATA>
int covise::coMultiHashBase< KEY, DATA >::insert ( const KEY &  key,
const DATA &  inData 
)
inlinevirtual
template<class KEY , class DATA >
unsigned long covise::coMultiHashBase< KEY, DATA >::nextHash ( unsigned long  hashIndex) const
inlinevirtual

get next hashIndex to given hashIndex

Reimplemented in covise::coHashBase< KEY, DATA >.

template<class KEY , class DATA >
DATA & covise::coMultiHashBase< KEY, DATA >::operator[] ( unsigned long  hashIndex)
inline

access element by hash index: assert() correct index !!

template<class KEY , class DATA >
const DATA & covise::coMultiHashBase< KEY, DATA >::operator[] ( unsigned long  hashIndex) const
inline

access element by hash index: assert() correct index !!

template<class KEY , class DATA >
int covise::coMultiHashBase< KEY, DATA >::remove ( unsigned long  hashIndex)
inline

remove an entry by hashIndex

template<class KEY , class DATA >
void covise::coMultiHashBase< KEY, DATA >::removeAll ( )
inline

remove an entry by hashIndex

template<class KEY , class DATA >
void covise::coMultiHashBase< KEY, DATA >::resize ( void  )
inlineprivate

Friends And Related Function Documentation

template<class KEY, class DATA>
friend class coHashBase< KEY, DATA >
friend
template<class KEY, class DATA>
friend class coHashIter< KEY, DATA >
friend

Member Data Documentation

template<class KEY, class DATA>
DATA covise::coMultiHashBase< KEY, DATA >::d_nullElem
private
template<class KEY, class DATA>
DATA* covise::coMultiHashBase< KEY, DATA >::data
private
template<class KEY, class DATA>
unsigned int covise::coMultiHashBase< KEY, DATA >::entries
private
template<class KEY, class DATA>
unsigned char* covise::coMultiHashBase< KEY, DATA >::entryFlags
protected
template<class KEY, class DATA>
KEY* covise::coMultiHashBase< KEY, DATA >::keys
protected
template<class KEY, class DATA>
unsigned int covise::coMultiHashBase< KEY, DATA >::maxEntries
private
template<class KEY, class DATA>
unsigned int covise::coMultiHashBase< KEY, DATA >::prime
protected

the prime currently used as the length of the list

template<class KEY, class DATA>
int covise::coMultiHashBase< KEY, DATA >::primeIndex
private
template<class KEY, class DATA>
unsigned int covise::coMultiHashBase< KEY, DATA >::size
protected

size of the list


The documentation for this class was generated from the following files: