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:
authorHieu Hoang <hieuhoang@gmail.com>2015-10-19 19:22:48 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-10-19 19:22:48 +0300
commitfda97b08021238c54a440003da5d760f5f0a1349 (patch)
tree15508ad2be39d354fe22430bbb85b78d1bc6f81b /moses/Bitmaps.cpp
parent9408cc916e670d66bd6974f3870ff6468faecefa (diff)
Revert "share bitmaps"
This reverts commit d28b00a1c6da6347d0c9f8a0ee4b01dff279e495.
Diffstat (limited to 'moses/Bitmaps.cpp')
-rw-r--r--moses/Bitmaps.cpp41
1 files changed, 17 insertions, 24 deletions
diff --git a/moses/Bitmaps.cpp b/moses/Bitmaps.cpp
index a052f1f7e..2637cd46d 100644
--- a/moses/Bitmaps.cpp
+++ b/moses/Bitmaps.cpp
@@ -7,46 +7,39 @@ namespace Moses
Bitmaps::Bitmaps(size_t inputSize)
{
m_initBitmap = new WordsBitmap(inputSize);
- m_coll[m_initBitmap];
+ m_coll.insert(m_initBitmap);
}
Bitmaps::~Bitmaps()
{
- //RemoveAllInColl(m_coll);
+ RemoveAllInColl(m_coll);
}
-const WordsBitmap &Bitmaps::GetNextBitmap(const WordsBitmap &bm, const WordsRange &range)
+const WordsBitmap &Bitmaps::GetBitmap(const WordsBitmap &bm)
{
- WordsBitmap *newBM = new WordsBitmap(bm);
- newBM->SetValue(range, true);
-
- Coll::const_iterator iter = m_coll.find(newBM);
+ Coll::const_iterator iter = m_coll.find(&bm);
if (iter == m_coll.end()) {
- m_coll[newBM];
+ WordsBitmap *newBM = new WordsBitmap(bm);
+ m_coll.insert(newBM);
return *newBM;
} else {
- return *iter->first;
+ return **iter;
}
}
const WordsBitmap &Bitmaps::GetBitmap(const WordsBitmap &bm, const WordsRange &range)
{
- Coll::iterator iter = m_coll.find(&bm);
- assert(iter != m_coll.end());
-
- const WordsBitmap *newBM;
- NextBitmaps &next = iter->second;
- NextBitmaps::const_iterator iterNext = next.find(range);
- if (iterNext == next.end()) {
- // not seen the link yet.
- newBM = &GetNextBitmap(bm, range);
- next[range] = newBM;
- }
- else {
- // link exist
- newBM = iterNext->second;
+ WordsBitmap *newBM = new WordsBitmap(bm);
+ newBM->SetValue(range, true);
+
+ Coll::const_iterator iter = m_coll.find(newBM);
+ if (iter == m_coll.end()) {
+ m_coll.insert(newBM);
+ return *newBM;
+ } else {
+ delete newBM;
+ return **iter;
}
- return *newBM;
}
}