File size: 1,549 Bytes
158b61b |
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 |
// -*- c++ -*-
#pragma once
#include <string>
#include <map>
#include <vector>
#ifdef WITH_THREADS
#include <boost/thread.hpp>
#endif
#include <boost/shared_ptr.hpp>
#include <xmlrpc-c/base.hpp>
#include "../TranslationTask.h"
#include "Translator.h"
namespace Moses2
{
class Hypothesis;
class System;
class Manager;
class
TranslationRequest : public virtual TranslationTask
{
protected:
std::map<std::string, xmlrpc_c::value> m_retData;
Translator* m_translator;
boost::condition_variable& m_cond;
boost::mutex& m_mutex;
bool m_done;
TranslationRequest(xmlrpc_c::paramList const& paramList,
boost::condition_variable& cond,
boost::mutex& mut,
System &system,
const std::string &line,
long translationId);
void
pack_hypothesis(const Manager& manager, Hypothesis const* h,
std::string const& key,
std::map<std::string, xmlrpc_c::value> & dest) const;
public:
static
boost::shared_ptr<TranslationRequest>
create(Translator* translator,
xmlrpc_c::paramList const& paramList,
boost::condition_variable& cond,
boost::mutex& mut,
System &system,
const std::string &line,
long translationId);
virtual bool
DeleteAfterExecution() {
return false;
}
bool
IsDone() const {
return m_done;
}
std::map<std::string, xmlrpc_c::value> const&
GetRetData() {
return m_retData;
}
void
Run();
};
}
|