version 3.3

VRS::NonPersistentHashTable< T > Class Template Reference

Template Hash Table Class. More...

#include <vrs/container/hashtable.h>

Inheritance diagram for VRS::NonPersistentHashTable< T >:

VRS::SharedObj VRS::Visitable VRS::HashTable< T >

List of all members.

Public Member Functions

 NonPersistentHashTable (unsigned int noOfElements=113)
bool contains (const T &t) const
const T * find (const T &t) const
unsigned int size () const
 `size' returns the number of elements currently included.
bool isEmpty () const
 Returns true, if the hashtable is empty.
bool insert (const T &t)
bool erase (const T &t)
void clear ()
Iterator< T > * newIterator () const
 VRS_TYPEINFO (NonPersistentHashTable, SharedObj)
 VRS_SERIALIZABLE_ABSTRACT_CLASS (NonPersistentHashTable)

Protected Member Functions

const T & get (unsigned int index) const

Protected Attributes

Iterator< T > * iterator_
unsigned int cachedAccum_
unsigned int cachedSlot_

Friends

class HashTableIterator< T >


Detailed Description

template<typename T>
class VRS::NonPersistentHashTable< T >

Template Hash Table Class.

Constructor & Destructor Documentation

template<typename T>
VRS::NonPersistentHashTable< T >::NonPersistentHashTable ( unsigned int  noOfElements = 113  ) 

Constraints for the template class:

  • T::T()
  • T::T(const T&)
  • T::operator=(const T&)
  • T::operator==(const T&)
  • unsigned int HashValue(const T&) The internal hash table size is calculated based on the estimated number of elements. Actually, a suitable prime number is used as hash table size. At this moment, there is no automatic resizing of the hashtable if the number of elements grows or shrinks. This might be included in the future.


Member Function Documentation

template<typename T>
bool VRS::NonPersistentHashTable< T >::contains ( const T &  t  )  const

`contains' returns true if the element "t" is included in the hash table. The test is based on `Toperator=='.

template<typename T>
const T* VRS::NonPersistentHashTable< T >::find ( const T &  t  )  const

`find' looks for "t" and returns a pointer to the element if it is included. Otherwise, "(T*)0" is returned.

template<typename T>
unsigned int VRS::NonPersistentHashTable< T >::size (  )  const

`size' returns the number of elements currently included.

template<typename T>
bool VRS::NonPersistentHashTable< T >::isEmpty (  )  const

Returns true, if the hashtable is empty.

template<typename T>
bool VRS::NonPersistentHashTable< T >::insert ( const T &  t  ) 

Inserts element "t". If "t" is included already, the entry "t" is overwritten and false is returned. If "t" has not been included before, true is returned.

template<typename T>
bool VRS::NonPersistentHashTable< T >::erase ( const T &  t  ) 

template<typename T>
void VRS::NonPersistentHashTable< T >::clear (  ) 

`erase' excludes element "t". `clear' cleans the hash table completly.

template<typename T>
Iterator<T>* VRS::NonPersistentHashTable< T >::newIterator (  )  const

Creates an instance of an Iterator Note that no order for the elements can be assumed.

template<typename T>
VRS::NonPersistentHashTable< T >::VRS_TYPEINFO ( NonPersistentHashTable< T >  ,
SharedObj   
)

template<typename T>
VRS::NonPersistentHashTable< T >::VRS_SERIALIZABLE_ABSTRACT_CLASS ( NonPersistentHashTable< T >   ) 

template<typename T>
const T& VRS::NonPersistentHashTable< T >::get ( unsigned int  index  )  const [protected]


Friends And Related Function Documentation

template<typename T>
friend class HashTableIterator< T > [friend]


Member Data Documentation

template<typename T>
Iterator<T>* VRS::NonPersistentHashTable< T >::iterator_ [mutable, protected]

template<typename T>
unsigned int VRS::NonPersistentHashTable< T >::cachedAccum_ [mutable, protected]

template<typename T>
unsigned int VRS::NonPersistentHashTable< T >::cachedSlot_ [mutable, protected]


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

Generated on Tue May 22 06:00:19 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact