summaryrefslogtreecommitdiff
path: root/klm/search/final.hh
blob: 24e6f0a5df4c7df599bf43ce2ff2d1e1c3929ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef SEARCH_FINAL__
#define SEARCH_FINAL__

#include "search/rule.hh"
#include "search/types.hh"

#include <boost/array.hpp>

namespace search {

class Final {
  public:
    typedef boost::array<const Final*, search::kMaxArity> ChildArray;

    void Reset(Score bound, const Rule &from, const Final &left, const Final &right) {
      bound_ = bound;
      from_ = &from;
      children_[0] = &left;
      children_[1] = &right;
    }

    const ChildArray &Children() const { return children_; }

    unsigned int ChildCount() const { return from_->Arity(); }

    const Rule &From() const { return *from_; }

    Score Bound() const { return bound_; }

  private:
    Score bound_;

    const Rule *from_;

    ChildArray children_;
};

} // namespace search

#endif // SEARCH_FINAL__