Main Page
Related Pages
Data Structures
Files
File List
Globals
src
libgfsm
gfsmTrie.h
Go to the documentation of this file.
1
2
/*=============================================================================*\
3
* File: gfsmTrie.h
4
* Author: Bryan Jurish <moocow.bovine@gmail.com>
5
* Description: finite state machine library
6
*
7
* Copyright (c) 2005-2007 Bryan Jurish.
8
*
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Lesser General Public
11
* License as published by the Free Software Foundation; either
12
* version 3 of the License, or (at your option) any later version.
13
*
14
* This library is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Lesser General Public License for more details.
18
*
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with this library; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
*=============================================================================*/
23
28
#ifndef _GFSM_TRIE_H
29
#define _GFSM_TRIE_H
30
31
#include <
gfsmAutomaton.h
>
32
33
/*======================================================================
34
* Types: Trie
35
*/
37
typedef
gfsmAutomaton
gfsmTrie
;
38
39
/*======================================================================
40
* Constants
41
*/
43
extern
const
gfsmAutomatonFlags
gfsmTrieDefaultFlags
;
44
46
extern
const
gfsmSRType
gfsmTrieDefaultSRType
;
47
48
49
/*======================================================================
50
* Methods: Constructors etc.
51
*/
53
54
55
//------------------------------
57
#define gfsm_trie_new() \
58
gfsm_automaton_new_full(gfsmTrieDefaultFlags, gfsmTrieDefaultSRType, gfsmAutomatonDefaultSize)
59
61
62
63
/*======================================================================
64
* Methods: Manipulation
65
*/
67
68
69
//------------------------------
80
gfsmStateId
gfsm_trie_add_path
(
gfsmTrie
*trie,
81
gfsmLabelVector
*lo,
82
gfsmLabelVector
*hi,
83
gfsmWeight
w);
84
85
//------------------------------
99
gfsmStateId
gfsm_trie_add_path_full
(
gfsmTrie
*trie,
100
gfsmLabelVector
*lo,
101
gfsmLabelVector
*hi,
102
gfsmWeight
w,
103
gboolean add_to_arcs,
104
gboolean add_to_state_final,
105
gboolean add_to_path_final,
106
gfsmStateIdVector
*path_states
107
);
108
109
/*======================================================================
110
* Methods: find path
111
*/
122
gfsmStateId
gfsm_trie_find_prefix
(
gfsmTrie
*trie,
123
gfsmLabelVector
*lo,
124
gfsmLabelVector
*hi,
125
guint *lo_i,
126
guint *hi_i,
127
gfsmWeight
*w_last,
128
gfsmStateIdVector
*path_states
129
);
130
131
132
/*======================================================================
133
* Methods: find arcs
134
*/
141
gfsmArc
*
gfsm_trie_find_arc_lower
(
gfsmTrie
*trie,
gfsmStateId
qid,
gfsmLabelVal
lab);
142
149
gfsmArc
*
gfsm_trie_find_arc_upper
(
gfsmTrie
*trie,
gfsmStateId
qid,
gfsmLabelVal
lab);
150
158
gfsmArc
*
gfsm_trie_find_arc_both
(
gfsmTrie
*trie,
gfsmStateId
qid,
gfsmLabelVal
lo,
gfsmLabelVal
hi);
159
160
161
/*======================================================================
162
* Methods: find or insert arcs
163
*/
173
gfsmStateId
gfsm_trie_get_arc_lower
(
gfsmTrie
*trie,
gfsmStateId
qid,
gfsmLabelVal
lab,
gfsmWeight
w, gboolean add_weight);
174
184
gfsmStateId
gfsm_trie_get_arc_upper
(
gfsmTrie
*trie,
gfsmStateId
qid,
gfsmLabelVal
lab,
gfsmWeight
w, gboolean add_weight);
185
196
gfsmStateId
gfsm_trie_get_arc_both
(
gfsmTrie
*trie,
gfsmStateId
qid,
gfsmLabelVal
lo,
gfsmLabelVal
hi,
gfsmWeight
w, gboolean add_weight);
197
199
200
201
#endif
/* _GFSM_LOOKUP_H */
Generated on Tue Oct 21 2014 09:44:47 for libgfsm by
1.8.1.2