Typedefs
gfsmSet.h File Reference

Abstract set type using GTree. More...

#include <gfsmMem.h>
#include <gfsmSet.hi>
Include dependency graph for gfsmSet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

gfsmSet: Accessors
#define gfsm_set_contains(set, key)   g_tree_lookup(set,key)
#define gfsm_set_insert(set, key)   g_tree_insert(set,key,(gpointer)1)
#define gfsm_set_size(set)   g_tree_nnodes(set)
#define gfsm_set_remove(set, key)   g_tree_remove(set,key)
#define gfsm_set_foreach(set, func, data)   g_tree_foreach(set,func,data)

Typedefs

typedef GTree gfsmSet
 Type for sets of pointers really just an ugly wrapper for GTree.

Functions

gfsmSet: Algebra
static gfsmSetgfsm_set_union (gfsmSet *set1, gfsmSet *set2, gfsmDupFunc dupfunc)
static gfsmSetgfsm_set_difference (gfsmSet *set1, gfsmSet *set2)
gfsmSetgfsm_set_intersection (gfsmSet *set1, gfsmSet *set2)
gfsmSet: converters
static GSList * gfsm_set_to_slist (gfsmSet *set)
gboolean gfsm_set_to_slist_foreach_func (gpointer key, gpointer value, GSList **dst)
static void gfsm_set_to_ptr_array (gfsmSet *set, GPtrArray *array)
gboolean gfsm_set_to_ptr_array_foreach_func (gpointer key, gpointer value, GPtrArray *dst)

gfsmSet: Constructors etc.

#define gfsm_set_free   g_tree_destroy
static gfsmSetgfsm_set_new_full (GCompareDataFunc key_cmp_func, gpointer key_cmp_data, GDestroyNotify key_free_func)
static gfsmSetgfsm_set_new (GCompareFunc key_cmp_func)
static gfsmSetgfsm_set_copy (gfsmSet *dst, gfsmSet *src)
gboolean gfsm_set_copy_foreach_func (gpointer key, gpointer value, gfsmSet *dst)
void gfsm_set_clear (gfsmSet *set)

Detailed Description

Macro Definition Documentation

#define gfsm_set_free   g_tree_destroy

Destroy a set

void gfsm_set_free(gfsmSet *set);
#define gfsm_set_contains (   set,
  key 
)    g_tree_lookup(set,key)

check set membership

#define gfsm_set_insert (   set,
  key 
)    g_tree_insert(set,key,(gpointer)1)

insert a new key into the set

#define gfsm_set_size (   set)    g_tree_nnodes(set)

get size of set

#define gfsm_set_remove (   set,
  key 
)    g_tree_remove(set,key)

Remove an element from a set

#define gfsm_set_foreach (   set,
  func,
  data 
)    g_tree_foreach(set,func,data)

Traversal (see g_tree_foreach)

Typedef Documentation

typedef GTree gfsmSet

Function Documentation

static gfsmSet* gfsm_set_new_full ( GCompareDataFunc  key_cmp_func,
gpointer  key_cmp_data,
GDestroyNotify  key_free_func 
)
inlinestatic

Create and return a new set

static gfsmSet* gfsm_set_new ( GCompareFunc  key_cmp_func)
inlinestatic

gfsm_set_new(key_compare_func): create and return a new set (returned set will not free elements)

static gfsmSet* gfsm_set_copy ( gfsmSet dst,
gfsmSet src 
)
inlinestatic

Copy set src to dst.

Returns
dst
gboolean gfsm_set_copy_foreach_func ( gpointer  key,
gpointer  value,
gfsmSet dst 
)

Utilitiy for gfsm_set_copy()

void gfsm_set_clear ( gfsmSet set)

clear a set

static gfsmSet* gfsm_set_union ( gfsmSet set1,
gfsmSet set2,
gfsmDupFunc  dupfunc 
)
inlinestatic

Add all elements of set set2 to set1. If dupfunc is non-NULL, it will be used to copy elements from set2, otherwise elements will be copied as literal gpointer values.

Returns
altered set1
static gfsmSet* gfsm_set_difference ( gfsmSet set1,
gfsmSet set2 
)
inlinestatic

Remove all elements in set2 from set1.

Returns
altered set1
gfsmSet* gfsm_set_intersection ( gfsmSet set1,
gfsmSet set2 
)

Remove all elements from set1 which are not also in set2.

Returns
altered set1
static GSList* gfsm_set_to_slist ( gfsmSet set)
inlinestatic

Get a GSList of a set's elements

gboolean gfsm_set_to_slist_foreach_func ( gpointer  key,
gpointer  value,
GSList **  dst 
)

Low-level utilitity for gfsm_set_to_slist()

static void gfsm_set_to_ptr_array ( gfsmSet set,
GPtrArray *  array 
)
inlinestatic

Append a set's elements to a GPtrArray

gboolean gfsm_set_to_ptr_array_foreach_func ( gpointer  key,
gpointer  value,
GPtrArray *  dst 
)

Low-level foreach utilitity for gfsm_set_to_array()