mosesdecoder/mert/Vocabulary.cpp
Tetsuo Kiso 8987fed667 Add thread unsafe Singleton class.
- Add Vocabulary factory and the unit test.
- Remove Scorer::ClearVocabulary().
2012-03-20 05:49:10 +09:00

22 lines
383 B
C++

#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