This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
forked from FooBarWidget/rubyenterpriseedition187-248
-
Notifications
You must be signed in to change notification settings - Fork 5
/
pointerset.h
56 lines (46 loc) · 1.41 KB
/
pointerset.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* A specialized set data structure, designed to only contain pointers.
* It will grow and shrink dynamically.
*/
#ifndef _POINTER_SET_H_
#define _POINTER_SET_H_
typedef void * PointerSetElement;
typedef struct _PointerSet PointerSet;
/**
* Create a new, empty pointer set.
*/
PointerSet *pointer_set_new();
/**
* Free the given pointer set.
*/
void pointer_set_free(PointerSet *set);
/**
* Insert the given pointer into the pointer set. The data that the
* pointer pointers to is not touched, so <tt>element</tt> may even be
* an invalid pointer.
*/
void pointer_set_insert(PointerSet *set, PointerSetElement element);
/**
* Remove the given pointer from the pointer set. Nothing will happen
* if the pointer isn't already in the set.
*/
void pointer_set_delete(PointerSet *set, PointerSetElement element);
/**
* Check whether the given pointer is in the pointer set.
*/
int pointer_set_contains(PointerSet *set, PointerSetElement element);
/**
* Clear the pointer set.
*/
void pointer_set_reset(PointerSet *set);
/**
* Return the number of pointers in the pointer set.
*/
unsigned int pointer_set_get_size(PointerSet *set);
/**
* Return the amount of space that is used to store the pointers in the set.
*
* @invariant pointer_set_get_capacity(set) >= pointer_set_get_size(set)
*/
unsigned int pointer_set_get_capacity(PointerSet *set);
#endif /* _POINTER_SET_H_ */