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

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTetsuo Kiso <tetsuo-s@is.naist.jp>2012-03-20 00:49:10 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2012-03-20 00:49:10 +0400
commit8987fed667c8c7cedfb714b28a061fb7b8030d6c (patch)
tree153d8406fcf4b558e952fc00b7c9a1b2403c9d49 /mert/Vocabulary.cpp
parent1678ee37695a94e237b1ca1d07a22373a0f3a0cb (diff)
Add thread unsafe Singleton class.
- Add Vocabulary factory and the unit test. - Remove Scorer::ClearVocabulary().
Diffstat (limited to 'mert/Vocabulary.cpp')
-rw-r--r--mert/Vocabulary.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/mert/Vocabulary.cpp b/mert/Vocabulary.cpp
new file mode 100644
index 000000000..40b04bf99
--- /dev/null
+++ b/mert/Vocabulary.cpp
@@ -0,0 +1,21 @@
+#include "Vocabulary.h"
+#include "Singleton.h"
+
+namespace mert {
+namespace {
+Vocabulary* g_vocab = NULL;
+} // namespace
+
+Vocabulary* VocabularyFactory::GetVocabulary() {
+ if (g_vocab == NULL) {
+ return Singleton<Vocabulary>::GetInstance();
+ } else {
+ return g_vocab;
+ }
+}
+
+void VocabularyFactory::SetVocabulary(Vocabulary* vocab) {
+ g_vocab = vocab;
+}
+
+} // namespace mert