diff options
author | siddharth jain <sija@microsoft.com> | 2021-01-12 20:21:31 +0300 |
---|---|---|
committer | siddharth jain <sija@microsoft.com> | 2021-01-12 20:21:31 +0300 |
commit | 64b356c79da2dfd002a0cf3b3e808483556f3023 (patch) | |
tree | 2a2cc916aac38500fd527fdbb069a987df85a33c | |
parent | 1631aa14d15068bfb8d028371a51c15503220be3 (diff) |
enum header
-rw-r--r-- | moses2/Moses2Wrapper.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/moses2/Moses2Wrapper.h b/moses2/Moses2Wrapper.h index 1a815e38f..c758ef2f3 100644 --- a/moses2/Moses2Wrapper.h +++ b/moses2/Moses2Wrapper.h @@ -1,20 +1,39 @@ #pragma once #include <string> -namespace Moses2 { +#include <string.h> +namespace Moses2 { class Parameter; class System; + extern "C" { + enum MosesApiErrorCode { + MS_API_OK, + MS_API_E_FAILURE, + MS_API_E_INPUT, + MS_API_E_TIMEOUT + }; + } class Moses2Wrapper { - Parameter *m_param; - System *m_system; + Parameter* m_param; + System* m_system; public: - Moses2Wrapper(const std::string &filePath); + Moses2Wrapper(const std::string& filePath); ~Moses2Wrapper(); - std::string Translate(const std::string &input, long id); - void UpdateLMPath(const std::string &filePath); + std::string Translate(const std::string& input, long id); + void UpdateLMPath(const std::string& filePath); int getEngineVersion(); + static char* CopyString(const char* str) { + int32_t size = (int32_t)strlen(str); + char* obj = (char*)malloc(size + 1); + memcpy(obj, str, size); + obj[size] = '\0'; + return obj; + } + static void Free(void* ptr) { + free(ptr); + } }; }
\ No newline at end of file |