File size: 1,431 Bytes
fd49381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * Manager.h
 *
 *  Created on: 23 Oct 2015
 *      Author: hieu
 */

#pragma once

#include <queue>
#include <cstddef>
#include <string>
#include <deque>
#include "Phrase.h"
#include "MemPool.h"
#include "Recycler.h"
#include "EstimatedScores.h"
#include "ArcLists.h"
#include "legacy/Bitmaps.h"

namespace Moses2
{

class System;
class TranslationTask;
class PhraseImpl;
class SearchNormal;
class Search;
class InputType;
class OutputCollector;
class HypothesisBase;

class ManagerBase
{
public:
  System &system;
  const TranslationTask &task;
  mutable ArcLists arcLists;

  ManagerBase(System &sys, const TranslationTask &task,
              const std::string &inputStr, long translationId);
  virtual ~ManagerBase();
  virtual void Decode() = 0;
  virtual std::string OutputBest() const = 0;
  virtual std::string OutputNBest() = 0;
  virtual std::string OutputTransOpt() = 0;

  MemPool &GetPool() const {
    return *m_pool;
  }

  MemPool &GetSystemPool() const {
    return *m_systemPool;
  }

  Recycler<HypothesisBase*> &GetHypoRecycle() const {
    return *m_hypoRecycle;
  }

  const InputType &GetInput() const {
    return *m_input;
  }

  long GetTranslationId() const {
    return m_translationId;
  }

protected:
  std::string m_inputStr;
  long m_translationId;
  InputType *m_input;

  mutable MemPool *m_pool, *m_systemPool;
  mutable Recycler<HypothesisBase*> *m_hypoRecycle;

  void InitPools();

};

}