FST  openfst-1.7.2
OpenFst Library
push.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/push.h>
7 
8 namespace fst {
9 namespace script {
10 
11 void Push(MutableFstClass *fst, ReweightType rew_type, float delta,
12  bool remove_total_weight) {
13  PushArgs1 args(fst, rew_type, delta, remove_total_weight);
14  Apply<Operation<PushArgs1>>("Push", fst->ArcType(), &args);
15 }
16 
17 void Push(const FstClass &ifst, MutableFstClass *ofst, uint32 flags,
18  ReweightType rew_type, float delta) {
19  if (!internal::ArcTypesMatch(ifst, *ofst, "Push")) {
20  ofst->SetProperties(kError, kError);
21  return;
22  }
23  PushArgs2 args(ifst, ofst, flags, rew_type, delta);
24  Apply<Operation<PushArgs2>>("Push", ifst.ArcType(), &args);
25 }
26 
30 
34 
35 } // namespace script
36 } // namespace fst
ReweightType
Definition: reweight.h:17
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< MutableFstClass *, ReweightType, float, bool > PushArgs1
Definition: push.h:15
uint32_t uint32
Definition: types.h:31
void Push(PushArgs1 *args)
Definition: push.h:18
constexpr uint64 kError
Definition: properties.h:33
void SetProperties(uint64 props, uint64 mask)
Definition: fst-class.h:452
std::tuple< const FstClass &, MutableFstClass *, uint32, ReweightType, float > PushArgs2
Definition: push.h:24