libFirm 1.20
libfirm/adt/pmap.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1995-2011 University of Karlsruhe.  All right reserved.
00003  *
00004  * This file is part of libFirm.
00005  *
00006  * This file may be distributed and/or modified under the terms of the
00007  * GNU General Public License version 2 as published by the Free Software
00008  * Foundation and appearing in the file LICENSE.GPL included in the
00009  * packaging of this file.
00010  *
00011  * Licensees holding valid libFirm Professional Edition licenses may use
00012  * this file in accordance with the libFirm Commercial License.
00013  * Agreement provided with the Software.
00014  *
00015  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE.
00018  */
00019 
00026 #ifndef FIRM_ADT_PMAP_H
00027 #define FIRM_ADT_PMAP_H
00028 
00029 #include <stddef.h>
00030 
00031 #include "../begin.h"
00032 
00041 typedef struct pmap pmap;
00042 
00046 typedef struct pmap_entry {
00047     const void *key;    
00048     void *value;  
00049 } pmap_entry;
00050 
00051 
00053 FIRM_API pmap *pmap_create(void);
00054 
00056 FIRM_API pmap *pmap_create_ex(size_t slots);
00057 
00059 FIRM_API void pmap_destroy(pmap *);
00060 
00065 FIRM_API void pmap_insert(pmap *map, const void * key, void * value);
00066 
00068 FIRM_API int pmap_contains(pmap *map, const void * key);
00069 
00071 FIRM_API pmap_entry *pmap_find(pmap *map, const void * key);
00072 
00074 FIRM_API void * pmap_get(pmap *map, const void * key);
00075 
00077 FIRM_API size_t pmap_count(pmap *map);
00078 
00082 FIRM_API pmap_entry *pmap_first(pmap *map);
00083 
00087 FIRM_API pmap_entry *pmap_next(pmap *);
00088 
00092 #define foreach_pmap(pmap, curr) \
00093     for (curr = pmap_first(pmap); curr; curr = pmap_next(pmap))
00094 
00098 FIRM_API void pmap_break(pmap *map);
00099 
00104 #include "../end.h"
00105 
00106 #endif