FST  openfst-1.7.1
OpenFst Library
difference.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>
7 
8 namespace fst {
9 namespace script {
10 
11 void Difference(const FstClass &ifst1, const FstClass &ifst2,
12  MutableFstClass *ofst, const ComposeOptions &opts) {
13  if (!internal::ArcTypesMatch(ifst1, ifst2, "Difference") ||
14  !internal::ArcTypesMatch(*ofst, ifst1, "Difference")) {
15  ofst->SetProperties(kError, kError);
16  return;
17  }
18  DifferenceArgs args(ifst1, ifst2, ofst, opts);
19  Apply<Operation<DifferenceArgs>>("Difference", ifst1.ArcType(), &args);
20 }
21 
25 
26 } // namespace script
27 } // namespace fst
const string & ArcType() const final
Definition: fst-class.h:290
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
bool ArcTypesMatch(const M &m, const N &n, const string &op_name)
Definition: script-impl.h:176
std::tuple< const FstClass &, const FstClass &, MutableFstClass *, const ComposeOptions & > DifferenceArgs
Definition: difference.h:17
void Difference(DifferenceArgs *args)
Definition: difference.h:20
constexpr uint64 kError
Definition: properties.h:33
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:452