5 typedef struct s_xbt_setset *xbt_setset_t;
7 typedef struct s_xbt_setset_set *xbt_setset_set_t;
9 typedef struct s_xbt_setset_cursor *xbt_setset_cursor_t;
11 #define XBT_SETSET_HEADERS \
15 xbt_setset_t xbt_setset_new(unsigned int size);
18 void xbt_setset_destroy(xbt_setset_t setset);
20 /* Create a new set in the setset */
21 xbt_setset_set_t xbt_setset_new_set(xbt_setset_t setset);
23 /* Destroy a set in the setset */
24 void xbt_setset_destroy_set(xbt_setset_set_t);
26 /* Insert an element into a set */
27 void xbt_setset_set_insert(xbt_setset_set_t set, void* obj);
29 /* Remove an element from a set */
30 void xbt_setset_set_remove(xbt_setset_set_t set, void* obj);
32 /* Remove all the elements of a set */
33 void xbt_setset_set_reset(xbt_setset_set_t set);
35 /* Select one element of a set */
36 void *xbt_setset_set_choose(xbt_setset_set_t set);
38 /* Extract one element of a set */
39 void *xbt_setset_set_extract(xbt_setset_set_t set);
41 /* Test if an element belongs to a set */
42 int xbt_setset_set_belongs(xbt_setset_set_t set, void* obj);
44 /* Get the number of elements in a set */
45 int xbt_setset_set_size(xbt_setset_set_t set);
47 /* Add all elements of set2 to set1 */
48 void xbt_setset_add(xbt_setset_set_t set1, xbt_setset_set_t set2);
50 /* Substract all elements of set2 from set1 */
51 void xbt_setset_substract(xbt_setset_set_t set1, xbt_setset_set_t set2);
53 /* Intersect set1 and set2 storing the result in set1 */
54 void xbt_setset_intersect(xbt_setset_set_t set1, xbt_setset_set_t set2);
56 /* Get the cursor to point to the first element of a set */
57 void xbt_setset_cursor_first(xbt_setset_set_t set, xbt_setset_cursor_t *cursor);
59 /* Get the data pointed by a cursor */
60 int xbt_setset_cursor_get_data(xbt_setset_cursor_t cursor, void **data);
62 /* Advance a cursor to the next element */
63 void xbt_setset_cursor_next(xbt_setset_cursor_t cursor);
66 #define xbt_setset_foreach(set, cursor, data) \
67 for(xbt_setset_cursor_first(set, &cursor); \
68 xbt_setset_cursor_get_data(cursor, (void **)&data); \
69 xbt_setset_cursor_next(cursor))