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

CNHashList Class Reference

The class CNHashList provides a hash table with unrestricted capacity. More...

#include <HashList.h>

Inheritance diagram for CNHashList::

CNHashTable CNObject CNCL CNAssocMem List of all members.

Public Methods

 CNHashList (unsigned long cap=DEFAULT_HASH_TABLE_CAPACITY)
 Initializes CNHashList. More...

 CNHashList (CNParam *)
 Initializes CNHashList with CNParam.

 ~CNHashList (void)
 Default Destructor. Frees all internally allocated resources.

virtual void store_key (CNKey *k)
 Stores a key into the homogenous hash table. More...

virtual void store_key (CNKey &k)
 Stores a key into the homogenous hash table. More...

virtual CNKeyget_key (const CNKey *k) const
 Returns the key which matches the supplied key. More...

virtual CNKeyget_key (const CNKey &k) const
 Returns the key which matches the supplied key. More...

virtual CNObjectget_object (const CNKey *k) const
 Returns the object of the key which matches the supplied key. More...

virtual CNObjectget_object (const CNKey &k) const
 Returns the object of the key which matches the supplied key. More...

virtual bool reset ()
 FIXME: Undocumented.

virtual bool reset_absolutely ()
 Deletes all entries of the actual hash table and resets it to its initial state. More...

virtual bool reset_absolutely_w_obj ()
 Deletes all entries of the actual hash table and resets it to its initial state. More...

virtual bool delete_key (const CNKey *k)
 Deletes the key from the actual hash table which matches the given key. More...

virtual bool delete_key (const CNKey &k)
 Deletes the key from the actual hash table which matches the given key. More...

virtual bool delete_key_absolutely (const CNKey *k)
 The same as above. More...

virtual bool delete_key_absolutely (const CNKey &k)
 The same as above. More...

virtual bool delete_key_absolutely_w_obj (const CNKey *k)
 Deletes the key k from the actual hash table. More...

virtual bool delete_key_absolutely_w_obj (const CNKey &k)
 Deletes the key k from the actual hash table. More...

virtual bool is_full () const
 If the actual table's capacityis exhausted, TRUE s returned, otherwise FALSE.

virtual bool is_empty () const
 If the actual table is empty, TRUE is returned, otherwise FALSE.

virtual unsigned long get_capacity () const
 Returns the capacity of the current table.

virtual unsigned long get_num_entries () const
 Returns the number of entries of the actual table.

virtual CNClassDesc class_desc () const
 Returns the class description (pointer to instance of CNClass) for runtime type information.

virtual bool is_a (CNClassDesc desc) const
 Checks Type.

virtual void print (ostream &strm=cout) const
 Print output.

virtual void dump (ostream &strm=cout) const
 Degug output.


Static Public Methods

CNHashList * cast_from_object (CNObject *obj)
 Safes type Cast.

CNObjectnew_object (CNParam *param=NIL)
 Creates new Object.


Protected Methods

HashEntry * HashTable () const
 FIXME: Undocumented.


Friends

class CNHashIterator
class CNHashListIterator
 friend iterator class.


Detailed Description

The class CNHashList provides a hash table with unrestricted capacity.

Contrary to CNHashStatic the keys occuring more than once are stored in lists, i.e. the capacity of the hash table does not restrict the number of keys, that may be stored. Nontheless the capacity should be large enough for the number of keys to be stored in.


Constructor & Destructor Documentation

CNHashList::CNHashList unsigned long    cap = DEFAULT_HASH_TABLE_CAPACITY
 

Initializes CNHashList.

The hash table's capacity is set to the value passed to CNHashList. The capacity is static. Nontheless, you can store more keys since they are stored in lists.


Member Function Documentation

virtual bool CNHashList::delete_key const CNKey   k [inline, virtual]
 

Deletes the key from the actual hash table which matches the given key.

After having deleted a key from the hash table, it is not necessary to rehash the table. This method does not free the memory allocated for the keys stored in the hash table. If the supplied key does not match any in the table, FALSE is returned, otherwise TRUE.

