Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkHashMap< KeyType, DataType > Class Template Reference

a dynamic map data structure More...

#include <vtkHashMap.h>

Inheritance diagram for vtkHashMap< KeyType, DataType >:

Inheritance graph
[legend]
Collaboration diagram for vtkHashMap< KeyType, DataType >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef vtkAbstractMap< KeyType,
DataType > 
Superclass
typedef vtkHashMapIterator<
KeyType, DataType > 
IteratorType

Public Member Functions

void PrintSelf (ostream &os, vtkIndent indent)
vtkHashMapIterator< KeyType,
DataType > * 
NewIterator ()
int SetItem (const KeyType &key, const DataType &data)
int RemoveItem (const KeyType &key)
void RemoveAllItems ()
int GetItem (const KeyType &key, DataType &data)
vtkIdType GetNumberOfItems () const
void SetMaximumLoadFactor (float factor)
float GetMaximumLoadFactor () const
void SetNumberOfBuckets (vtkIdType n)
vtkIdType GetNumberOfBuckets () const

Static Public Member Functions

vtkHashMap< KeyType, DataType > * New ()

Protected Types

typedef vtkAbstractMapItem<
KeyType, DataType > 
ItemType
typedef vtkVector< ItemTypeBucketType

Protected Member Functions

 vtkHashMap ()
virtual ~vtkHashMap ()
void CheckLoadFactor ()
void RehashItems (vtkIdType newNumberOfBuckets)
vtkIdType HashKey (const KeyType &key, vtkIdType nbuckets)

Protected Attributes

float MaximumLoadFactor
vtkIdType NumberOfItems
vtkIdType NumberOfBuckets
BucketType ** Buckets

Friends

class vtkHashMapIterator< KeyType, DataType >

Detailed Description

template<class KeyType, class DataType>
class vtkHashMap< KeyType, DataType >

a dynamic map data structure

vtkHashMap is a an array implementation of the map data structure

Map data structure is a one dimensional sequence of pairs of key and data. On the higher level, it implements mapping from key values to data elements. It can be implemented using array of pairs, hash table, or different trees.

See also:
vtkAbstractMap

Definition at line 37 of file vtkHashMap.h.


Member Typedef Documentation

template<class KeyType, class DataType>
typedef vtkAbstractMap<KeyType,DataType> vtkHashMap< KeyType, DataType >::Superclass
 

Reimplemented from vtkAbstractMap< KeyType, DataType >.

Definition at line 42 of file vtkHashMap.h.

template<class KeyType, class DataType>
typedef vtkHashMapIterator<KeyType,DataType> vtkHashMap< KeyType, DataType >::IteratorType
 

Definition at line 43 of file vtkHashMap.h.

template<class KeyType, class DataType>
typedef vtkAbstractMapItem<KeyType,DataType> vtkHashMap< KeyType, DataType >::ItemType [protected]
 

Definition at line 96 of file vtkHashMap.h.

template<class KeyType, class DataType>
typedef vtkVector<ItemType> vtkHashMap< KeyType, DataType >::BucketType [protected]
 

Definition at line 97 of file vtkHashMap.h.


Constructor & Destructor Documentation

template<class KeyType, class DataType>
vtkHashMap< KeyType, DataType >::vtkHashMap  )  [protected]
 

template<class KeyType, class DataType>
virtual vtkHashMap< KeyType, DataType >::~vtkHashMap  )  [protected, virtual]
 


Member Function Documentation

template<class KeyType, class DataType>
void vtkHashMap< KeyType, DataType >::PrintSelf ostream &  os,
vtkIndent  indent
 

template<class KeyType, class DataType>
vtkHashMap<KeyType,DataType>* vtkHashMap< KeyType, DataType >::New  )  [static]
 

template<class KeyType, class DataType>
vtkHashMapIterator<KeyType,DataType>* vtkHashMap< KeyType, DataType >::NewIterator  ) 
 

