|
Objectively
Ultra-lightweight object oriented framework for GNU C.
|
#include <HashTable.h>
Hash tables with user-supplied hash and equality functions.
Definition at line 80 of file HashTable.h.
Properties | |
| size_t | count |
| The number of entries. | |
| Consumer | destroyKey |
| Optional destructor called when a key is removed or replaced. | |
| Consumer | destroyValue |
| Optional destructor called when a value is removed or replaced. | |
| HashTableEqualFunc | equal |
| The equality function. | |
| HashTableHashFunc | hash |
| The hash function. | |
| Object | object |
| The superclass. | |
Properties inherited from Object | |
| Class * | clazz |
| Every instance of Object begins with a pointer to its Class. | |
| unsigned int | magic |
| A header to allow introspection of Object types. | |
Methods | |
| Class * | _HashTable (void) |
| The HashTable archetype. | |
| bool | containsKey (const HashTable *self, const ident key) |
| void | enumerate (const HashTable *self, HashTableEnumerator enumerator, ident data) |
| Enumerates the entries of this HashTable with the given function. | |
| ident | get (const HashTable *self, const ident key) |
| HashTable * | init (HashTable *self, HashTableHashFunc hash, HashTableEqualFunc equal) |
| Initializes this HashTable with the given hash and equality functions. | |
| HashTable * | initWithCapacity (HashTable *self, HashTableHashFunc hash, HashTableEqualFunc equal, size_t capacity) |
| Initializes this HashTable with the given capacity. | |
| void | remove (HashTable *self, const ident key) |
| Removes the entry for the given key. | |
| void | removeAll (HashTable *self) |
| Removes all entries from this HashTable. | |
| void | set (HashTable *self, const ident key, const ident value) |
| Sets the value for the given key, replacing any existing entry. | |
Methods inherited from Object | |
| Class * | _Object (void) |
| The Object archetype. | |
| Object * | copy (const Object *self) |
| Creates a shallow copy of this Object. | |
| void | dealloc (Object *self) |
| Frees all resources held by this Object. | |
| String * | description (const Object *self) |
| int | hash (const Object *self) |
| Object * | init (Object *self) |
| Initializes this Object. | |
| bool | isEqual (const Object *self, const Object *other) |
| Tests equality of the other Object. | |
| bool | isKindOfClass (const Object *self, const Class *clazz) |
| Tests for Class hierarchy membership. | |
Protected Attributes | |
| HashTableEntry ** | buckets |
| The buckets. | |
| size_t | capacity |
| The number of buckets. | |
| HashTableInterface * | interface |
| The interface. | |
Protected Attributes inherited from Object | |
| ObjectInterface * | interface |
| The interface. | |
|
protected |
The buckets.
Definition at line 108 of file HashTable.h.
|
protected |
The number of buckets.
Definition at line 102 of file HashTable.h.
| size_t HashTable::count |
The number of entries.
Definition at line 96 of file HashTable.h.
| Consumer HashTable::destroyKey |
Optional destructor called when a key is removed or replaced.
Definition at line 123 of file HashTable.h.
| Consumer HashTable::destroyValue |
Optional destructor called when a value is removed or replaced.
Definition at line 128 of file HashTable.h.
| HashTableEqualFunc HashTable::equal |
The equality function.
Definition at line 118 of file HashTable.h.
| HashTableHashFunc HashTable::hash |
The hash function.
Definition at line 113 of file HashTable.h.
|
protected |
The interface.
Definition at line 91 of file HashTable.h.
| Object HashTable::object |
The superclass.
Definition at line 85 of file HashTable.h.
| Class * _HashTable | ( | void | ) |
The HashTable archetype.
Definition at line 328 of file HashTable.c.
| self | The HashTable. |
| key | The key. |
Definition at line 131 of file HashTable.c.
| void enumerate | ( | const HashTable * | self, |
| HashTableEnumerator | enumerator, | ||
| ident | data | ||
| ) |
Enumerates the entries of this HashTable with the given function.
| self | The HashTable. |
| enumerator | The enumerator function. |
| data | User data. |
Definition at line 139 of file HashTable.c.
| self | The HashTable. |
| key | The key. |
Definition at line 154 of file HashTable.c.
| HashTable * init | ( | HashTable * | self, |
| HashTableHashFunc | hash, | ||
| HashTableEqualFunc | equal | ||
| ) |
Initializes this HashTable with the given hash and equality functions.
| self | The HashTable. |
| hash | The hash function. |
| equal | The equality function. |
Definition at line 171 of file HashTable.c.
| HashTable * initWithCapacity | ( | HashTable * | self, |
| HashTableHashFunc | hash, | ||
| HashTableEqualFunc | equal, | ||
| size_t | capacity | ||
| ) |
Initializes this HashTable with the given capacity.
| self | The HashTable. |
| hash | The hash function. |
| equal | The equality function. |
| capacity | The initial bucket count. |
Definition at line 179 of file HashTable.c.
Removes the entry for the given key.
| self | The HashTable. |
| key | The key to remove. |
| void removeAll | ( | HashTable * | self | ) |
Removes all entries from this HashTable.
| self | The HashTable. |
Definition at line 227 of file HashTable.c.
Sets the value for the given key, replacing any existing entry.
| self | The HashTable. |
| key | The key. |
| value | The value. |
Definition at line 275 of file HashTable.c.