Arc (transition) index utilities.
More...
#include <gfsmArcIter.h>
#include <gfsmArcIndex.hi>
Go to the source code of this file.
Functions |
|
static gfsmArcTableIndex * | gfsm_arc_table_index_new (void) |
static gfsmArcTableIndex * | gfsm_arc_table_index_sized_new (gfsmStateId n_states, guint n_arcs) |
static void | gfsm_arc_table_index_resize (gfsmArcTableIndex *tab, gfsmStateId n_states, guint n_arcs) |
static gfsmStateId | gfsm_arc_table_index_n_states (gfsmArcTableIndex *tabx) |
static guint | gfsm_arc_table_index_n_arcs (gfsmArcTableIndex *tabx) |
gfsmArcTableIndex * | gfsm_arc_table_index_copy (gfsmArcTableIndex *dst, gfsmArcTableIndex *src) |
static gfsmArcTableIndex * | gfsm_arc_table_index_clone (gfsmArcTableIndex *src) |
static void | gfsm_arc_table_index_free (gfsmArcTableIndex *tabx) |
gfsmArcTableIndex * | gfsm_automaton_to_arc_table_index (gfsmAutomaton *fsm, gfsmArcTableIndex *tabx) |
void | gfsm_arc_table_index_sort_with_data (gfsmArcTableIndex *tabx, GCompareDataFunc compare_func, gpointer data) |
static void | gfsm_arc_table_index_sort_bymask (gfsmArcTableIndex *tabx, gfsmArcCompMask m, gfsmSemiring *sr) |
static guint | gfsm_arc_table_index_out_degree (gfsmArcTableIndex *tabx, gfsmStateId qid) |
gboolean | gfsm_arc_table_index_write_bin_handle (gfsmArcTableIndex *tabx, gfsmIOHandle *ioh, gfsmError **errp) |
gboolean | gfsm_arc_table_index_read_bin_handle (gfsmArcTableIndex *tabx, gfsmIOHandle *ioh, gfsmError **errp) |
|
static void | gfsm_arcrange_open_table_index (gfsmArcRange *range, gfsmArcTableIndex *tabx, gfsmStateId qid) |
static void | gfsm_arcrange_close (gfsmArcRange *range) |
static gboolean | gfsm_arcrange_ok (gfsmArcRange *range) |
static gfsmArc * | gfsm_arcrange_arc (gfsmArcRange *range) |
static void | gfsm_arcrange_next (gfsmArcRange *range) |
gfsmArcTable |
typedef GArray | gfsmArcTable |
| Type for dedicated block-wise storage of gfsmArc data: GArray of gfsmArc.
|
static gfsmArcTable * | gfsm_arc_table_new (void) |
static gfsmArcTable * | gfsm_arc_table_sized_new (guint n_arcs) |
static void | gfsm_arc_table_resize (gfsmArcTable *tab, guint n_arcs) |
static gfsmArcTable * | gfsm_arc_table_copy (gfsmArcTable *dst, gfsmArcTable *src) |
static gfsmArcTable * | gfsm_arc_table_clone (gfsmArcTable *src) |
static void | gfsm_arc_table_free (gfsmArcTable *tab) |
gfsmArcTable * | gfsm_automaton_to_arc_table (gfsmAutomaton *fsm, gfsmArcTable *tab) |
gfsmArcTable * | gfsm_arc_table_append_arclist (gfsmArcTable *tab, gfsmArcList *arcs) |
static gfsmArcTable * | gfsm_arc_table_append_arciter (gfsmArcTable *tab, gfsmArcIter *ai) |
static gfsmArcTable * | gfsm_arc_table_append_state (gfsmArcTable *tab, gfsmAutomaton *fsm, gfsmStateId qid) |
static void | gfsm_arc_table_sort_with_data (gfsmArcTable *tab, GCompareDataFunc compare_func, gpointer data) |
static void | gfsm_arc_table_sort_bymask (gfsmArcTable *tab, gfsmArcCompMask m, gfsmSemiring *sr) |
static gfsmArc * | gfsm_arc_table_seek (gfsmArcTable *tab, const gfsmArc *key, GCompareDataFunc compare_func, gpointer data) |
static gfsmArc * | gfsm_arc_table_seek_bymask (gfsmArcTable *tab, const gfsmArc *key, gfsmArcCompMask m, gfsmSemiring *sr) |
gboolean | gfsm_arc_table_write_bin_handle (gfsmArcTable *tab, gfsmIOHandle *ioh, gfsmError **errp) |
gboolean | gfsm_arc_table_read_bin_handle (gfsmArcTable *tab, gfsmIOHandle *ioh, gfsmError **errp) |
gfsmArcPtrTable |
typedef GPtrArray | gfsmArcPtrTable |
| Type for pointer-index of gfsmArc*: ::GPtrArray of gfsmArc*.
|
static gfsmArcPtrTable * | gfsm_arc_ptr_table_new (void) |
static gfsmArcPtrTable * | gfsm_arc_ptr_table_sized_new (guint n_arcs) |
static void | gfsm_arc_ptr_table_resize (gfsmArcPtrTable *ptab, guint n_arcs) |
static gfsmArcPtrTable * | gfsm_arc_ptr_table_copy (gfsmArcPtrTable *dst, gfsmArcPtrTable *src) |
static gfsmArcPtrTable * | gfsm_arc_ptr_table_clone (gfsmArcPtrTable *src) |
static void | gfsm_arc_ptr_table_free (gfsmArcPtrTable *ptab) |
gfsmArcPtrTable * | gfsm_arc_ptr_table_append_arclist (gfsmArcPtrTable *ptab, gfsmArcList *arcs) |
static gfsmArcPtrTable * | gfsm_arc_ptr_table_append_arciter (gfsmArcPtrTable *ptab, gfsmArcIter *ai) |
static gfsmArcPtrTable * | gfsm_arc_ptr_table_append_state (gfsmArcPtrTable *ptab, gfsmAutomaton *fsm, gfsmStateId qid) |
static void | gfsm_arc_ptr_table_sort_with_data (gfsmArcPtrTable *ptab, GCompareDataFunc compare_func, gpointer data) |
static void | gfsm_arc_ptr_table_sort_bymask (gfsmArcPtrTable *ptab, gfsmArcCompMask m, gfsmSemiring *sr) |
static gfsmArc * | gfsm_arc_ptr_table_seek (gfsmArcPtrTable *ptab, const gfsmArc *key, GCompareDataFunc compare_func, gpointer data) |
static gfsmArc * | gfsm_arc_ptr_table_seek_bymask (gfsmArcPtrTable *ptab, const gfsmArc *key, gfsmArcCompMask m, gfsmSemiring *sr) |
Detailed Description
Macro Definition Documentation
Typedef Documentation
element at qto is a GSList* which contains a data element gfsmArc* arc={qfrom,qto,lo,hi,w} whenever source fsm contains an arc arc={qfrom,qto,lo,hi,w} from qfrom.
- Note
- arc data pointed to is shared by source automaton and the gfsmReverseArcIndex!
Function Documentation
Create and return a new gfsmReverseArcIndex
- Note
- Caller is responsible for freeing the returned index when it is no longer needed.
Create a new gfsmReverseArcIndex, given number of states to be indexed
- Note
- Caller is responsible for freeing the returned index when it is no longer needed.
Populate a reversed arc index for fsm.
- Parameters
-
fsm | source automaton |
rarcs | Reverse arc index. May be passed as NULL to create a new arc index. |
- Returns
- rarcs if non-NULL, otherwise a new reverse arc index for fsm.
- Note
- Caller is responsible for freeing the returned index when it is no longer needed.
Free a gfsmReverseArcIndex
- Parameters
-
rarcs | reverse arc-index to be freed |
free_lists | If true, associated arc-lists will be freed. |
Create a new (empty) gfsmWeightVector
- Note
- Caller is responsible for freeing wv when it is no longer needed.
Create a new (empty) gfsmWeightVector, specifying initial size
- Note
- Caller is responsible for freeing the returned index when it is no longer needed.
Populate a gfsmWeightVector of state final weights in a gfsmAutomaton
- Parameters
-
fsm | source automaton |
wv | Final weight index May be passed as NULL to create a new index. |
- Returns
- wv if non-NULL, otherwise a new final weight index for fsm.
Write the contents of a gfsmWeightVector to a (binary) gfsmIOHandle.
- Parameters
-
wv | weight vector to write |
ioh | handle to which data is to be written |
errp | if an error occurs, *errp will hold an error message |
- Returns
- true on success
Read the contents of a gfsmWeightVector from a (binary) gfsmIOHandle.
- Parameters
-
wv | weight vector into which data is to be read |
ioh | handle from which data is to be read |
errp | if an error occurs, *errp will hold an error message |
- Returns
- true on success
static gfsmArcTable* gfsm_arc_table_sized_new |
( |
guint |
n_arcs | ) |
|
|
inlinestatic |
Create and return a new (empty) gfsmArcTable, specifying size
static void gfsm_arc_table_resize |
( |
gfsmArcTable * |
tab, |
|
|
guint |
n_arcs |
|
) |
| |
|
inlinestatic |
Populate a :gfsmArcTable by copying arcs from fsm
- Parameters
-
fsm | source automaton |
tab | arc table to populate. May be passed as NULL to create a new arc table. |
- Returns
- tab if non-NULL, otherwise a new gfsmArcTable for fsm.
- Note
- Caller is responsible for freeing tab when it is no longer needed.
Append arc values from a :gfsmArcList to a :gfsmArcTable
- Parameters
-
arcs | source list |
tab | arc table to which arc copies are to be appended. May be passed as NULL to create a new arc table. |
- Returns
- tab if non-NULL, otherwise a new gfsmArcTable
- Note
- Caller is responsible for freeing tab when it is no longer needed.
Append arc values from a :gfsmArcIter to a :gfsmArcTable
- Parameters
-
ai | source iterator |
tab | arc table to which arc copies are to be appended. May be passed as NULL to create a new arc table. |
- Returns
- tab if non-NULL, otherwise a new gfsmArcTable
- Note
- Caller is responsible for freeing tab when it is no longer needed.
Append arc values for outgoing arcs for state qid in automaton fsm to a :gfsmArcTable
- Parameters
-
fsm | source automaton |
qid | source state |
tab | arc table to populate. May be passed as NULL to create a new arc table. |
- Returns
- tab if non-NULL, otherwise a new gfsmArcTable
- Note
- Caller is responsible for freeing tab when it is no longer needed.
static void gfsm_arc_table_sort_with_data |
( |
gfsmArcTable * |
tab, |
|
|
GCompareDataFunc |
compare_func, |
|
|
gpointer |
data |
|
) |
| |
|
inlinestatic |
Sort all arcs in a gfsmArcTable using a user-specified comparison function
Search a gfsmArcTable tab sorted according to compare_func wrt data for the first element less-than or equal to key.
- Returns
- a pointer to the desired arc or NULL if no such element is found. Uses gfsm_array_lower_bound() (binary search)
Search a gfsmArcTable tab sorted according to mask m for semring sr for the first element less-than or equal to key.
- Returns
- a pointer to the desired arc or NULL if no such element is found. Uses gfsm_array_lower_bound() (binary search)
Write the contents of a gfsmArcTable to a (binary) gfsmIOHandle.
- Parameters
-
tab | table to write |
ioh | handle to which data is to be written |
errp | if an error occurs, *errp will hold an error message |
- Returns
- true on success
Read the contents of a gfsmArcTable from a (binary) gfsmIOHandle.
- Parameters
-
tab | table into which data is to be read |
ioh | handle from which data is to be read |
errp | if an error occurs, *errp will hold an error message |
- Returns
- true on success
static void gfsm_arc_ptr_table_resize |
( |
gfsmArcPtrTable * |
ptab, |
|
|
guint |
n_arcs |
|
) |
| |
|
inlinestatic |
Append arc values from a :gfsmArcList to a :gfsmArcPtrTable
- Parameters
-
arcs | source list |
tab | arc table to which arc copies are to be appended. May be passed as NULL to create a new arc table. |
- Returns
- tab if non-NULL, otherwise a new gfsmArcPtrTable
- Note
- Caller is responsible for freeing tab when it is no longer needed.
Append arc values from a :gfsmArcIter to a :gfsmArcPtrTable
- Parameters
-
ai | source iterator |
tab | arc table to which arc copies are to be appended. May be passed as NULL to create a new arc table. |
- Returns
- tab if non-NULL, otherwise a new gfsmArcPtrTable
- Note
- Caller is responsible for freeing tab when it is no longer needed.
Append arc values for outgoing arcs for state qid in automaton fsm to a :gfsmArcPtrTable
- Parameters
-
fsm | source automaton |
qid | source state |
tab | arc table to populate. May be passed as NULL to create a new arc table. |
- Returns
- tab if non-NULL, otherwise a new gfsmArcPtrTable
- Note
- Caller is responsible for freeing tab when it is no longer needed.
static void gfsm_arc_ptr_table_sort_with_data |
( |
gfsmArcPtrTable * |
ptab, |
|
|
GCompareDataFunc |
compare_func, |
|
|
gpointer |
data |
|
) |
| |
|
inlinestatic |
Sort all arcs in a gfsmArcPtrTable using a user-specified comparison function
Search a gfsmArcPtrTable tab sorted according to compare_func wrt data for the first element less-than or equal to key.
- Returns
- a pointer to the desired arc or NULL if no such element is found. Uses gfsm_array_lower_bound() (binary search)
Search a gfsmArcPtrTable tab sorted according to mask m for semring sr for the first element less-than or equal to key.
- Returns
- a pointer to the desired arc or NULL if no such element is found. Uses gfsm_array_lower_bound() (binary search)
Populate a gfsmArcTableIndex by indexing outgoing arcs from each state in fsm.
- Parameters
-
fsm | source automaton |
tabx | Indexed arc table to populate. May be passed as NULL to create a new indexed arc table. |
- Returns
- tabx if non-NULL, otherwise a new index for fsm.
- Note
- Caller is responsible for freeing tabx when it is no longer needed.
void gfsm_arc_table_index_sort_with_data |
( |
gfsmArcTableIndex * |
tabx, |
|
|
GCompareDataFunc |
compare_func, |
|
|
gpointer |
data |
|
) |
| |
Get number of outgoing arcs from state qid in tabx
Write the contents of a gfsmArcTableIndex to a (binary) gfsmIOHandle.
- Parameters
-
tabx | index to write |
ioh | handle to which data is to be written |
errp | if an error occurs, *errp will hold an error message |
- Returns
- true on success
Read the contents of a gfsmArcTableIndex from a (binary) gfsmIOHandle.
- Parameters
-
tabx | table into which data is to be read |
ioh | handle from which data is to be read |
errp | if an error occurs, *errp will hold an error message |
- Returns
- true on success
Open a gfsmArcRange for all outgoing arcs from state qid in tabx
Get current arc from a gfsmArcRange, which is assumed to be valid