Data Structures
gfsmIndexed.h File Reference

First stab at indexed automata. More...

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

Go to the source code of this file.

Data Structures

struct  gfsmIndexedAutomaton
 Type for an indexed automaton. More...

Functions

Constructors etc.
static gfsmIndexedAutomatongfsm_indexed_automaton_new_full (gfsmAutomatonFlags flags, gfsmSRType srtype, gfsmStateId n_states, guint n_arcs)
static gfsmIndexedAutomatongfsm_indexed_automaton_new (void)
gfsmIndexedAutomatongfsm_indexed_automaton_copy (gfsmIndexedAutomaton *dst, gfsmIndexedAutomaton *src)
static gfsmIndexedAutomatongfsm_indexed_automaton_clone (gfsmIndexedAutomaton *xfsm)
static void gfsm_indexed_automaton_clear (gfsmIndexedAutomaton *xfsm)
static void gfsm_indexed_automaton_free (gfsmIndexedAutomaton *xfsm)
Import & Export
gfsmIndexedAutomatongfsm_automaton_to_indexed (gfsmAutomaton *fsm, gfsmIndexedAutomaton *xfsm)
gfsmAutomatongfsm_indexed_to_automaton (gfsmIndexedAutomaton *xfsm, gfsmAutomaton *fsm)
Accessors: gfsmIndexedAutomaton
static void gfsm_indexed_automaton_reserve_states (gfsmIndexedAutomaton *xfsm, gfsmStateId n_states)
static void gfsm_indexed_automaton_reserve_arcs (gfsmIndexedAutomaton *xfsm, guint n_arcs)
static void gfsm_indexed_automaton_sort (gfsmIndexedAutomaton *xfsm, gfsmArcCompMask sort_mask)
gfsmArcRange interface
static void gfsm_arcrange_open_indexed (gfsmArcRange *range, gfsmIndexedAutomaton *xfsm, gfsmStateId qid)

gfsmAutomaton API: automaton properties

#define gfsm_indexed_automaton_get_semiring(xfsm)   (xfsm->sr)
static gfsmSemiringgfsm_indexed_automaton_set_semiring (gfsmIndexedAutomaton *xfsm, gfsmSemiring *sr)
static void gfsm_indexed_automaton_set_semiring_type (gfsmIndexedAutomaton *xfsm, gfsmSRType srtype)
static gfsmStateId gfsm_indexed_automaton_n_states (gfsmIndexedAutomaton *xfsm)
static guint gfsm_indexed_automaton_n_arcs (gfsmIndexedAutomaton *xfsm)
static gfsmStateId gfsm_indexed_automaton_get_root (gfsmIndexedAutomaton *xfsm)
static void gfsm_indexed_automaton_set_root (gfsmIndexedAutomaton *xfsm, gfsmStateId qid)

gfsmAutomaton API: States

#define gfsm_indexed_automaton_set_final_state(xfsm, qid, is_final)   gfsm_indexed_automaton_set_final_state_full((xfsm),(qid),(is_final),(xfsm)->sr->one)
static gboolean gfsm_indexed_automaton_has_state (gfsmIndexedAutomaton *xfsm, gfsmStateId qid)
static gfsmStateId gfsm_indexed_automaton_ensure_state (gfsmIndexedAutomaton *xfsm, gfsmStateId qid)
static void gfsm_indexed_automaton_remove_state (gfsmIndexedAutomaton *fsm, gfsmStateId qid)
static void gfsm_indexed_automaton_set_final_state_full (gfsmIndexedAutomaton *fsm, gfsmStateId qid, gboolean is_final, gfsmWeight final_weight)
static gboolean gfsm_indexed_automaton_lookup_final (gfsmIndexedAutomaton *fsm, gfsmStateId id, gfsmWeight *wp)
static gboolean gfsm_indexed_automaton_state_is_final (gfsmIndexedAutomaton *xfsm, gfsmStateId qid)
static gfsmWeight gfsm_indexed_automaton_get_final_weight (gfsmIndexedAutomaton *xfsm, gfsmStateId qid)
static guint gfsm_indexed_automaton_out_degree (gfsmIndexedAutomaton *fsm, gfsmStateId qid)

Detailed Description

Macro Definition Documentation

#define gfsm_indexed_automaton_get_semiring (   xfsm)    (xfsm->sr)

Get pointer to the semiring associated with this automaton

#define gfsm_indexed_automaton_set_final_state (   xfsm,
  qid,
  is_final 
)    gfsm_indexed_automaton_set_final_state_full((xfsm),(qid),(is_final),(xfsm)->sr->one)

Set boolean final-state flag.

Returns
(void)

Function Documentation

static gfsmIndexedAutomaton* gfsm_indexed_automaton_new_full ( gfsmAutomatonFlags  flags,
gfsmSRType  srtype,
gfsmStateId  n_states,
guint  n_arcs 
)
inlinestatic

Create a new gfsmIndexedAutomaton, specifying some basic automaton & index structure

static gfsmIndexedAutomaton* gfsm_indexed_automaton_new ( void  )
inlinestatic

Create a new indexed automaton, using some default values

