FST  openfst-1.6.1
OpenFst Library
compose.cc
Go to the documentation of this file.
1 // See www.openfst.org for extensive documentation on this weighted
2 // finite-state transducer library.
3 
4 #include <fst/script/fst-class.h>
5 #include <fst/script/compose.h>
7 
8 namespace fst {
9 namespace script {
10 
11 // 1
12 void Compose(const FstClass &ifst1, const FstClass &ifst2,
13  MutableFstClass *ofst, ComposeFilter compose_filter) {
14  if (!ArcTypesMatch(ifst1, ifst2, "Compose") ||
15  !ArcTypesMatch(*ofst, ifst1, "Compose")) {
16  ofst->SetProperties(kError, kError);
17  return;
18  }
19  ComposeArgs1 args(ifst1, ifst2, ofst, compose_filter);
20  Apply<Operation<ComposeArgs1>>("Compose", ifst1.ArcType(), &args);
21 }
22 
23 // 2
24 void Compose(const FstClass &ifst1, const FstClass &ifst2,
25  MutableFstClass *ofst, const ComposeOptions &copts) {
26  if (!ArcTypesMatch(ifst1, ifst2, "Compose") ||
27  !ArcTypesMatch(*ofst, ifst1, "Compose")) {
28  ofst->SetProperties(kError, kError);
29  return;
30  }
31  ComposeArgs2 args(ifst1, ifst2, ofst, copts);
32  Apply<Operation<ComposeArgs2>>("Compose", ifst1.ArcType(), &args);
33 }
34 
38 
42 
43 } // namespace script
44 } // namespace fst
const string & ArcType() const override
Definition: fst-class.h:289
void Compose(ComposeArgs1 *args)
Definition: compose.h:18
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
constexpr uint64 kError
Definition: properties.h:33
bool ArcTypesMatch(const M &m, const N &n, const string &op_name)
Definition: script-impl.h:177
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:455
ComposeFilter
Definition: compose.h:920