FST  openfst-1.7.1
OpenFst Library
arc-class.h
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 #ifndef FST_SCRIPT_ARC_CLASS_H_
5 #define FST_SCRIPT_ARC_CLASS_H_
6 
8 
9 namespace fst {
10 namespace script {
11 
12 // A struct representing an arc while ignoring arc type. It is passed as an
13 // argument to AddArc.
14 
15 struct ArcClass {
16  template <class Arc>
17  explicit ArcClass(const Arc &arc)
18  : ilabel(arc.ilabel), olabel(arc.olabel), weight(arc.weight),
19  nextstate(arc.nextstate) {}
20 
23  : ilabel(ilabel), olabel(olabel), weight(weight), nextstate(nextstate) {}
24 
25  template <class Arc>
26  Arc GetArc() const {
27  return Arc(ilabel, olabel, *(weight.GetWeight<typename Arc::Weight>()),
28  nextstate);
29  }
30 
35 };
36 
37 } // namespace script
38 } // namespace fst
39 
40 #endif // FST_SCRIPT_ARC_CLASS_H_
ArcClass(int64 ilabel, int64 olabel, const WeightClass &weight, int64 nextstate)
Definition: arc-class.h:21
int64_t int64
Definition: types.h:27
const W * GetWeight() const
Definition: weight-class.h:133
ArcClass(const Arc &arc)
Definition: arc-class.h:17
Arc GetArc() const
Definition: arc-class.h:26
WeightClass weight
Definition: arc-class.h:33