Data Structures
gfsmArcIter.h File Reference

Iterate over outgoing arcs of an automaton state. More...

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

Go to the source code of this file.

Data Structures

struct  gfsmArcIter
 Abstract type for arc iterators. More...

Functions

Arc Iterators: Constructors etc.
static void gfsm_arciter_open (gfsmArcIter *aip, gfsmAutomaton *fsm, gfsmStateId stateid)
static void gfsm_arciter_open_ptr (gfsmArcIter *aip, gfsmAutomaton *fsm, gfsmState *stateptr)
static void gfsm_arciter_close (gfsmArcIter *aip)
static gfsmArcItergfsm_arciter_copy (gfsmArcIter *dst, const gfsmArcIter *src)
static gfsmArcItergfsm_arciter_clone (const gfsmArcIter *src)

Arc Iterators: Accessors

typedef gboolean(* gfsmArcIterSeekFunc )(gfsmArcIter *aip, gpointer data)
 Typedef for user-seek functions.
static gboolean gfsm_arciter_ok (const gfsmArcIter *aip)
static void gfsm_arciter_next (gfsmArcIter *aip)
static void gfsm_arciter_reset (gfsmArcIter *aip)
static gfsmArcgfsm_arciter_arc (const gfsmArcIter *aip)
static void gfsm_arciter_remove (gfsmArcIter *aip)
void gfsm_arciter_seek_lower (gfsmArcIter *aip, gfsmLabelVal lo)
void gfsm_arciter_seek_upper (gfsmArcIter *aip, gfsmLabelVal hi)
void gfsm_arciter_seek_both (gfsmArcIter *aip, gfsmLabelVal lo, gfsmLabelVal hi)
void gfsm_arciter_seek_all (gfsmArcIter *aip, gfsmLabelVal lo, gfsmLabelVal hi, gfsmStateId dst)
void gfsm_arciter_seek_user (gfsmArcIter *aip, gfsmArcIterSeekFunc seekfunc, gpointer data)

Detailed Description

Typedef Documentation

typedef gboolean(* gfsmArcIterSeekFunc)(gfsmArcIter *aip, gpointer data)

Function Documentation

static void gfsm_arciter_open ( gfsmArcIter aip,
gfsmAutomaton fsm,
gfsmStateId  stateid 
)
inlinestatic

Open a gfsmArcIter aip for the outgoing arcs from state with ID qid in the automaton fsm.

Parameters
aipPointer to the gfsmArcIter to be opened; assumed to be already allocated
fsmAutomaton containing the state whose outgoing arcs are to be opened
qidID of the state whose outgoing arcs are to be opened
Note
  • Arc iterators may be silently invalidated by destructive operations
  • The arc iterator should be closed with gfsm_arciter_close() when it is no longer needed.
  • Caller is responsible for allocation and freeing of *aip.
static void gfsm_arciter_open_ptr ( gfsmArcIter aip,
gfsmAutomaton fsm,
gfsmState stateptr 
)
inlinestatic

"Open" an arc iterator for the outgoing arcs from a state pointer into fsm

Deprecated:
prefer gfsm_arciter_open()
static void gfsm_arciter_close ( gfsmArcIter aip)
inlinestatic

Close a gfsmArcIter aip if already opened, otherwise does nothing.

Parameters
aipThe gfsmArcIter to be closed.
Note
  • If multiple copies of a gfsmArcIter exist, only one needs to be closed.
  • Currently does nothing useful; in future versions this function may be required to free temporary allocations, etc.
static gfsmArcIter* gfsm_arciter_copy ( gfsmArcIter dst,
const gfsmArcIter src 
)
inlinestatic

Copy positional data from src to dst.

Parameters
srcThe gfsmArcIter from which to copy positional data
dstThe gfsmArcIter to which positional data is to be written
Note
  • Only the position pointed to should be copied by this method, and not the underlying data.
  • If you use this method to copy gfsmArcIter positions, you should subsequently call gfsm_arciter_close() on only one of them!
static gfsmArcIter* gfsm_arciter_clone ( const gfsmArcIter src)
inlinestatic
static gboolean gfsm_arciter_ok ( const gfsmArcIter aip)
inlinestatic