gfsmIndexedAutomaton* gfsm_indexed_automaton_copy ( gfsmIndexedAutomaton dst,
gfsmIndexedAutomaton src 
)

Copy a gfsmIndexedAutomaton src to dst.

Returns
dst
static gfsmIndexedAutomaton* gfsm_indexed_automaton_clone ( gfsmIndexedAutomaton xfsm)
inlinestatic

Create and return an exact clone of a gfsmIndexedAutomaton

static void gfsm_indexed_automaton_clear ( gfsmIndexedAutomaton xfsm)
inlinestatic
static void gfsm_indexed_automaton_free ( gfsmIndexedAutomaton xfsm)
inlinestatic
gfsmIndexedAutomaton* gfsm_automaton_to_indexed ( gfsmAutomaton fsm,
gfsmIndexedAutomaton xfsm 
)

Populate a gfsmIndexedAutomaton from a gfsmAutomaton

Parameters
fsmsource automaton
xfsmdestination indexed automaton, may be passed as NULL to create a new gfsmIndexedAutomaton
Returns
(new) indexed automaton xfsm
Note
implicitly clears xfsm
gfsmAutomaton* gfsm_indexed_to_automaton ( gfsmIndexedAutomaton xfsm,
gfsmAutomaton fsm 
)

Export a gfsmIndexedAutomaton to a gfsmAutomaton

Parameters
xfsmsource indexed automaton
fsmdestination :.gfsmAutomaton may be passed as NULL to create a new gfsmAutomaton
Returns
(new) automaton fsm
Note
implicitly clears fsm
static void gfsm_indexed_automaton_reserve_states ( gfsmIndexedAutomaton xfsm,
gfsmStateId  n_states 
)
inlinestatic

Reserve space for at least n_states states

static void gfsm_indexed_automaton_reserve_arcs ( gfsmIndexedAutomaton xfsm,
guint  n_arcs 
)
inlinestatic

Reserve space for at least n_arcs arcs

static void gfsm_indexed_automaton_sort ( gfsmIndexedAutomaton xfsm,
gfsmArcCompMask  sort_mask 
)
inlinestatic

(re-)sort arcs in a gfsmIndexedAutomaton

static gfsmSemiring* gfsm_indexed_automaton_set_semiring ( gfsmIndexedAutomaton xfsm,
gfsmSemiring sr 
)
inlinestatic

Set the semiring associated with this automaton

static void gfsm_indexed_automaton_set_semiring_type ( gfsmIndexedAutomaton xfsm,
gfsmSRType  srtype 
)
inlinestatic

Set the semiring associated with this automaton by semiring-type

static gfsmStateId gfsm_indexed_automaton_n_states ( gfsmIndexedAutomaton xfsm)
inlinestatic

Get number of states (constant time)

static guint gfsm_indexed_automaton_n_arcs ( gfsmIndexedAutomaton xfsm)
inlinestatic

Get total number of arcs (constant time)

static gfsmStateId gfsm_indexed_automaton_get_root ( gfsmIndexedAutomaton xfsm)
inlinestatic

Get Id of root node, or gfsmNoState if undefined

static void gfsm_indexed_automaton_set_root ( gfsmIndexedAutomaton xfsm,
gfsmStateId  qid 
)
inlinestatic

Set Id of root node, creating state if necessary

static gboolean gfsm_indexed_automaton_has_state ( gfsmIndexedAutomaton xfsm,
gfsmStateId  qid 
)
inlinestatic

Check whether automaton has a state with ID qid.

static gfsmStateId gfsm_indexed_automaton_ensure_state ( gfsmIndexedAutomaton xfsm,
gfsmStateId  qid 
)
inlinestatic

Ensures that state id exists

Returns
qid
static void gfsm_indexed_automaton_remove_state ( gfsmIndexedAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic
static void gfsm_indexed_automaton_set_final_state_full ( gfsmIndexedAutomaton fsm,
gfsmStateId  qid,
gboolean  is_final,
gfsmWeight  final_weight 
)
inlinestatic

Set final weight.

Returns
(void)
static gboolean gfsm_indexed_automaton_lookup_final ( gfsmIndexedAutomaton fsm,
gfsmStateId  id,
gfsmWeight wp 
)
inlinestatic

Lookup final weight.

Returns
TRUE iff state id is final, and sets *wp to its final weight.
static gboolean gfsm_indexed_automaton_state_is_final ( gfsmIndexedAutomaton xfsm,
gfsmStateId  qid 
)
inlinestatic

Is qid final in xfsm? Really just wraps gfsm_indexed_automaton_lookup_final()

static gfsmWeight gfsm_indexed_automaton_get_final_weight ( gfsmIndexedAutomaton xfsm,
gfsmStateId  qid 
)
inlinestatic

Get final weight for qid final in xfsm? Really just wraps gfsm_indexed_automaton_lookup_final()

static guint gfsm_indexed_automaton_out_degree ( gfsmIndexedAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Get number of outgoing arcs.

Returns
guint
static void gfsm_arcrange_open_indexed ( gfsmArcRange range,
gfsmIndexedAutomaton xfsm,
gfsmStateId  qid 
)
inlinestatic

Open a gfsmArcRange for outgoing arcs from state qid in xfsm