diff options
Diffstat (limited to 'gfsm/gfsm/src/libgfsm/gfsmStateSet.hi')
-rw-r--r-- | gfsm/gfsm/src/libgfsm/gfsmStateSet.hi | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/gfsm/gfsm/src/libgfsm/gfsmStateSet.hi b/gfsm/gfsm/src/libgfsm/gfsmStateSet.hi new file mode 100644 index 0000000..c2d1248 --- /dev/null +++ b/gfsm/gfsm/src/libgfsm/gfsmStateSet.hi @@ -0,0 +1,154 @@ + +/*=============================================================================*\ + * File: gfsmStateSet.hi + * Author: Bryan Jurish <moocow@ling.uni-potsdam.de> + * Description: finite state machine library: state sets: inlined definitions + * + * Copyright (c) 2004-2007 Bryan Jurish. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + *=============================================================================*/ + +/*====================================================================== + * Methods: Constructors etc. + */ + +//-------------------------------------------------------------- +// sized_new() +GFSM_INLINE +gfsmStateSet *gfsm_stateset_sized_new(guint isize) +{ + return g_array_sized_new(FALSE,TRUE,sizeof(gfsmStateId),isize); +} + +//-------------------------------------------------------------- +// new() +GFSM_INLINE +gfsmStateSet *gfsm_stateset_new(void) +{ + return gfsm_stateset_sized_new(gfsmStateSetDefaultSize); +} + +//-------------------------------------------------------------- +// new_singleton() +GFSM_INLINE +gfsmStateSet *gfsm_stateset_new_singleton(gfsmStateId id) +{ + gfsmStateSet *sset = gfsm_stateset_new(); + g_array_insert_val(sset,0,id); + return sset; +} + +//-------------------------------------------------------------- +// clear() +GFSM_INLINE +void gfsm_stateset_clear(gfsmStateSet *sset) +{ + g_array_set_size(sset,0); +} + +//-------------------------------------------------------------- +// clone() +GFSM_INLINE +gfsmStateSet *gfsm_stateset_clone(gfsmStateSet *src) +{ + return g_array_append_vals(gfsm_stateset_sized_new(src->len), src->data, src->len); +} + +//-------------------------------------------------------------- +// free() +GFSM_INLINE +void gfsm_stateset_free(gfsmStateSet *sset) +{ + g_array_free(sset,TRUE); +} + +/*====================================================================== + * Methods: Accessors + */ + +//-------------------------------------------------------------- +// min() +GFSM_INLINE +gfsmStateId gfsm_stateset_min(gfsmStateSet *sset) +{ + return sset->len > 0 ? (*((gfsmStateId*)sset->data)) : gfsmNoState; +} + +//-------------------------------------------------------------- +// size() +GFSM_INLINE +guint gfsm_stateset_size(gfsmStateSet *sset) +{ + return sset->len; +} + +//-------------------------------------------------------------- +// find() +//--EXTERN + +//-------------------------------------------------------------- +// contains() +GFSM_INLINE +gboolean gfsm_stateset_contains(gfsmStateSet *sset, gfsmStateId id) +{ + gfsmStateSetIter sseti = gfsm_stateset_find(sset,id); + return sseti != NULL && *sseti != gfsmNoState; +} + +//-------------------------------------------------------------- +// insert() +//--EXTERN + +//-------------------------------------------------------------- +// union() +//--EXTERN + +//-------------------------------------------------------------- +// remove() +//--EXTERN + +//-------------------------------------------------------------- +// equal() +//--EXTERN + +/*====================================================================== + * Methods: Utilities + */ + +//-------------------------------------------------------------- +// hash() +//--EXTERN + + +//-------------------------------------------------------------- +// foreach() +//--EXTERN + +/*====================================================================== + * Methods: Automaton access + */ + +//-------------------------------------------------------------- +// populate() +//--EXTERN + +//-------------------------------------------------------------- +// has_final_state() +//--EXTERN + +//-------------------------------------------------------------- +// lookup_final_weight() +//--EXTERN |