libFirm 1.20
libfirm/adt/pset_new.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1995-2008 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 
00031 #ifndef FIRM_ADT_PSET_NEW_H
00032 #define FIRM_ADT_PSET_NEW_H
00033 
00034 #include "../begin.h"
00035 
00038 #define HashSet          pset_new_t
00039 #define HashSetIterator  pset_new_iterator_t
00040 #define ValueType        void*
00041 #define DO_REHASH
00042 #include "hashset.h"
00043 #undef DO_REHASH
00044 #undef HashSet
00045 #undef HashSetIterator
00046 #undef ValueType
00047 
00051 typedef struct pset_new_t           pset_new_t;
00054 typedef struct pset_new_iterator_t  pset_new_iterator_t;
00055 
00061 FIRM_API void pset_new_init(pset_new_t *pset_new);
00062 
00069 FIRM_API void pset_new_init_size(pset_new_t *pset_new, size_t expected_elements);
00070 
00077 FIRM_API void pset_new_destroy(pset_new_t *pset_new);
00078 
00086 FIRM_API int pset_new_insert(pset_new_t *pset_new, void *ptr);
00087 
00095 FIRM_API void pset_new_remove(pset_new_t *pset_new, const void *ptr);
00096 
00104 FIRM_API int pset_new_contains(const pset_new_t *pset_new, const void *ptr);
00105 
00112 FIRM_API size_t pset_new_size(const pset_new_t *pset_new);
00113 
00121 FIRM_API void pset_new_iterator_init(pset_new_iterator_t *iterator, const pset_new_t *pset_new);
00122 
00132 FIRM_API void* pset_new_iterator_next(pset_new_iterator_t *iterator);
00133 
00140 FIRM_API void pset_new_remove_iterator(pset_new_t *pset_new, const pset_new_iterator_t *iterator);
00141 
00145 #define foreach_pset_new(pset_new, type, ptr, iter)    \
00146     for(pset_new_iterator_init(&iter, pset_new), \
00147         ptr = (type) pset_new_iterator_next(&iter);     \
00148         ptr != NULL; ptr = (type) pset_new_iterator_next(&iter))
00149 
00150 #include "../end.h"
00151 
00152 #endif