| Top |
| #define | TP_TYPE_INTSET |
| void | (*TpIntFunc) () |
| TpIntset * | tp_intset_sized_new () |
| TpIntset * | tp_intset_new () |
| TpIntset * | tp_intset_new_containing () |
| void | tp_intset_destroy () |
| void | tp_intset_clear () |
| void | tp_intset_add () |
| gboolean | tp_intset_remove () |
| gboolean | tp_intset_is_member () |
| void | tp_intset_foreach () |
| GArray * | tp_intset_to_array () |
| TpIntset * | tp_intset_from_array () |
| gboolean | tp_intset_is_empty () |
| guint | tp_intset_size () |
| gboolean | tp_intset_is_equal () |
| TpIntset * | tp_intset_copy () |
| TpIntset * | tp_intset_intersection () |
| TpIntset * | tp_intset_union () |
| void | tp_intset_union_update () |
| TpIntset * | tp_intset_difference () |
| void | tp_intset_difference_update () |
| TpIntset * | tp_intset_symmetric_difference () |
| gchar * | tp_intset_dump () |
| void | tp_intset_fast_iter_init () |
| gboolean | tp_intset_fast_iter_next () |
A TpIntset is a set of unsigned integers, implemented as a dynamically-allocated sparse bitfield.
#define TP_TYPE_INTSET (tp_intset_get_type ())
The boxed type of a TpIntset.
Since 0.11.3
void (*TpIntFunc) (guint i,gpointer userdata);
A callback function acting on unsigned integers.
TpIntset *
tp_intset_new_containing (guint element);
Allocate a new integer set containing the given integer.
Since 0.7.26
gboolean tp_intset_remove (TpIntset *set,guint element);
Remove an integer from a TpIntset
gboolean tp_intset_is_member (const TpIntset *set,guint element);
Tests if element
is a member of set
void tp_intset_foreach (const TpIntset *set,TpIntFunc func,gpointer userdata);
Call func
(element, userdata
) for each element of set
, in order.
gboolean
tp_intset_is_empty (const TpIntset *set);
Return the same thing as (tp_intset_size (set) == 0),
but calculated more efficiently.
Since 0.11.6
TpIntset *
tp_intset_copy (const TpIntset *orig);
A set containing the same integers as orig
, to be freed with
tp_intset_destroy() by the caller
TpIntset * tp_intset_intersection (const TpIntset *left,const TpIntset *right);
The set of those integers which are in both left
and right
(analogous to the bitwise operation left & right), to be freed with
tp_intset_destroy() by the caller
TpIntset * tp_intset_union (const TpIntset *left,const TpIntset *right);
The set of those integers which are in either left
or right
(analogous to the bitwise operation left | right), to be freed with
tp_intset_destroy() by the caller
void tp_intset_union_update (TpIntset *self,const TpIntset *other);
Add each integer in other
to self
, analogous to the bitwise operation
self |= other.
Since 0.13.10
TpIntset * tp_intset_difference (const TpIntset *left,const TpIntset *right);
The set of those integers which are in left
and not in right
(analogous to the bitwise operation left & (~right)), to be freed with
tp_intset_destroy() by the caller
void tp_intset_difference_update (TpIntset *self,const TpIntset *other);
Remove each integer in other
from self
, analogous to the bitwise
operation self &= (~other).
Since 0.13.10
TpIntset * tp_intset_symmetric_difference (const TpIntset *left,const TpIntset *right);
The set of those integers which are in either left
or right
but not both (analogous to the bitwise operation left ^ right), to be freed
with tp_intset_destroy() by the caller
void tp_intset_fast_iter_init (TpIntsetFastIter *iter,const TpIntset *set);
Initialize iter
to iterate over set
in arbitrary order. iter
will become
invalid if set
is modified.
Since 0.11.6
gboolean tp_intset_fast_iter_next (TpIntsetFastIter *iter,guint *output);
Advances iter
and retrieves the integer it now points to. Iteration
is not necessarily in numerical order.
Since 0.11.6
typedef struct {
} TpIntsetFastIter;
An opaque structure representing iteration in undefined order over a set of
integers. Must be initialized with tp_intset_fast_iter_init().
Usage is similar to GHashTableIter:
1 2 3 4 5 6 7 8 9 |
TpIntsetFastIter iter; guint element; tp_intset_fast_iter_init (&iter, intset); while (tp_intset_fast_iter_next (&iter, &element)) { printf ("%u is in the intset\n", element); } |
Since 0.11.6