Check validity of a gfsmArcIter* aip.

Parameters
aipThe gfsmArcIter whose status is to be queried.
Returns
a true value if aip is considered valid, FALSE otherwise.
static void gfsm_arciter_next ( gfsmArcIter aip)
inlinestatic

Position the gfsmArcIter aip to the next available outgoing arc for which it was opened.

Parameters
aipThe gfsmArcIter to be incremented.
static void gfsm_arciter_reset ( gfsmArcIter aip)
inlinestatic

Reset an arc iterator to the first outgoing arc for which it was initially opened.

Parameters
aipthe gfsmArcIter to be reset
static gfsmArc* gfsm_arciter_arc ( const gfsmArcIter aip)
inlinestatic

Get current arc associated with a :gfsmArcIter, or NULL if none is available.

Parameters
aipThe gfsmArcIter to be 'dereferenced'.
Returns
A pointer to the current gfsmArc 'pointed to' by aip, or NULL if no more arcs are available.
Note
  • In future versions, a gfsmAutomaton implementation will be free to return a dynamically generated arc here: there is no general guarantee that modifications to the gfsmArc returned by this function will be propagated to the underlying gfsmAutomaton.
  • It is expected to remain the case that for the default automaton implementation class, the arcs returned by this function should be modifiable in-place.
static void gfsm_arciter_remove ( gfsmArcIter aip)
inlinestatic

Remove the arc referred to by a gfsmArcIter aip from the associated gfsmAutomaton, and position to the next available arc, if any.

Parameters
aipThe gfsmArcIter whose 'current' arc is to be removed.
void gfsm_arciter_seek_lower ( gfsmArcIter aip,
gfsmLabelVal  lo 
)

Position an arc-iterator to the current or next arc with lower label lo.

Parameters
aipThe gfsmArcIter to reposition
loLower arc label to seek
Note
Currently just wraps gfsm_arciter_ok(), gfsm_arciter_next() and gfsm_arciter_arc() in a linear search from the current position.
void gfsm_arciter_seek_upper ( gfsmArcIter aip,
gfsmLabelVal  hi 
)

Position an arc-iterator to the current or next arc with upper label hi.

Parameters
aipThe gfsmArcIter to reposition
loUpper arc label to seek
Note
Currently just wraps gfsm_arciter_ok(), gfsm_arciter_next() and gfsm_arciter_arc() in a linear search from the current position.
void gfsm_arciter_seek_both ( gfsmArcIter aip,
gfsmLabelVal  lo,
gfsmLabelVal  hi 
)

Position an arc-iterator to the current or next arc with lower label lo and upper label hi. If either lo or hi is gfsmNoLabel, no matching will be performed on the corresponding arc label(s).

Parameters
aipThe gfsmArcIter to reposition
loLower arc label to seek, or gfsmNoLabel to ignore lower labels
hiUpper arc label to seek, or gfsmNoLabel to ignore upper labels
Note
Default implementation wraps gfsm_arciter_ok(), gfsm_arciter_next() and gfsm_arciter_arc() in a linear search from the current position.
void gfsm_arciter_seek_all ( gfsmArcIter aip,
gfsmLabelVal  lo,
gfsmLabelVal  hi,
gfsmStateId  dst 
)

Position an arc-iterator to the current or next arc with lower label lo, upper label hi, and sink-state dst. If either lo or hi is gfsmNoLabel, no matching will be performed on the corresponding arc label(s).

Parameters
aipThe gfsmArcIter to reposition
loLower arc label to seek, or gfsmNoLabel to ignore lower labels
hiUpper arc label to seek, or gfsmNoLabel to ignore upper labels
dstSink state to seek, or gfsmNoState to ignore states
Note
Default implementation wraps gfsm_arciter_ok(), gfsm_arciter_next() and gfsm_arciter_arc() in a linear search from the current position.
void gfsm_arciter_seek_user ( gfsmArcIter aip,
gfsmArcIterSeekFunc  seekfunc,
gpointer  data 
)

Position an arc-iterator to the next arc for which (*seekfunc)(arciter,data) returns TRUE.

Note
Just wraps gfsm_arciter_ok() and gfsm_arciter_next() in a linear search from the current position.