Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ManagedMoses.cpp « MosesManagedDLL « other-builds « contrib - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f897625c49372bb90b9afe287b9cf0f0149a1b39 (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
#include <msclr/marshal_cppstd.h>
#include "Moses2Wrapper.h"

using namespace System;
using namespace msclr::interop;

//TODO: include headers as per the build process
namespace Moses {
    public ref class Moses2Wrapper
    {
        public:
            Moses2Wrapper(String^ filePath) { 
                const std::string standardString = marshal_as<std::string>(filePath);
                m_pWrapper = new Moses2::Moses2Wrapper(standardString); 
            }
           ~Moses2Wrapper() { this->!Moses2Wrapper(); }
           String^ Translate(String^ input, long requestId) {
               const std::string standardString = marshal_as<std::string>(input);
               std::string output = m_pWrapper->Translate(standardString, requestId);
               String^ str = gcnew String(output.c_str());
               return str;
           }
        protected:
            !Moses2Wrapper() { delete m_pWrapper; m_pWrapper = nullptr; }
        private:
            Moses2::Moses2Wrapper *m_pWrapper;
    };
}