FST  openfst-1.7.3
OpenFst Library
intersect.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/intersect.h>
5 
6 #include <fst/script/fst-class.h>
8 
9 namespace fst {
10 namespace script {
11 
12 void Intersect(const FstClass &ifst1, const FstClass &ifst2,
13  MutableFstClass *ofst, const ComposeOptions &opts) {
14  if (!internal::ArcTypesMatch(ifst1, ifst2, "Intersect") ||
15  !internal::ArcTypesMatch(*ofst, ifst1, "Intersect")) {
16  ofst->SetProperties(kError, kError);
17  return;
18  }
19  IntersectArgs args(ifst1, ifst2, ofst, opts);
20  Apply<Operation<IntersectArgs>>("Intersect", ifst1.ArcType(), &args);
21 }
22 
26 
27 } // namespace script
28 } // namespace fst
std::tuple< const FstClass &, const FstClass &, MutableFstClass *, const ComposeOptions & > IntersectArgs
Definition: intersect.h:17
const std::string & ArcType() const final
Definition: fst-class.h:298
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
bool ArcTypesMatch(const M &m, const N &n, const std::string &op_name)
Definition: script-impl.h:177
void Intersect(IntersectArgs *args)
Definition: intersect.h:20
constexpr uint64 kError
Definition: properties.h:34
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:465