X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=include%2Flibfirm%2Fadt%2Fpmap.h;h=3bb507e164a4182e526f76ce7761a5d1549120c9;hb=485c69395f430b4ccc7118d69f52d914ad2124d8;hp=97c92461ae31831a340be63feae54271401f1a02;hpb=1a3b7d363474ab544c13093a2f0b578718d37c7a;p=libfirm diff --git a/include/libfirm/adt/pmap.h b/include/libfirm/adt/pmap.h index 97c92461a..3bb507e16 100644 --- a/include/libfirm/adt/pmap.h +++ b/include/libfirm/adt/pmap.h @@ -19,10 +19,9 @@ /** * @file - * @brief Simplified hashnap for pointer->pointer relations + * @brief Simplified hashmap for pointer->pointer relations * @author Hubert Schmid * @date 09.06.2002 - * @version $Id$ */ #ifndef FIRM_ADT_PMAP_H #define FIRM_ADT_PMAP_H @@ -31,6 +30,13 @@ #include "../begin.h" +/** + * @ingroup adt + * @defgroup pmap Pointer Map + * Pointer->Pointer hashmap + * @{ + */ + /** A map which maps addresses to addresses. */ typedef struct pmap pmap; @@ -62,11 +68,19 @@ FIRM_API void pmap_insert(pmap *map, const void * key, void * value); 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); /** @@ -79,6 +93,9 @@ FIRM_API pmap_entry *pmap_first(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)) @@ -87,6 +104,10 @@ FIRM_API pmap_entry *pmap_next(pmap *); */ FIRM_API void pmap_break(pmap *map); +/** + * @} + */ + #include "../end.h" #endif