get_match() method added to hashtable_t.

This commit is contained in:
Tobias Brunner
2012-05-24 15:15:34 +02:00
parent fa50a89c95
commit 0e5d587df7
2 changed files with 34 additions and 5 deletions
+17 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2010 Tobias Brunner
* Copyright (C) 2008-2012 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -77,6 +77,22 @@ struct hashtable_t {
*/
void *(*get) (hashtable_t *this, void *key);
/**
* Returns the value with a matching key, if the hash table contains such an
* entry, otherwise NULL is returned.
*
* Compared to get() the given match function is used to compare the keys
* for equality. The hash function does have to be deviced properly in
* order to make this work if the match function compares keys differently
* than the equals function provided to the constructor. This basically
* allows to enumerate all entries with the same hash value.
*
* @param key the key to match against
* @param match match function to be used when comparing keys
* @return the value, NULL if not found
*/
void *(*get_match) (hashtable_t *this, void *key, hashtable_equals_t match);
/**
* Removes the value with the given key from the hash table and returns the
* removed value (or NULL if no such value existed).