1
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6//     http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13//
14// Copyright 2005-2010 Google, Inc.
15// Author: jpr@google.com (Jake Ratkiewicz)
16
17// Convenience file that includes all FstScript functionality
18
19#ifndef FST_SCRIPT_FSTSCRIPT_H_
20#define FST_SCRIPT_FSTSCRIPT_H_
21
22// Major classes
23#include <fst/script/fst-class.h>
24#include <fst/script/weight-class.h>
25#include <fst/script/text-io.h>
26
27// Templates like Operation< >, Apply< >
28#include <fst/script/script-impl.h>
29
30// Operations
31#include <fst/script/arcsort.h>
32#include <fst/script/closure.h>
33#include <fst/script/compile.h>
34#include <fst/script/compose.h>
35#include <fst/script/concat.h>
36#include <fst/script/connect.h>
37#include <fst/script/convert.h>
38#include <fst/script/decode.h>
39#include <fst/script/determinize.h>
40#include <fst/script/difference.h>
41#include <fst/script/draw.h>
42#include <fst/script/encode.h>
43#include <fst/script/epsnormalize.h>
44#include <fst/script/equal.h>
45#include <fst/script/equivalent.h>
46#include <fst/script/info.h>
47#include <fst/script/intersect.h>
48#include <fst/script/invert.h>
49#include <fst/script/map.h>
50#include <fst/script/minimize.h>
51#include <fst/script/print.h>
52#include <fst/script/project.h>
53#include <fst/script/prune.h>
54#include <fst/script/push.h>
55#include <fst/script/randequivalent.h>
56#include <fst/script/randgen.h>
57#include <fst/script/relabel.h>
58#include <fst/script/replace.h>
59#include <fst/script/reverse.h>
60#include <fst/script/reweight.h>
61#include <fst/script/rmepsilon.h>
62#include <fst/script/shortest-distance.h>
63#include <fst/script/shortest-path.h>
64#include <fst/script/symbols.h>
65#include <fst/script/synchronize.h>
66#include <fst/script/topsort.h>
67#include <fst/script/union.h>
68#include <fst/script/verify.h>
69
70//
71// REGISTER OPERATIONS
72//
73
74
75// This class is necessary because registering each of the operations
76// separately overfills the stack, as there's so many of them.
77namespace fst {
78namespace script {
79template<class Arc>
80class AllFstOperationsRegisterer {
81 public:
82  AllFstOperationsRegisterer() {
83    RegisterBatch1();
84    RegisterBatch2();
85  }
86
87 private:
88  void RegisterBatch1() {
89    REGISTER_FST_OPERATION(ArcSort, Arc, ArcSortArgs);
90    REGISTER_FST_OPERATION(Closure, Arc, ClosureArgs);
91    REGISTER_FST_OPERATION(CompileFst, Arc, FstCompileArgs);
92    REGISTER_FST_OPERATION(Compose, Arc, ComposeArgs1);
93    REGISTER_FST_OPERATION(Compose, Arc, ComposeArgs2);
94    REGISTER_FST_OPERATION(Concat, Arc, ConcatArgs1);
95    REGISTER_FST_OPERATION(Concat, Arc, ConcatArgs2);
96    REGISTER_FST_OPERATION(Connect, Arc, MutableFstClass);
97    REGISTER_FST_OPERATION(Convert, Arc, ConvertArgs);
98    REGISTER_FST_OPERATION(Decode, Arc, DecodeArgs);
99    REGISTER_FST_OPERATION(Determinize, Arc, DeterminizeArgs);
100    REGISTER_FST_OPERATION(Difference, Arc, DifferenceArgs1);
101    REGISTER_FST_OPERATION(Difference, Arc, DifferenceArgs2);
102    REGISTER_FST_OPERATION(DrawFst, Arc, FstDrawerArgs);
103    REGISTER_FST_OPERATION(Encode, Arc, EncodeArgs);
104    REGISTER_FST_OPERATION(EpsNormalize, Arc, EpsNormalizeArgs);
105    REGISTER_FST_OPERATION(Equal, Arc, EqualArgs);
106    REGISTER_FST_OPERATION(Equivalent, Arc, EquivalentArgs);
107    REGISTER_FST_OPERATION(PrintFstInfo, Arc, InfoArgs);
108    REGISTER_FST_OPERATION(Intersect, Arc, IntersectArgs1);
109    REGISTER_FST_OPERATION(Intersect, Arc, IntersectArgs2);
110    REGISTER_FST_OPERATION(Invert, Arc, MutableFstClass);
111    REGISTER_FST_OPERATION(Map, Arc, MapArgs);
112    REGISTER_FST_OPERATION(Minimize, Arc, MinimizeArgs);
113  }
114
115  void RegisterBatch2() {
116    REGISTER_FST_OPERATION(PrintFst, Arc, FstPrinterArgs);
117    REGISTER_FST_OPERATION(Project, Arc, ProjectArgs);
118    REGISTER_FST_OPERATION(Prune, Arc, PruneArgs1);
119    REGISTER_FST_OPERATION(Prune, Arc, PruneArgs2);
120    REGISTER_FST_OPERATION(Prune, Arc, PruneArgs3);
121    REGISTER_FST_OPERATION(Prune, Arc, PruneArgs4);
122    REGISTER_FST_OPERATION(Push, Arc, PushArgs1);
123    REGISTER_FST_OPERATION(Push, Arc, PushArgs2);
124    REGISTER_FST_OPERATION(RandEquivalent, Arc, RandEquivalentArgs1);
125    REGISTER_FST_OPERATION(RandEquivalent, Arc, RandEquivalentArgs2);
126    REGISTER_FST_OPERATION(RandGen, Arc, RandGenArgs);
127    REGISTER_FST_OPERATION(Relabel, Arc, RelabelArgs1);
128    REGISTER_FST_OPERATION(Relabel, Arc, RelabelArgs2);
129    REGISTER_FST_OPERATION(Relabel, Arc, RelabelArgs3);
130    REGISTER_FST_OPERATION(Replace, Arc, ReplaceArgs);
131    REGISTER_FST_OPERATION(Reverse, Arc, ReverseArgs);
132    REGISTER_FST_OPERATION(Reweight, Arc, ReweightArgs);
133    REGISTER_FST_OPERATION(RmEpsilon, Arc, RmEpsilonArgs1);
134    REGISTER_FST_OPERATION(RmEpsilon, Arc, RmEpsilonArgs2);
135    REGISTER_FST_OPERATION(RmEpsilon, Arc, RmEpsilonArgs3);
136    REGISTER_FST_OPERATION(ShortestDistance, Arc, ShortestDistanceArgs1);
137    REGISTER_FST_OPERATION(ShortestDistance, Arc, ShortestDistanceArgs2);
138    REGISTER_FST_OPERATION(ShortestDistance, Arc, ShortestDistanceArgs3);
139    REGISTER_FST_OPERATION(ShortestPath, Arc, ShortestPathArgs1);
140    REGISTER_FST_OPERATION(ShortestPath, Arc, ShortestPathArgs2);
141    REGISTER_FST_OPERATION(Synchronize, Arc, SynchronizeArgs);
142    REGISTER_FST_OPERATION(TopSort, Arc, TopSortArgs);
143    REGISTER_FST_OPERATION(Union, Arc, UnionArgs);
144    REGISTER_FST_OPERATION(Verify, Arc, VerifyArgs);
145  }
146};
147}  // namespace script
148}  // namespace fst
149
150
151#define REGISTER_FST_OPERATIONS(Arc) \
152  AllFstOperationsRegisterer<Arc> register_all_fst_operations ## Arc;
153
154#endif  // FST_SCRIPT_FSTSCRIPT_H_
155