Return an iterator to the list. This iterator is allocated using New, so the developer is responsible for deleating it.

template<class KeyType, class DataType>
int vtkHashMap< KeyType, DataType >::SetItem const KeyType &  key,
const DataType &  data
 

Sets the item with the given key to the given data. It overwrites the old value if it exists, or inserts a new value otherwise. It returns VTK_OK if successfull.

template<class KeyType, class DataType>
int vtkHashMap< KeyType, DataType >::RemoveItem const KeyType &  key  ) 
 

Removes the item with the given key from the map. It returns VTK_OK if successfull.

template<class KeyType, class DataType>
void vtkHashMap< KeyType, DataType >::RemoveAllItems  ) 
 

Remove all items from the map.

template<class KeyType, class DataType>
int vtkHashMap< KeyType, DataType >::GetItem const KeyType &  key,
DataType &  data
 

Get the data asociated with the given key. It returns VTK_OK if successfull.

template<class KeyType, class DataType>
vtkIdType vtkHashMap< KeyType, DataType >::GetNumberOfItems  )  const
 

Return the number of items currently held in this container.

template<class KeyType, class DataType>
void vtkHashMap< KeyType, DataType >::SetMaximumLoadFactor float  factor  ) 
 

Set/Get the maximum allowed load factor. If the ratio of number of items to number of buckets exceeds this value, the number of buckets will be increased. A value of zero indicates that no re-hashing is to occur.

template<class KeyType, class DataType>
float vtkHashMap< KeyType, DataType >::GetMaximumLoadFactor  )  const
 

Set/Get the maximum allowed load factor. If the ratio of number of items to number of buckets exceeds this value, the number of buckets will be increased. A value of zero indicates that no re-hashing is to occur.

template<class KeyType, class DataType>
void vtkHashMap< KeyType, DataType >::SetNumberOfBuckets vtkIdType  n  ) 
 

Set/Get the number of buckets currently used in the hash table. Setting the number of buckets will automatically set the MaximumLoadFactor to 0 to prevent resizing.

template<class KeyType, class DataType>
vtkIdType vtkHashMap< KeyType, DataType >::GetNumberOfBuckets  )  const
 

Set/Get the number of buckets currently used in the hash table. Setting the number of buckets will automatically set the MaximumLoadFactor to 0 to prevent resizing.

template<class KeyType, class DataType>
void vtkHashMap< KeyType, DataType >::CheckLoadFactor  )  [protected]
 

template<class KeyType, class DataType>
void vtkHashMap< KeyType, DataType >::RehashItems vtkIdType  newNumberOfBuckets  )  [protected]
 

template<class KeyType, class DataType>
vtkIdType vtkHashMap< KeyType, DataType >::HashKey const KeyType &  key,
vtkIdType  nbuckets
[protected]
 

Hash a key to give an index in the range [0,nbuckets-1].


Friends And Related Function Documentation

template<class KeyType, class DataType>
friend class vtkHashMapIterator< KeyType, DataType > [friend]
 

Definition at line 39 of file vtkHashMap.h.


Member Data Documentation

template<class KeyType, class DataType>
float vtkHashMap< KeyType, DataType >::MaximumLoadFactor [protected]
 

Definition at line 110 of file vtkHashMap.h.

template<class KeyType, class DataType>
vtkIdType vtkHashMap< KeyType, DataType >::NumberOfItems [protected]
 

Definition at line 111 of file vtkHashMap.h.

template<class KeyType, class DataType>
vtkIdType vtkHashMap< KeyType, DataType >::NumberOfBuckets [protected]
 

Definition at line 112 of file vtkHashMap.h.

template<class KeyType, class DataType>
BucketType** vtkHashMap< KeyType, DataType >::Buckets [protected]
 

Definition at line 113 of file vtkHashMap.h.


The documentation for this class was generated from the following file:
Generated on Tue May 30 12:38:36 2006 for ParaView by doxygen 1.3.5