libFirm 1.20
libfirm/adt/cpset.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 
00026 #ifndef FIRM_ADT_CPSET_H
00027 #define FIRM_ADT_CPSET_H
00028 
00029 #include "../begin.h"
00030 
00046 typedef int (*cpset_cmp_function) (const void *p1, const void *p2);
00047 
00051 typedef unsigned (*cpset_hash_function) (const void *obj);
00052 
00055 #define HashSet          cpset_t
00056 #define HashSetIterator  cpset_iterator_t
00057 #define HashSetEntry     cpset_hashset_entry_t
00058 #define ValueType        void*
00059 #define ADDITIONAL_DATA  cpset_cmp_function cmp_function; cpset_hash_function hash_function;
00060 #include "hashset.h"
00061 #undef ADDITIONAL_DATA
00062 #undef ValueType
00063 #undef HashSetEntry
00064 #undef HashSetIterator
00065 #undef HashSet
00066 
00070 typedef struct cpset_t          cpset_t;
00073 typedef struct cpset_iterator_t cpset_iterator_t;
00074 
00082 FIRM_API void cpset_init(cpset_t *cpset, cpset_hash_function hash_function,
00083                 cpset_cmp_function cmp_function);
00084 
00093 FIRM_API void cpset_init_size(cpset_t *cpset, cpset_hash_function hash_function,
00094                      cpset_cmp_function cmp_function,
00095                      size_t expected_elements);
00096 
00103 FIRM_API void cpset_destroy(cpset_t *cpset);
00104 
00112 FIRM_API void* cpset_insert(cpset_t *cpset, void *obj);
00113 
00121 FIRM_API void cpset_remove(cpset_t *cpset, const void *obj);
00122 
00130 FIRM_API void *cpset_find(const cpset_t *cpset, const void *obj);
00131 
00138 FIRM_API size_t cpset_size(const cpset_t *cpset);
00139 
00147 FIRM_API void cpset_iterator_init(cpset_iterator_t *iterator, const cpset_t *cpset);
00148 
00158 FIRM_API void *cpset_iterator_next(cpset_iterator_t *iterator);
00159 
00166 FIRM_API void cpset_remove_iterator(cpset_t *cpset, const cpset_iterator_t *iterator);
00167 
00170 #include "../end.h"
00171 
00172 #endif