/**
* @file
- * @brief Simplified hashnap for pointer->pointer relations
+ * @brief Simplified hashmap for pointer->pointer relations
* @author Hubert Schmid
* @date 09.06.2002
*/
#include "../begin.h"
+/**
+ * @ingroup adt
+ * @defgroup pmap Pointer Map
+ * Pointer->Pointer hashmap
+ * @{
+ */
+
/** A map which maps addresses to addresses. */
typedef struct pmap pmap;
FIRM_API int pmap_contains(pmap *map, const void * key);
/** Returns the key, value pair of "key". */
-FIRM_API pmap_entry * pmap_find(pmap *map, const void * key);
+FIRM_API pmap_entry *pmap_find(pmap *map, const void * key);
/** Returns the value of "key". */
FIRM_API void * pmap_get(pmap *map, const void * key);
+/**
+ * Returns the value of "key".
+ * This is a wrapper for pmap_get(pmap *map); It allows to express the
+ * intended type of the set elements (instead of weakly typed void*).
+ */
+#define pmap_get(type, map, key) ((type*)pmap_get(map, key))
+
+/** Return number of elements in the map */
FIRM_API size_t pmap_count(pmap *map);
/**
*/
FIRM_API pmap_entry *pmap_next(pmap *);
+/**
+ * Iterate over all elements in the map setting curr to the current element.
+ */
#define foreach_pmap(pmap, curr) \
for (curr = pmap_first(pmap); curr; curr = pmap_next(pmap))
*/
FIRM_API void pmap_break(pmap *map);
+/**
+ * @}
+ */
+
#include "../end.h"
#endif