Reimplemented from CNHashTable.

virtual bool CNHashList::delete_key const CNKey   k [virtual]
 

Deletes the key from the actual hash table which matches the given key.

After having deleted a key from the hash table, it is not necessary to rehash the table. This method does not free the memory allocated for the keys stored in the hash table. If the supplied key does not match any in the table, FALSE is returned, otherwise TRUE.

Reimplemented from CNHashTable.

virtual bool CNHashList::delete_key_absolutely const CNKey   k [inline, virtual]
 

The same as above.

This method does free the memory allocated for the keys stored in the hash table. If the supplied key does not match any in the table, FALSE is returned, otherwise TRUE.

Reimplemented from CNHashTable.

virtual bool CNHashList::delete_key_absolutely const CNKey   k [virtual]
 

The same as above.

This method does free the memory allocated for the keys stored in the hash table. If the supplied key does not match any in the table, FALSE is returned, otherwise TRUE.

Reimplemented from CNHashTable.

virtual bool CNHashList::delete_key_absolutely_w_obj const CNKey   k [inline, virtual]
 

Deletes the key k from the actual hash table.

This method frees the memory allocated for the key stored in the hash table and frees the memory allocated for the object stored in the key. If the supplied key does not match any in the table, FALSE is returned, otherwise TRUE.

Reimplemented from CNHashTable.

virtual bool CNHashList::delete_key_absolutely_w_obj const CNKey   k [virtual]
 

Deletes the key k from the actual hash table.

This method frees the memory allocated for the key stored in the hash table and frees the memory allocated for the object stored in the key. If the supplied key does not match any in the table, FALSE is returned, otherwise TRUE.

Reimplemented from CNHashTable.

virtual CNKey* CNHashList::get_key const CNKey   k const [inline, virtual]
 

Returns the key which matches the supplied key.

If no matching key was found, NIL is returned.

Reimplemented from CNHashTable.

virtual CNKey* CNHashList::get_key const CNKey   k const [virtual]
 

Returns the key which matches the supplied key.

If no matching key was found, NIL is returned.

Reimplemented from CNHashTable.

virtual CNObject* CNHashList::get_object const CNKey   k const [inline, virtual]
 

Returns the object of the key which matches the supplied key.

If no matching key was found or if no object has been stored in the key, NIL is returned

Reimplemented from CNHashTable.

virtual CNObject* CNHashList::get_object const CNKey   k const [virtual]
 

Returns the object of the key which matches the supplied key.

If no matching key was found or if no object has been stored in the key, NIL is returned

Reimplemented from CNHashTable.

virtual bool CNHashList::reset_absolutely   [virtual]
 

Deletes all entries of the actual hash table and resets it to its initial state.

This method does not free the memory allocated for the keys stored in the hash table or the objects stored in the keys. If the hash table is already empty, FALSE is returned, otherwise TRUE.

Reimplemented from CNHashTable.

virtual bool CNHashList::reset_absolutely_w_obj   [virtual]
 

Deletes all entries of the actual hash table and resets it to its initial state.

This method frees the memory allocated for the keys stored in the hash table or the objects stored in the keys. If the hash table is already empty, FALSE is returned, otherwise TRUE.

Reimplemented from CNHashTable.

virtual void CNHashList::store_key CNKey   k [inline, virtual]
 

Stores a key into the homogenous hash table.

Only keys of the same type may be stored into the same table. The methods get_key() and get_object() should detect it. If a hashvalue occures the second time it will be stored in a list. Therefore the hash table will never be full unless the memory is exhausted.

Reimplemented from CNHashTable.

virtual void CNHashList::store_key CNKey   k [virtual]
 

Stores a key into the homogenous hash table.

Only keys of the same type may be stored into the same table. The methods get_key() and get_object() should detect it. If a hashvalue occures the second time it will be stored in a list. Therefore the hash table will never be full unless the memory is exhausted.

Reimplemented from CNHashTable.


The documentation for this class was generated from the following file:
Generated on Fri Feb 1 19:55:35 2002 for CNCL by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001