Data Structures
gfsmEnum.h File Reference

Abstract utilities for run-time value enumerations. More...

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

Go to the source code of this file.

Data Structures

struct  gfsmEnum
 Structure for mapping symbolic names to numeric IDs. More...

Types and constants

typedef gfsmEnum gfsmDirectEnum
 Enumeration of StateIds.
const guint gfsmEnumNone

Constructors etc.

#define gfsm_enum_new(key_hash_f)   gfsm_enum_new_full(NULL,key_hash_f,NULL,NULL)
#define gfsm_direct_enum_new()   gfsm_enum_new(g_direct_hash)
static gfsmEnumgfsm_enum_new_full (gfsmDupFunc key_dup_func, GHashFunc key_hash_func, GEqualFunc key_equal_func, GDestroyNotify key_destroy_func)
static void gfsm_enum_clear (gfsmEnum *en)
static void gfsm_enum_free (gfsmEnum *en)

Accessors

#define gfsm_enum_next_value(en)   ((en)->nxtval)
#define gfsm_enum_insert(en, key)   gfsm_enum_insert_full(en,key,gfsmEnumNone)
#define gfsm_enum_get(en, key)   gfsm_enum_insert(en,key)
static gboolean gfsm_enum_lookup_extended (gfsmEnum *en, gconstpointer lookup_key, gpointer *stored_key, gpointer *stored_val)
static guint gfsm_enum_lookup (gfsmEnum *en, gconstpointer key)
static guint gfsm_enum_insert_full (gfsmEnum *en, gpointer key, guint val)

Detailed Description

Macro Definition Documentation

#define gfsm_enum_new (   key_hash_f)    gfsm_enum_new_full(NULL,key_hash_f,NULL,NULL)

create a new gfsmEnum (no copying)

#define gfsm_direct_enum_new ( )    gfsm_enum_new(g_direct_hash)

create a new gfsmDirectEnum

#define gfsm_enum_next_value (   en)    ((en)->nxtval)

Get next available value

#define gfsm_enum_insert (   en,
  key 
)    gfsm_enum_insert_full(en,key,gfsmEnumNone)

Insert a (possibly new) value val for key

#define gfsm_enum_get (   en,
  key 
)    gfsm_enum_insert(en,key)

Really just an alias for gfsm_enum_insert(en,key)

Typedef Documentation

Function Documentation

static gfsmEnum* gfsm_enum_new_full ( gfsmDupFunc  key_dup_func,
GHashFunc  key_hash_func,
GEqualFunc  key_equal_func,
GDestroyNotify  key_destroy_func 
)
inlinestatic

create a new gfsmEnum (full version)

static void gfsm_enum_clear ( gfsmEnum en)
inlinestatic

Clear a gfsmEnum

static void gfsm_enum_free ( gfsmEnum en)
inlinestatic

Free a gfsmEnum

static gboolean gfsm_enum_lookup_extended ( gfsmEnum en,
gconstpointer  lookup_key,
gpointer *  stored_key,
gpointer *  stored_val 
)
inlinestatic

Lookup the numeric value associated with lookup_key. On return, *stored_key points to the original (stored) key, if any; and *stored_value points to the stored value.

Returns
true iff a value for key was already stored
static guint gfsm_enum_lookup ( gfsmEnum en,
gconstpointer  key 
)
inlinestatic

Lookup the numeric value associated with key.

Returns
the value associated with key, or gfsmEnumNone if no such value was found
static guint gfsm_enum_insert_full ( gfsmEnum en,
gpointer  key,
guint  val 
)
inlinestatic

Insert or overwrite new value val for key. If val is gfsmEnumNone, the next available value will be used.

Returns
new value for key

Variable Documentation

const guint gfsmEnumNone

Constant indicating failed gfsmEnum value-lookup