libFirm 1.20
libfirm/adt/cpset.h File Reference

a set of pointers with a custom compare function More...

#include "../begin.h"
#include "hashset.h"
#include "../end.h"

Go to the source code of this file.

Typedefs

typedef int(* cpset_cmp_function )(const void *p1, const void *p2)
 The type of a cpset compare function.
typedef unsigned(* cpset_hash_function )(const void *obj)
 The type of a cpset hash function.
typedef struct cpset_t cpset_t
 a pointer set with custom compare function
typedef struct cpset_iterator_t cpset_iterator_t
 iterator over a pointer set with custom compare function

Functions

void cpset_init (cpset_t *cpset, cpset_hash_function hash_function, cpset_cmp_function cmp_function)
 Initializes a cpset.
void cpset_init_size (cpset_t *cpset, cpset_hash_function hash_function, cpset_cmp_function cmp_function, size_t expected_elements)
 Initializes a cpset.
void cpset_destroy (cpset_t *cpset)
 Destroys a cpset and frees the memory allocated for hashtable.
void * cpset_insert (cpset_t *cpset, void *obj)
 Inserts an element into a cpset.
void cpset_remove (cpset_t *cpset, const void *obj)
 Removes an element from a cpset.
void * cpset_find (const cpset_t *cpset, const void *obj)
 Tests whether a cpset contains a pointer.
size_t cpset_size (const cpset_t *cpset)
 Returns the number of pointers contained in the cpset.
void cpset_iterator_init (cpset_iterator_t *iterator, const cpset_t *cpset)
 Initializes a cpset iterator.
void * cpset_iterator_next (cpset_iterator_t *iterator)
 Advances the iterator and returns the current element or NULL if all elements in the cpset have been processed.
void cpset_remove_iterator (cpset_t *cpset, const cpset_iterator_t *iterator)
 Removed the element the iterator currently points to.

Detailed Description

a set of pointers with a custom compare function

Date:
16.03.2007
Author:
Matthias Braun

Definition in file cpset.h.