|
Yate
|
A hashed object list class. More...
#include <yateclass.h>
Public Member Functions | |
| HashList (unsigned int size=17) | |
| virtual | ~HashList () |
| virtual void * | getObject (const String &name) const |
| unsigned int | length () const |
| unsigned int | count () const |
| ObjList * | getList (unsigned int index) const |
| ObjList * | getHashList (unsigned int hash) const |
| ObjList * | getHashList (const String &str) const |
| GenObject * | operator[] (const String &str) const |
| ObjList * | find (const GenObject *obj) const |
| ObjList * | find (const String &str) const |
| ObjList * | append (const GenObject *obj) |
| GenObject * | remove (GenObject *obj, bool delobj=true) |
| void | clear () |
| bool | resync (GenObject *obj) |
| bool | resync () |
A hashed object list class.
A hashed object list handling class. Objects placed in the list are distributed according to their String hash resulting in faster searches. On the other hand an object placed in a hashed list must never change its String value or it becomes unfindable.
| HashList | ( | unsigned int | size = 17 | ) | [explicit] |
Creates a new, empty list.
| size | Number of classes to divide the objects |
| virtual ~HashList | ( | ) | [virtual] |
Destroys the list and everything in it.
Appends an object to the hashed list
| obj | Pointer to the object to append |
| void clear | ( | ) |
Clear the list and optionally delete all contained objects
| unsigned int count | ( | ) | const |
Get the number of non-null objects in the list
Get the item in the list that holds an object
| obj | Pointer to the object to search for |
| ObjList* getHashList | ( | unsigned int | hash | ) | const [inline] |
Retrieve one of the internal object lists knowing the hash value.
| hash | Hash of the internal list to retrieve |
| ObjList* getHashList | ( | const String & | str | ) | const [inline] |
Retrieve one of the internal object lists knowing the String value.
| str | String whose hash internal list is to retrieve |
References HashList::getHashList(), and String::hash().
Referenced by HashList::getHashList().
Retrieve one of the internal object lists. This method should be used only to iterate all objects in the list.
| index | Index of the internal list to retrieve |
Get a pointer to a derived class given that class name
| name | Name of the class we are asking for |
Reimplemented from GenObject.
| unsigned int length | ( | ) | const [inline] |
Get the number of hash entries
Array-like indexing operator
| str | String value of the object to locate |
Delete the list item that holds a given object
| obj | Object to search in the list |
| delobj | True to delete the object (default) |
Resync the list by checking if a stored object belongs to the list according to its hash
| obj | Object to resync in the list |
| bool resync | ( | ) |
Resync the list by checking if all stored objects belong to the list according to their hash
1.7.6.1